should be it

This commit is contained in:
2025-10-24 19:21:19 -05:00
parent a4b23fc57c
commit f09560c7b1
14047 changed files with 3161551 additions and 1 deletions

View File

@@ -0,0 +1,42 @@
# name: benchmark/tpch/union/q01_union.benchmark
# description: Union of separate tables into a single aggregate
# group: [union]
include benchmark/tpch/tpch_load.benchmark.in
name Lineitem Union Q01
group union
subgroup tpch
run
SELECT
l_returnflag,
l_linestatus,
sum(l_quantity) AS sum_qty,
sum(l_extendedprice) AS sum_base_price,
sum(l_extendedprice * (1 - l_discount)) AS sum_disc_price,
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge,
avg(l_quantity) AS avg_qty,
avg(l_extendedprice) AS avg_price,
avg(l_discount) AS avg_disc,
count(*) AS count_order
FROM
(
SELECT * FROM lineitem WHERE l_shipdate <= DATE '1990-09-02'
UNION ALL
SELECT * FROM lineitem WHERE l_shipdate > DATE '1990-09-02' AND l_shipdate <= DATE '1992-09-02'
UNION ALL
SELECT * FROM lineitem WHERE l_shipdate > DATE '1992-09-02' AND l_shipdate <= DATE '1994-09-02'
UNION ALL
SELECT * FROM lineitem WHERE l_shipdate > DATE '1994-09-02' AND l_shipdate <= DATE '1996-09-02'
UNION ALL
SELECT * FROM lineitem WHERE l_shipdate > DATE '1996-09-02' AND l_shipdate <= DATE '1998-09-02'
) lineitem
GROUP BY
l_returnflag,
l_linestatus
ORDER BY
l_returnflag,
l_linestatus;
result extension/tpch/dbgen/answers/sf1/q01.csv sf=1

View File

@@ -0,0 +1,33 @@
# name: benchmark/tpch/union/ungrouped_aggregate_union.benchmark
# description: Ungrouped aggregates split over separate unions
# group: [union]
include benchmark/tpch/tpch_load.benchmark.in
name Lineitem Union Ungrouped Aggregate
group union
subgroup tpch
run
SELECT sum(l_quantity) AS sum FROM lineitem WHERE l_shipdate <= CAST('1998-09-02' AS date)
UNION ALL
SELECT sum(l_extendedprice) FROM lineitem WHERE l_shipdate <= CAST('1998-09-02' AS date)
UNION ALL
SELECT sum(l_extendedprice * (1 - l_discount)) FROM lineitem WHERE l_shipdate <= CAST('1998-09-02' AS date)
UNION ALL
SELECT sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) FROM lineitem WHERE l_shipdate <= CAST('1998-09-02' AS date)
UNION ALL
SELECT avg(l_quantity) FROM lineitem WHERE l_shipdate <= CAST('1998-09-02' AS date)
UNION ALL
SELECT avg(l_extendedprice) FROM lineitem WHERE l_shipdate <= CAST('1998-09-02' AS date)
UNION ALL
SELECT count(*) FROM lineitem WHERE l_shipdate <= CAST('1998-09-02' AS date)
result I sf=1
150921317.0
226343830189.75
215030862295.13
223635377438.35
25.50815444231315
38255.78448632836
5916591.0