diff options
author | Maxim Yurchuk <maxim-yurchuk@ydb.tech> | 2024-11-20 17:37:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 17:37:57 +0000 |
commit | f76323e9b295c15751e51e3443aa47a36bee8023 (patch) | |
tree | 4113c8cad473a33e0f746966e0cf087252fa1d7a /yql/essentials/tests/sql/suites/tpch/q11.sql | |
parent | 753ecb8d410a4cb459c26f3a0082fb2d1724fe63 (diff) | |
parent | a7b9a6afea2a9d7a7bfac4c5eb4c1a8e60adb9e6 (diff) | |
download | ydb-f76323e9b295c15751e51e3443aa47a36bee8023.tar.gz |
Merge pull request #11788 from ydb-platform/mergelibs-241120-1113
Library import 241120-1113
Diffstat (limited to 'yql/essentials/tests/sql/suites/tpch/q11.sql')
-rw-r--r-- | yql/essentials/tests/sql/suites/tpch/q11.sql | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/yql/essentials/tests/sql/suites/tpch/q11.sql b/yql/essentials/tests/sql/suites/tpch/q11.sql new file mode 100644 index 0000000000..2a80fb6128 --- /dev/null +++ b/yql/essentials/tests/sql/suites/tpch/q11.sql @@ -0,0 +1,62 @@ + +-- TPC-H/TPC-R Important Stock Identification Query (Q11) +-- TPC TPC-H Parameter Substitution (Version 2.17.2 build 0) +-- using 1680793381 as a seed to the RNG + +PRAGMA DisableSimpleColumns; + +$join1 = ( +select + ps.ps_partkey as ps_partkey, + ps.ps_supplycost as ps_supplycost, + ps.ps_availqty as ps_availqty, + s.s_nationkey as s_nationkey +from + plato.partsupp as ps +join + plato.supplier as s +on + ps.ps_suppkey = s.s_suppkey +); +$join2 = ( +select + j.ps_partkey as ps_partkey, + j.ps_supplycost as ps_supplycost, + j.ps_availqty as ps_availqty, + j.s_nationkey as s_nationkey +from + $join1 as j +join + plato.nation as n +on + n.n_nationkey = j.s_nationkey +where + n.n_name = 'CANADA' +); +$threshold = ( +select + sum(ps_supplycost * ps_availqty) * 0.0001000000 as threshold +from + $join2 +); +$values = ( +select + ps_partkey, + sum(ps_supplycost * ps_availqty) as value +from + $join2 +group by + ps_partkey +); + +select + v.ps_partkey as ps_partkey, + v.value as value +from + $values as v +cross join + $threshold as t +where + v.value > t.threshold +order by + value desc; |