diff options
| -rw-r--r-- | ydb/library/benchmarks/queries/tpch/yql/q17.sql | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/ydb/library/benchmarks/queries/tpch/yql/q17.sql b/ydb/library/benchmarks/queries/tpch/yql/q17.sql index b3367583c96..1777b36805a 100644 --- a/ydb/library/benchmarks/queries/tpch/yql/q17.sql +++ b/ydb/library/benchmarks/queries/tpch/yql/q17.sql @@ -4,30 +4,41 @@ -- TPC TPC-H Parameter Substitution (Version 2.17.2 build 0) -- using 1680793381 as a seed to the RNG +$p = select p_partkey from {{part}} +where + p_brand = 'Brand#35' + and p_container = 'LG DRUM' +; + $threshold = ( select 0.2 * avg(l_quantity) as threshold, l.l_partkey as l_partkey from {{lineitem}} as l -join - {{part}} as p -on +left semi join + $p as p +on p.p_partkey = l.l_partkey -where - p.p_brand = 'Brand#35' - and p.p_container = 'LG DRUM' group by l.l_partkey ); +$l = select l.l_partkey as l_partkey, l.l_quantity as l_quantity, l.l_extendedprice as l_extendedprice +from + {{lineitem}} as l +join + $p as p +on + p.p_partkey = l.l_partkey; + select sum(l.l_extendedprice) / 7.0 as avg_yearly from - {{lineitem}} as l + $l as l join $threshold as t -on +on t.l_partkey = l.l_partkey where l.l_quantity < t.threshold; |
