Skip to content

Commit 23624ef

Browse files
authored
chore: update benchmark verify code. (#1356)
1 parent 1716106 commit 23624ef

File tree

24 files changed

+971
-701
lines changed

24 files changed

+971
-701
lines changed

scripts/tpch_result_verify.py

Lines changed: 16 additions & 701 deletions
Large diffs are not rendered by default.

third_party/bigframes_vendored/tpch/TPC-EULA.txt

Lines changed: 320 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
select
2+
l_returnflag,
3+
l_linestatus,
4+
sum(l_quantity) as sum_qty,
5+
sum(l_extendedprice) as sum_base_price,
6+
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
7+
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
8+
avg(l_quantity) as avg_qty,
9+
avg(l_extendedprice) as avg_price,
10+
avg(l_discount) as avg_disc,
11+
count(*) as count_order
12+
from
13+
{line_item_ds}
14+
where
15+
l_shipdate <= '1998-09-02'
16+
group by
17+
l_returnflag,
18+
l_linestatus
19+
order by
20+
l_returnflag,
21+
l_linestatus
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
select
2+
c_custkey,
3+
c_name,
4+
round(sum(l_extendedprice * (1 - l_discount)), 2) as revenue,
5+
c_acctbal,
6+
n_name,
7+
c_address,
8+
c_phone,
9+
c_comment
10+
from
11+
{customer_ds},
12+
{orders_ds},
13+
{line_item_ds},
14+
{nation_ds}
15+
where
16+
c_custkey = o_custkey
17+
and l_orderkey = o_orderkey
18+
and o_orderdate >= date '1993-10-01'
19+
and o_orderdate < date '1993-10-01' + interval '3' month
20+
and l_returnflag = 'R'
21+
and c_nationkey = n_nationkey
22+
group by
23+
c_custkey,
24+
c_name,
25+
c_acctbal,
26+
c_phone,
27+
n_name,
28+
c_address,
29+
c_comment
30+
order by
31+
revenue desc
32+
limit 20
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
select
2+
ps_partkey,
3+
round(sum(ps_supplycost * ps_availqty), 2) as value
4+
from
5+
{part_supp_ds},
6+
{supplier_ds},
7+
{nation_ds}
8+
where
9+
ps_suppkey = s_suppkey
10+
and s_nationkey = n_nationkey
11+
and n_name = 'GERMANY'
12+
group by
13+
ps_partkey having
14+
sum(ps_supplycost * ps_availqty) > (
15+
select
16+
sum(ps_supplycost * ps_availqty) * 0.0001
17+
from
18+
{part_supp_ds},
19+
{supplier_ds},
20+
{nation_ds}
21+
where
22+
ps_suppkey = s_suppkey
23+
and s_nationkey = n_nationkey
24+
and n_name = 'GERMANY'
25+
)
26+
order by
27+
value desc
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
select
2+
l_shipmode,
3+
sum(case
4+
when o_orderpriority = '1-URGENT'
5+
or o_orderpriority = '2-HIGH'
6+
then 1
7+
else 0
8+
end) as high_line_count,
9+
sum(case
10+
when o_orderpriority <> '1-URGENT'
11+
and o_orderpriority <> '2-HIGH'
12+
then 1
13+
else 0
14+
end) as low_line_count
15+
from
16+
{orders_ds},
17+
{line_item_ds}
18+
where
19+
o_orderkey = l_orderkey
20+
and l_shipmode in ('MAIL', 'SHIP')
21+
and l_commitdate < l_receiptdate
22+
and l_shipdate < l_commitdate
23+
and l_receiptdate >= date '1994-01-01'
24+
and l_receiptdate < date '1994-01-01' + interval '1' year
25+
group by
26+
l_shipmode
27+
order by
28+
l_shipmode
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
SELECT
2+
c_count, COUNT(*) AS custdist
3+
FROM (
4+
SELECT
5+
c_custkey,
6+
COUNT(o_orderkey) AS c_count
7+
FROM
8+
{customer_ds} LEFT OUTER JOIN {orders_ds} ON
9+
c_custkey = o_custkey
10+
AND o_comment NOT LIKE '%special%requests%'
11+
GROUP BY
12+
c_custkey
13+
) AS c_orders
14+
GROUP BY
15+
c_count
16+
ORDER BY
17+
custdist DESC,
18+
c_count DESC
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
select
2+
round(100.00 * sum(case
3+
when p_type like 'PROMO%'
4+
then l_extendedprice * (1 - l_discount)
5+
else 0
6+
end) / sum(l_extendedprice * (1 - l_discount)), 2) as promo_revenue
7+
from
8+
{line_item_ds},
9+
{part_ds}
10+
where
11+
l_partkey = p_partkey
12+
and l_shipdate >= date '1995-09-01'
13+
and l_shipdate < date '1995-09-01' + interval '1' month
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
WITH revenue AS (
2+
SELECT
3+
l_suppkey AS supplier_no,
4+
SUM(l_extendedprice * (1 - l_discount)) AS total_revenue
5+
FROM
6+
{line_item_ds}
7+
WHERE
8+
l_shipdate >= DATE '1996-01-01'
9+
AND l_shipdate < DATE '1996-01-01' + INTERVAL '3' month
10+
GROUP BY
11+
l_suppkey
12+
)
13+
SELECT
14+
s.s_suppkey,
15+
s.s_name,
16+
s.s_address,
17+
s.s_phone,
18+
r.total_revenue
19+
FROM
20+
{supplier_ds} s
21+
JOIN
22+
revenue r ON s.s_suppkey = r.supplier_no
23+
WHERE
24+
r.total_revenue = (SELECT MAX(total_revenue) FROM revenue)
25+
ORDER BY
26+
s.s_suppkey;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
select
2+
p_brand,
3+
p_type,
4+
p_size,
5+
count(distinct ps_suppkey) as supplier_cnt
6+
from
7+
{part_supp_ds},
8+
{part_ds}
9+
where
10+
p_partkey = ps_partkey
11+
and p_brand <> 'Brand#45'
12+
and p_type not like 'MEDIUM POLISHED%'
13+
and p_size in (49, 14, 23, 45, 19, 3, 36, 9)
14+
and ps_suppkey not in (
15+
select
16+
s_suppkey
17+
from
18+
{supplier_ds}
19+
where
20+
s_comment like '%Customer%Complaints%'
21+
)
22+
group by
23+
p_brand,
24+
p_type,
25+
p_size
26+
order by
27+
supplier_cnt desc,
28+
p_brand,
29+
p_type,
30+
p_size

0 commit comments

Comments
 (0)