aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraozeritsky <aozeritsky@ydb.tech>2023-10-14 21:47:29 +0300
committeraozeritsky <aozeritsky@ydb.tech>2023-10-14 22:08:44 +0300
commitfa0ca3f02bcd8161037a91846d52b325205a7bd7 (patch)
tree8617b9ec7023caced45320fbd815b2c1e0122afb
parent306a5ee7310d56c5b809e91bad189e67836f5875 (diff)
downloadydb-fa0ca3f02bcd8161037a91846d52b325205a7bd7.tar.gz
Fix q17CLI_2.7.0
-rw-r--r--ydb/library/benchmarks/queries/tpch/yql/q17.sql27
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 b3367583c9..1777b36805 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;