Skip to content

Commit fa0ca3f

Browse files
committed
Fix q17
1 parent 306a5ee commit fa0ca3f

File tree

1 file changed

+19
-8
lines changed
  • ydb/library/benchmarks/queries/tpch/yql

1 file changed

+19
-8
lines changed

ydb/library/benchmarks/queries/tpch/yql/q17.sql

+19-8
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,41 @@
44
-- TPC TPC-H Parameter Substitution (Version 2.17.2 build 0)
55
-- using 1680793381 as a seed to the RNG
66

7+
$p = select p_partkey from {{part}}
8+
where
9+
p_brand = 'Brand#35'
10+
and p_container = 'LG DRUM'
11+
;
12+
713
$threshold = (
814
select
915
0.2 * avg(l_quantity) as threshold,
1016
l.l_partkey as l_partkey
1117
from
1218
{{lineitem}} as l
13-
join
14-
{{part}} as p
15-
on
19+
left semi join
20+
$p as p
21+
on
1622
p.p_partkey = l.l_partkey
17-
where
18-
p.p_brand = 'Brand#35'
19-
and p.p_container = 'LG DRUM'
2023
group by
2124
l.l_partkey
2225
);
2326

27+
$l = select l.l_partkey as l_partkey, l.l_quantity as l_quantity, l.l_extendedprice as l_extendedprice
28+
from
29+
{{lineitem}} as l
30+
join
31+
$p as p
32+
on
33+
p.p_partkey = l.l_partkey;
34+
2435
select
2536
sum(l.l_extendedprice) / 7.0 as avg_yearly
2637
from
27-
{{lineitem}} as l
38+
$l as l
2839
join
2940
$threshold as t
30-
on
41+
on
3142
t.l_partkey = l.l_partkey
3243
where
3344
l.l_quantity < t.threshold;

0 commit comments

Comments
 (0)