[Regression](planner) Add tpch plan check (#11181)
Add plan check for tpch so that we can sense any changes to the final plan opportunely.
This commit is contained in:
@ -61,5 +61,6 @@ header:
|
||||
- "docs/.vuepress/public/js/jquery.min.js"
|
||||
- "docs/.vuepress/public/js/wow.min.js"
|
||||
- "docs/package-lock.json"
|
||||
- "regression-test/script/README"
|
||||
|
||||
comment: on-failure
|
||||
|
||||
16
regression-test/script/README
Normal file
16
regression-test/script/README
Normal file
@ -0,0 +1,16 @@
|
||||
# Manual
|
||||
|
||||
This script is used to generate any SQL plan checker groovy in batch.
|
||||
|
||||
You need to pass two parameter to this script:
|
||||
|
||||
* The path of the directory which contains the SQL files.
|
||||
* The path of the directory where you expect to save the generated groovy test file,if there doesn't exists such directory, script would try to create it.
|
||||
|
||||
Note that you must pass the parameters as above showed order.
|
||||
|
||||
Below is a example:
|
||||
|
||||
```
|
||||
python3 plan_checker_generator.py {YOUR_DORIS_HOME}/regression-test/suites/tpch_sf1/sql {YOUR_DORIS_HOME}/regression-test/suites/tpch_sf1/explain
|
||||
```
|
||||
188
regression-test/script/plan_checker_generator.py
Normal file
188
regression-test/script/plan_checker_generator.py
Normal file
@ -0,0 +1,188 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from curses.ascii import isalpha
|
||||
import sys
|
||||
import re
|
||||
import os
|
||||
|
||||
# line format is "sql_name, groovy_name"
|
||||
|
||||
suite = """// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q{}", "tpch_sf1") {{
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${{realDb}}"
|
||||
"""
|
||||
|
||||
params = sys.argv
|
||||
|
||||
sql_dir = params[1]
|
||||
|
||||
output_dir = params[2]
|
||||
|
||||
if not os.path.exists(output_dir):
|
||||
os.mkdir(output_dir)
|
||||
|
||||
sql_files = [f for f in os.listdir(sql_dir) if os.path.isfile(os.path.join(sql_dir, f))]
|
||||
|
||||
sql_numbers = [re.findall(r'\d+', f)[0] for f in sql_files]
|
||||
|
||||
output_files = [os.path.join(output_dir, 'test_'+x[1] + '.groovy') for x in zip(sql_files, sql_numbers)]
|
||||
|
||||
sql_files_path = [os.path.join(sql_dir, p) for p in sql_files]
|
||||
|
||||
tasks = zip(sql_files_path, output_files, sql_numbers)
|
||||
|
||||
patterns = [
|
||||
'order by.*$',
|
||||
'runtime filters.*$',
|
||||
'VTOP-N',
|
||||
'join op.*$',
|
||||
'equal join.*$',
|
||||
'TABLE.*$',
|
||||
'PREDICATES.*$',
|
||||
'output.*$',
|
||||
'other join predicates.*$',
|
||||
'other predicates.*$',
|
||||
'group by.*$',
|
||||
'VAGGREGATE.*$',
|
||||
'STREAMING',
|
||||
'cross join.*$',
|
||||
'predicates.*$',
|
||||
]
|
||||
|
||||
for task in tasks:
|
||||
|
||||
print(task)
|
||||
f1, f2, num = task
|
||||
|
||||
f = open(f1, 'r')
|
||||
oldsql = f.read()
|
||||
f.close()
|
||||
|
||||
f = open(f1, 'w')
|
||||
f.write('explain\n' + oldsql + ';')
|
||||
f.close()
|
||||
|
||||
conn = 'mysql -h 127.0.0.1 -P 9030 -uroot regression_test_tpch_sf1 <'
|
||||
|
||||
print(conn + f1)
|
||||
|
||||
lines = os.popen(conn + f1).readlines()
|
||||
|
||||
f = open(f1, 'w')
|
||||
f.write(oldsql)
|
||||
f.close()
|
||||
|
||||
# print(oldsql)
|
||||
|
||||
sqls = open(f1).readlines()
|
||||
|
||||
print(len(lines))
|
||||
|
||||
res_pattern = []
|
||||
|
||||
res_g = []
|
||||
|
||||
for id, line in enumerate(lines):
|
||||
lines[id] = line.rstrip('\n')
|
||||
|
||||
res = []
|
||||
|
||||
cur = []
|
||||
for id, line in enumerate(lines):
|
||||
# print(g)
|
||||
line = line.replace('$','\$')
|
||||
for p in patterns:
|
||||
if len(re.findall(p, line)) > 0: #and line.find('null') == -1:
|
||||
cur.append((line, id))
|
||||
|
||||
# print(cur)
|
||||
res_g = [[cur[0][0]]]
|
||||
for i in range(1, len(cur)):
|
||||
if cur[i][1] == cur[i - 1][1] + 1:
|
||||
res_g[-1].append(cur[i][0])
|
||||
else:
|
||||
res_g.append([cur[i][0]])
|
||||
|
||||
for g in res_g:
|
||||
s = g[0]
|
||||
while not isalpha(s[0]):
|
||||
s = s[1:]
|
||||
g[0] = s
|
||||
|
||||
explain_pattern = '''
|
||||
explainStr ->
|
||||
explainStr.contains('''
|
||||
|
||||
explain_pattern1 = ''') &&
|
||||
explainStr.contains('''
|
||||
|
||||
chkstr = ''
|
||||
for g in res_g:
|
||||
chkstr = chkstr + '\t\t' + 'explainStr.contains("' + g[0]
|
||||
if len(g) == 1:
|
||||
chkstr = chkstr + '") && \n'
|
||||
continue
|
||||
else:
|
||||
chkstr = chkstr + '\\n" + \n'
|
||||
for s in g[1:-1]:
|
||||
chkstr = chkstr + '\t\t\t\t"' + s + '\\n" + \n'
|
||||
chkstr = chkstr + '\t\t\t\t"' + g[-1] + '") && \n'
|
||||
|
||||
chkstr = chkstr[:-4]
|
||||
pattern = '''
|
||||
explain {
|
||||
sql """
|
||||
'''
|
||||
pattern1 = '''
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
'''
|
||||
|
||||
pattern2 = '''
|
||||
|
||||
}
|
||||
}
|
||||
}'''
|
||||
|
||||
sql = ''
|
||||
for line in sqls[1:]:
|
||||
sql = sql + '\t\t' + line
|
||||
|
||||
# print(suite.format(num) + pattern + sql + pattern1 + chkstr + pattern2)
|
||||
open(f2, 'w').write(suite.format(num) + pattern + sql + pattern1 + chkstr + pattern2)
|
||||
66
regression-test/suites/tpch_sf1/explain/test_q1.groovy
Normal file
66
regression-test/suites/tpch_sf1/explain/test_q1.groovy
Normal file
@ -0,0 +1,66 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q1", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
l_returnflag,
|
||||
l_linestatus,
|
||||
sum(l_quantity) AS sum_qty,
|
||||
sum(l_extendedprice) AS sum_base_price,
|
||||
sum(l_extendedprice * (1 - l_discount)) AS sum_disc_price,
|
||||
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge,
|
||||
avg(l_quantity) AS avg_qty,
|
||||
avg(l_extendedprice) AS avg_price,
|
||||
avg(l_discount) AS avg_disc,
|
||||
count(*) AS count_order
|
||||
FROM
|
||||
lineitem
|
||||
WHERE
|
||||
l_shipdate <= DATE '1998-12-01' - INTERVAL '90' DAY
|
||||
GROUP BY
|
||||
l_returnflag,
|
||||
l_linestatus
|
||||
ORDER BY
|
||||
l_returnflag,
|
||||
l_linestatus
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 17> <slot 7> `l_returnflag` ASC, <slot 18> <slot 8> `l_linestatus` ASC") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 9> sum(`l_quantity`)), sum(<slot 10> sum(`l_extendedprice`)), sum(<slot 11> sum(`l_extendedprice` * (1 - `l_discount`))), sum(<slot 12> sum(`l_extendedprice` * (1 - `l_discount`) * (1 + `l_tax`))), avg(<slot 13> avg(`l_quantity`)), avg(<slot 14> avg(`l_extendedprice`)), avg(<slot 15> avg(`l_discount`)), count(<slot 16> count(*))\n" +
|
||||
" | group by: <slot 7> `l_returnflag`, <slot 8> `l_linestatus`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: sum(`l_quantity`), sum(`l_extendedprice`), sum(`l_extendedprice` * (1 - `l_discount`)), sum(`l_extendedprice` * (1 - `l_discount`) * (1 + `l_tax`)), avg(`l_quantity`), avg(`l_extendedprice`), avg(`l_discount`), count(*)\n" +
|
||||
" | group by: `l_returnflag`, `l_linestatus`") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `l_shipdate` <= '1998-09-02 00:00:00'")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
98
regression-test/suites/tpch_sf1/explain/test_q10.groovy
Normal file
98
regression-test/suites/tpch_sf1/explain/test_q10.groovy
Normal file
@ -0,0 +1,98 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q10", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
c_custkey,
|
||||
c_name,
|
||||
sum(l_extendedprice * (1 - l_discount)) AS revenue,
|
||||
c_acctbal,
|
||||
n_name,
|
||||
c_address,
|
||||
c_phone,
|
||||
c_comment
|
||||
FROM
|
||||
customer,
|
||||
orders,
|
||||
lineitem,
|
||||
nation
|
||||
WHERE
|
||||
c_custkey = o_custkey
|
||||
AND l_orderkey = o_orderkey
|
||||
AND o_orderdate >= DATE '1993-10-01'
|
||||
AND o_orderdate < DATE '1993-10-01' + INTERVAL '3' MONTH
|
||||
AND l_returnflag = 'R'
|
||||
AND c_nationkey = n_nationkey
|
||||
GROUP BY
|
||||
c_custkey,
|
||||
c_name,
|
||||
c_acctbal,
|
||||
c_phone,
|
||||
n_name,
|
||||
c_address,
|
||||
c_comment
|
||||
ORDER BY
|
||||
revenue DESC
|
||||
LIMIT 20
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 24> <slot 23> sum(`l_extendedprice` * (1 - `l_discount`)) DESC") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 23> sum(`l_extendedprice` * (1 - `l_discount`)))\n" +
|
||||
" | group by: <slot 16> `c_custkey`, <slot 17> `c_name`, <slot 18> `c_acctbal`, <slot 19> `c_phone`, <slot 20> `n_name`, <slot 21> `c_address`, <slot 22> `c_comment`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: sum(<slot 53> * (1 - <slot 54>))\n" +
|
||||
" | group by: <slot 60>, <slot 61>, <slot 62>, <slot 64>, <slot 67>, <slot 63>, <slot 65>") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 52> = `n_nationkey`") &&
|
||||
explainStr.contains("vec output tuple id: 8") &&
|
||||
explainStr.contains("output slot ids: 53 54 60 61 62 63 64 65 67 \n" +
|
||||
" | hash output slot ids: 48 49 50 51 5 39 40 46 47 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 36> = `c_custkey`") &&
|
||||
explainStr.contains("vec output tuple id: 7") &&
|
||||
explainStr.contains("output slot ids: 39 40 46 47 48 49 50 51 52 \n" +
|
||||
" | hash output slot ids: 32 0 33 1 4 6 7 8 14 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `l_orderkey` = `o_orderkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `o_orderkey`") &&
|
||||
explainStr.contains("vec output tuple id: 6") &&
|
||||
explainStr.contains("output slot ids: 32 33 36 \n" +
|
||||
" | hash output slot ids: 2 3 9 ") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `l_returnflag` = 'R'\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `l_orderkey`") &&
|
||||
explainStr.contains("TABLE: nation(nation), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: customer(customer), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: orders(orders), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `o_orderdate` >= '1993-10-01 00:00:00', `o_orderdate` < '1994-01-01 00:00:00'")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
110
regression-test/suites/tpch_sf1/explain/test_q11.groovy
Normal file
110
regression-test/suites/tpch_sf1/explain/test_q11.groovy
Normal file
@ -0,0 +1,110 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q11", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
ps_partkey,
|
||||
sum(ps_supplycost * ps_availqty) AS value
|
||||
FROM
|
||||
partsupp,
|
||||
supplier,
|
||||
nation
|
||||
WHERE
|
||||
ps_suppkey = s_suppkey
|
||||
AND s_nationkey = n_nationkey
|
||||
AND n_name = 'GERMANY'
|
||||
GROUP BY
|
||||
ps_partkey
|
||||
HAVING
|
||||
sum(ps_supplycost * ps_availqty) > (
|
||||
SELECT sum(ps_supplycost * ps_availqty) * 0.0001
|
||||
FROM
|
||||
partsupp,
|
||||
supplier,
|
||||
nation
|
||||
WHERE
|
||||
ps_suppkey = s_suppkey
|
||||
AND s_nationkey = n_nationkey
|
||||
AND n_name = 'GERMANY'
|
||||
)
|
||||
ORDER BY
|
||||
value DESC
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 22> `\$a\$1`.`\$c\$2` DESC") &&
|
||||
explainStr.contains("cross join:\n" +
|
||||
" | predicates: <slot 9> sum(`ps_supplycost` * `ps_availqty`) > <slot 20> sum(`ps_supplycost` * `ps_availqty`) * 0.0001") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 9> sum(`ps_supplycost` * `ps_availqty`))\n" +
|
||||
" | group by: <slot 8> `ps_partkey`") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 19> sum(`ps_supplycost` * `ps_availqty`))\n" +
|
||||
" | group by: ") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | output: sum(<slot 43> * <slot 44>)\n" +
|
||||
" | group by: ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 42> = `n_nationkey`") &&
|
||||
explainStr.contains("vec output tuple id: 15") &&
|
||||
explainStr.contains("output slot ids: 43 44 \n" +
|
||||
" | hash output slot ids: 38 39 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `ps_suppkey` = `s_suppkey`\n" +
|
||||
" | runtime filters: RF001[in_or_bloom] <- `s_suppkey`") &&
|
||||
explainStr.contains("vec output tuple id: 14") &&
|
||||
explainStr.contains("output slot ids: 38 39 42 \n" +
|
||||
" | hash output slot ids: 16 12 13 ") &&
|
||||
explainStr.contains("TABLE: partsupp(partsupp), PREAGGREGATION: ON\n" +
|
||||
" runtime filters: RF001[in_or_bloom] -> `ps_suppkey`") &&
|
||||
explainStr.contains("TABLE: nation(nation), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `n_name` = 'GERMANY'") &&
|
||||
explainStr.contains("TABLE: supplier(supplier), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: sum(<slot 31> * <slot 32>)\n" +
|
||||
" | group by: <slot 30>") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 29> = `n_nationkey`") &&
|
||||
explainStr.contains("vec output tuple id: 13") &&
|
||||
explainStr.contains("output slot ids: 30 31 32 \n" +
|
||||
" | hash output slot ids: 24 25 26 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `ps_suppkey` = `s_suppkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `s_suppkey`") &&
|
||||
explainStr.contains("vec output tuple id: 12") &&
|
||||
explainStr.contains("output slot ids: 24 25 26 29 \n" +
|
||||
" | hash output slot ids: 0 1 2 5 ") &&
|
||||
explainStr.contains("TABLE: partsupp(partsupp), PREAGGREGATION: ON\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `ps_suppkey`") &&
|
||||
explainStr.contains("TABLE: nation(nation), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `n_name` = 'GERMANY'") &&
|
||||
explainStr.contains("TABLE: supplier(supplier), PREAGGREGATION: ON")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
81
regression-test/suites/tpch_sf1/explain/test_q12.groovy
Normal file
81
regression-test/suites/tpch_sf1/explain/test_q12.groovy
Normal file
@ -0,0 +1,81 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q12", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
l_shipmode,
|
||||
sum(CASE
|
||||
WHEN o_orderpriority = '1-URGENT'
|
||||
OR o_orderpriority = '2-HIGH'
|
||||
THEN 1
|
||||
ELSE 0
|
||||
END) AS high_line_count,
|
||||
sum(CASE
|
||||
WHEN o_orderpriority <> '1-URGENT'
|
||||
AND o_orderpriority <> '2-HIGH'
|
||||
THEN 1
|
||||
ELSE 0
|
||||
END) AS low_line_count
|
||||
FROM
|
||||
orders,
|
||||
lineitem
|
||||
WHERE
|
||||
o_orderkey = l_orderkey
|
||||
AND l_shipmode IN ('MAIL', 'SHIP')
|
||||
AND l_commitdate < l_receiptdate
|
||||
AND l_shipdate < l_commitdate
|
||||
AND l_receiptdate >= DATE '1994-01-01'
|
||||
AND l_receiptdate < DATE '1994-01-01' + INTERVAL '1' YEAR
|
||||
GROUP BY
|
||||
l_shipmode
|
||||
ORDER BY
|
||||
l_shipmode
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 10> <slot 7> `l_shipmode` ASC") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 8> sum(CASE WHEN ((`o_orderpriority` = '1-URGENT' OR `o_orderpriority` = '2-HIGH') AND (`o_orderpriority` = '1-URGENT' OR `o_orderpriority` = '2-HIGH')) THEN 1 ELSE 0 END)), sum(<slot 9> sum(CASE WHEN `o_orderpriority` != '1-URGENT' AND `o_orderpriority` != '2-HIGH' THEN 1 ELSE 0 END))\n" +
|
||||
" | group by: <slot 7> `l_shipmode`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: sum(CASE WHEN ((<slot 18> = '1-URGENT' OR <slot 18> = '2-HIGH') AND (<slot 18> = '1-URGENT' OR <slot 18> = '2-HIGH')) THEN 1 ELSE 0 END), sum(CASE WHEN <slot 18> != '1-URGENT' AND <slot 18> != '2-HIGH' THEN 1 ELSE 0 END)\n" +
|
||||
" | group by: <slot 13>") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `l_orderkey` = `o_orderkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `o_orderkey`") &&
|
||||
explainStr.contains("vec output tuple id: 4") &&
|
||||
explainStr.contains("output slot ids: 13 18 \n" +
|
||||
" | hash output slot ids: 0 1 ") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `l_shipmode` IN ('MAIL', 'SHIP'), `l_commitdate` < `l_receiptdate`, `l_shipdate` < `l_commitdate`, `l_receiptdate` >= '1994-01-01 00:00:00', `l_receiptdate` < '1995-01-01 00:00:00'\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `l_orderkey`") &&
|
||||
explainStr.contains("TABLE: orders(orders), PREAGGREGATION: ON")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
78
regression-test/suites/tpch_sf1/explain/test_q13.groovy
Normal file
78
regression-test/suites/tpch_sf1/explain/test_q13.groovy
Normal file
@ -0,0 +1,78 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q13", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
c_count,
|
||||
count(*) AS custdist
|
||||
FROM (
|
||||
SELECT
|
||||
c_custkey,
|
||||
count(o_orderkey) AS c_count
|
||||
FROM
|
||||
customer
|
||||
LEFT OUTER JOIN orders ON
|
||||
c_custkey = o_custkey
|
||||
AND o_comment NOT LIKE '%special%requests%'
|
||||
GROUP BY
|
||||
c_custkey
|
||||
) AS c_orders
|
||||
GROUP BY
|
||||
c_count
|
||||
ORDER BY
|
||||
custdist DESC,
|
||||
c_count DESC
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 10> <slot 9> count(*) DESC, <slot 11> <slot 8> `c_count` DESC") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: count(<slot 9> count(*))\n" +
|
||||
" | group by: <slot 8> `c_count`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: count(*)\n" +
|
||||
" | group by: <slot 5> count(`o_orderkey`)") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: count(<slot 5> count(`o_orderkey`))\n" +
|
||||
" | group by: <slot 4> `c_custkey`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: count(<slot 15>)\n" +
|
||||
" | group by: <slot 12>") &&
|
||||
explainStr.contains("join op: LEFT OUTER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `c_custkey` = `o_custkey`") &&
|
||||
explainStr.contains("vec output tuple id: 6") &&
|
||||
explainStr.contains("output slot ids: 12 15 \n" +
|
||||
" | hash output slot ids: 0 3 ") &&
|
||||
explainStr.contains("TABLE: customer(customer), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: orders(orders), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: NOT `o_comment` LIKE '%special%requests%'")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
62
regression-test/suites/tpch_sf1/explain/test_q14.groovy
Normal file
62
regression-test/suites/tpch_sf1/explain/test_q14.groovy
Normal file
@ -0,0 +1,62 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q14", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT 100.00 * sum(CASE
|
||||
WHEN p_type LIKE 'PROMO%'
|
||||
THEN l_extendedprice * (1 - l_discount)
|
||||
ELSE 0
|
||||
END) / sum(l_extendedprice * (1 - l_discount)) AS promo_revenue
|
||||
FROM
|
||||
lineitem,
|
||||
part
|
||||
WHERE
|
||||
l_partkey = p_partkey
|
||||
AND l_shipdate >= DATE '1995-09-01'
|
||||
AND l_shipdate < DATE '1995-09-01' + INTERVAL '1' MONTH
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 6> sum(CASE WHEN `p_type` LIKE 'PROMO%' THEN `l_extendedprice` * (1 - `l_discount`) ELSE 0 END)), sum(<slot 7> sum(`l_extendedprice` * (1 - `l_discount`)))\n" +
|
||||
" | group by: ") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | output: sum(CASE WHEN <slot 14> LIKE 'PROMO%' THEN <slot 10> * (1 - <slot 11>) ELSE 0 END), sum(<slot 10> * (1 - <slot 11>))\n" +
|
||||
" | group by: ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `l_partkey` = `p_partkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `p_partkey`") &&
|
||||
explainStr.contains("vec output tuple id: 4") &&
|
||||
explainStr.contains("output slot ids: 10 11 14 \n" +
|
||||
" | hash output slot ids: 0 1 2 ") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `l_shipdate` >= '1995-09-01 00:00:00', `l_shipdate` < '1995-10-01 00:00:00'\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `l_partkey`") &&
|
||||
explainStr.contains("TABLE: part(part), PREAGGREGATION: ON")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
91
regression-test/suites/tpch_sf1/explain/test_q15.groovy
Normal file
91
regression-test/suites/tpch_sf1/explain/test_q15.groovy
Normal file
@ -0,0 +1,91 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q15", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
s_suppkey,
|
||||
s_name,
|
||||
s_address,
|
||||
s_phone,
|
||||
total_revenue
|
||||
FROM
|
||||
supplier,
|
||||
revenue1
|
||||
WHERE
|
||||
s_suppkey = supplier_no
|
||||
AND total_revenue = (
|
||||
SELECT max(total_revenue)
|
||||
FROM
|
||||
revenue1
|
||||
)
|
||||
ORDER BY
|
||||
s_suppkey;
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 23> `s_suppkey` ASC") &&
|
||||
explainStr.contains("join op: LEFT SEMI JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 33> = <slot 17> max(`total_revenue`)") &&
|
||||
explainStr.contains("vec output tuple id: 12") &&
|
||||
explainStr.contains("output slot ids: 34 35 36 37 39 \n" +
|
||||
" | hash output slot ids: 33 28 29 30 31 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: `s_suppkey` = <slot 4> `l_suppkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- <slot 4> `l_suppkey`") &&
|
||||
explainStr.contains("vec output tuple id: 11") &&
|
||||
explainStr.contains("output slot ids: 28 29 30 31 33 \n" +
|
||||
" | hash output slot ids: 19 20 21 5 22 ") &&
|
||||
explainStr.contains("TABLE: supplier(supplier), PREAGGREGATION: ON\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `s_suppkey`") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: max(<slot 16> max(`total_revenue`))\n" +
|
||||
" | group by: ") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | output: max(<slot 13> sum(`l_extendedprice` * (1 - `l_discount`)))\n" +
|
||||
" | group by: ") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 13> sum(`l_extendedprice` * (1 - `l_discount`)))\n" +
|
||||
" | group by: <slot 12> `l_suppkey`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: sum(`l_extendedprice` * (1 - `l_discount`))\n" +
|
||||
" | group by: `l_suppkey`") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `l_shipdate` >= '1996-01-01 00:00:00', `l_shipdate` < '1996-04-01 00:00:00'") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 5> sum(`l_extendedprice` * (1 - `l_discount`)))\n" +
|
||||
" | group by: <slot 4> `l_suppkey`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: sum(`l_extendedprice` * (1 - `l_discount`))\n" +
|
||||
" | group by: `l_suppkey`") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `l_shipdate` >= '1996-01-01 00:00:00', `l_shipdate` < '1996-04-01 00:00:00'")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
90
regression-test/suites/tpch_sf1/explain/test_q16.groovy
Normal file
90
regression-test/suites/tpch_sf1/explain/test_q16.groovy
Normal file
@ -0,0 +1,90 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q16", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
p_brand,
|
||||
p_type,
|
||||
p_size,
|
||||
count(DISTINCT ps_suppkey) AS supplier_cnt
|
||||
FROM
|
||||
partsupp,
|
||||
part
|
||||
WHERE
|
||||
p_partkey = ps_partkey
|
||||
AND p_brand <> 'Brand#45'
|
||||
AND p_type NOT LIKE 'MEDIUM POLISHED%'
|
||||
AND p_size IN (49, 14, 23, 45, 19, 3, 36, 9)
|
||||
AND ps_suppkey NOT IN (
|
||||
SELECT s_suppkey
|
||||
FROM
|
||||
supplier
|
||||
WHERE
|
||||
s_comment LIKE '%Customer%Complaints%'
|
||||
)
|
||||
GROUP BY
|
||||
p_brand,
|
||||
p_type,
|
||||
p_size
|
||||
ORDER BY
|
||||
supplier_cnt DESC,
|
||||
p_brand,
|
||||
p_type,
|
||||
p_size
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 17> <slot 16> count(<slot 12> `ps_suppkey`) DESC, <slot 18> <slot 13> <slot 9> `p_brand` ASC, <slot 19> <slot 14> <slot 10> `p_type` ASC, <slot 20> <slot 15> <slot 11> `p_size` ASC") &&
|
||||
explainStr.contains("VAGGREGATE (update finalize)\n" +
|
||||
" | output: count(<slot 12> `ps_suppkey`)\n" +
|
||||
" | group by: <slot 9> `p_brand`, <slot 10> `p_type`, <slot 11> `p_size`") &&
|
||||
explainStr.contains("VAGGREGATE (merge serialize)\n" +
|
||||
" | group by: <slot 9> `p_brand`, <slot 10> `p_type`, <slot 11> `p_size`, <slot 12> `ps_suppkey`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | group by: <slot 29>, <slot 30>, <slot 31>, <slot 27>") &&
|
||||
explainStr.contains("join op: LEFT ANTI JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 21> = `s_suppkey`") &&
|
||||
explainStr.contains("vec output tuple id: 8") &&
|
||||
explainStr.contains("output slot ids: 27 29 30 31 \n" +
|
||||
" | hash output slot ids: 21 23 24 25 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `ps_partkey` = `p_partkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `p_partkey`") &&
|
||||
explainStr.contains("vec output tuple id: 7") &&
|
||||
explainStr.contains("output slot ids: 21 23 24 25 \n" +
|
||||
" | hash output slot ids: 3 4 5 6 ") &&
|
||||
explainStr.contains("TABLE: partsupp(partsupp), PREAGGREGATION: ON\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `ps_partkey`") &&
|
||||
explainStr.contains("TABLE: supplier(supplier), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `s_comment` LIKE '%Customer%Complaints%'") &&
|
||||
explainStr.contains("TABLE: part(part), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `p_brand` != 'Brand#45', NOT `p_type` LIKE 'MEDIUM POLISHED%', `p_size` IN (49, 14, 23, 45, 19, 3, 36, 9)")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
80
regression-test/suites/tpch_sf1/explain/test_q17.groovy
Normal file
80
regression-test/suites/tpch_sf1/explain/test_q17.groovy
Normal file
@ -0,0 +1,80 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q17", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT sum(l_extendedprice) / 7.0 AS avg_yearly
|
||||
FROM
|
||||
lineitem,
|
||||
part
|
||||
WHERE
|
||||
p_partkey = l_partkey
|
||||
AND p_brand = 'Brand#23'
|
||||
AND p_container = 'MED BOX'
|
||||
AND l_quantity < (
|
||||
SELECT 0.2 * avg(l_quantity)
|
||||
FROM
|
||||
lineitem
|
||||
WHERE
|
||||
l_partkey = p_partkey
|
||||
)
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 12> sum(`l_extendedprice`))\n" +
|
||||
" | group by: ") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | output: sum(<slot 21>)\n" +
|
||||
" | group by: ") &&
|
||||
explainStr.contains("join op: LEFT SEMI JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 17> = <slot 2> `l_partkey`\n" +
|
||||
" | other join predicates: <slot 32> < 0.2 * <slot 36>") &&
|
||||
explainStr.contains("other join predicates: <slot 32> < 0.2 * <slot 36>") &&
|
||||
explainStr.contains("vec output tuple id: 8") &&
|
||||
explainStr.contains("output slot ids: 21 \n" +
|
||||
" | hash output slot ids: 3 14 15 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `l_partkey` = `p_partkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `p_partkey`") &&
|
||||
explainStr.contains("vec output tuple id: 7") &&
|
||||
explainStr.contains("output slot ids: 14 15 17 \n" +
|
||||
" | hash output slot ids: 6 7 8 ") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `l_partkey`") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: avg(<slot 3> avg(`l_quantity`))\n" +
|
||||
" | group by: <slot 2> `l_partkey`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: avg(`l_quantity`)\n" +
|
||||
" | group by: `l_partkey`") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: part(part), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `p_brand` = 'Brand#23', `p_container` = 'MED BOX'")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
109
regression-test/suites/tpch_sf1/explain/test_q18.groovy
Normal file
109
regression-test/suites/tpch_sf1/explain/test_q18.groovy
Normal file
@ -0,0 +1,109 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q18", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
c_name,
|
||||
c_custkey,
|
||||
o_orderkey,
|
||||
o_orderdate,
|
||||
o_totalprice,
|
||||
sum(l_quantity)
|
||||
FROM
|
||||
customer,
|
||||
orders,
|
||||
lineitem
|
||||
WHERE
|
||||
o_orderkey IN (
|
||||
SELECT l_orderkey
|
||||
FROM
|
||||
lineitem
|
||||
GROUP BY
|
||||
l_orderkey
|
||||
HAVING
|
||||
sum(l_quantity) > 300
|
||||
)
|
||||
AND c_custkey = o_custkey
|
||||
AND o_orderkey = l_orderkey
|
||||
GROUP BY
|
||||
c_name,
|
||||
c_custkey,
|
||||
o_orderkey,
|
||||
o_orderdate,
|
||||
o_totalprice
|
||||
ORDER BY
|
||||
o_totalprice DESC,
|
||||
o_orderdate
|
||||
LIMIT 100
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 24> <slot 22> `o_totalprice` DESC, <slot 25> <slot 21> `o_orderdate` ASC") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 23> sum(`l_quantity`))\n" +
|
||||
" | group by: <slot 18> `c_name`, <slot 19> `c_custkey`, <slot 20> `o_orderkey`, <slot 21> `o_orderdate`, <slot 22> `o_totalprice`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: sum(<slot 53>)\n" +
|
||||
" | group by: <slot 58>, <slot 59>, <slot 54>, <slot 55>, <slot 56>") &&
|
||||
explainStr.contains("join op: LEFT SEMI JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 44> = <slot 8> `l_orderkey`") &&
|
||||
explainStr.contains("vec output tuple id: 14") &&
|
||||
explainStr.contains("output slot ids: 53 54 55 56 58 59 \n" +
|
||||
" | hash output slot ids: 48 50 51 45 46 47 ") &&
|
||||
explainStr.contains("join op: LEFT SEMI JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 38> = <slot 2> `l_orderkey`") &&
|
||||
explainStr.contains("vec output tuple id: 13") &&
|
||||
explainStr.contains("output slot ids: 44 45 46 47 48 50 51 \n" +
|
||||
" | hash output slot ids: 36 37 38 39 40 42 43 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 35> = `c_custkey`") &&
|
||||
explainStr.contains("vec output tuple id: 12") &&
|
||||
explainStr.contains("output slot ids: 36 37 38 39 40 42 43 \n" +
|
||||
" | hash output slot ids: 32 33 34 12 13 30 31 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `l_orderkey` = `o_orderkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `o_orderkey`") &&
|
||||
explainStr.contains("vec output tuple id: 11") &&
|
||||
explainStr.contains("output slot ids: 30 31 32 33 34 35 \n" +
|
||||
" | hash output slot ids: 16 17 5 11 14 15 ") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `l_orderkey`") &&
|
||||
explainStr.contains("VAGGREGATE (update finalize)\n" +
|
||||
" | output: sum(`l_quantity`)\n" +
|
||||
" | group by: `l_orderkey`") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("VAGGREGATE (update finalize)\n" +
|
||||
" | output: sum(`l_quantity`)\n" +
|
||||
" | group by: `l_orderkey`") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: customer(customer), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: orders(orders), PREAGGREGATION: ON")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
87
regression-test/suites/tpch_sf1/explain/test_q19.groovy
Normal file
87
regression-test/suites/tpch_sf1/explain/test_q19.groovy
Normal file
@ -0,0 +1,87 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q19", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT sum(l_extendedprice * (1 - l_discount)) AS revenue
|
||||
FROM
|
||||
lineitem,
|
||||
part
|
||||
WHERE
|
||||
(
|
||||
p_partkey = l_partkey
|
||||
AND p_brand = 'Brand#12'
|
||||
AND p_container IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG')
|
||||
AND l_quantity >= 1 AND l_quantity <= 1 + 10
|
||||
AND p_size BETWEEN 1 AND 5
|
||||
AND l_shipmode IN ('AIR', 'AIR REG')
|
||||
AND l_shipinstruct = 'DELIVER IN PERSON'
|
||||
)
|
||||
OR
|
||||
(
|
||||
p_partkey = l_partkey
|
||||
AND p_brand = 'Brand#23'
|
||||
AND p_container IN ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK')
|
||||
AND l_quantity >= 10 AND l_quantity <= 10 + 10
|
||||
AND p_size BETWEEN 1 AND 10
|
||||
AND l_shipmode IN ('AIR', 'AIR REG')
|
||||
AND l_shipinstruct = 'DELIVER IN PERSON'
|
||||
)
|
||||
OR
|
||||
(
|
||||
p_partkey = l_partkey
|
||||
AND p_brand = 'Brand#34'
|
||||
AND p_container IN ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG')
|
||||
AND l_quantity >= 20 AND l_quantity <= 20 + 10
|
||||
AND p_size BETWEEN 1 AND 15
|
||||
AND l_shipmode IN ('AIR', 'AIR REG')
|
||||
AND l_shipinstruct = 'DELIVER IN PERSON'
|
||||
)
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 10> sum(`l_extendedprice` * (1 - `l_discount`)))\n" +
|
||||
" | group by: ") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | output: sum(<slot 12> * (1 - <slot 13>))\n" +
|
||||
" | group by: ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `l_partkey` = `p_partkey`\n" +
|
||||
" | other predicates: ((<slot 30> = 'Brand#12' AND <slot 31> IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') AND <slot 27> >= 1 AND <slot 27> <= 11 AND <slot 29> <= 5) OR (<slot 30> = 'Brand#23' AND <slot 31> IN ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') AND <slot 27> >= 10 AND <slot 27> <= 20 AND <slot 29> <= 10) OR (<slot 30> = 'Brand#34' AND <slot 31> IN ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') AND <slot 27> >= 20 AND <slot 27> <= 30 AND <slot 29> <= 15))") &&
|
||||
explainStr.contains("other predicates: ((<slot 30> = 'Brand#12' AND <slot 31> IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') AND <slot 27> >= 1 AND <slot 27> <= 11 AND <slot 29> <= 5) OR (<slot 30> = 'Brand#23' AND <slot 31> IN ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') AND <slot 27> >= 10 AND <slot 27> <= 20 AND <slot 29> <= 10) OR (<slot 30> = 'Brand#34' AND <slot 31> IN ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') AND <slot 27> >= 20 AND <slot 27> <= 30 AND <slot 29> <= 15))\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `p_partkey`") &&
|
||||
explainStr.contains("vec output tuple id: 4") &&
|
||||
explainStr.contains("output slot ids: 12 13 \n" +
|
||||
" | hash output slot ids: 0 1 4 7 8 9 ") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `l_shipmode` IN ('AIR', 'AIR REG'), `l_shipinstruct` = 'DELIVER IN PERSON', `l_quantity` >= 1, `l_quantity` <= 30\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `l_partkey`") &&
|
||||
explainStr.contains("TABLE: part(part), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `p_size` >= 1, (`p_brand` = 'Brand#12' OR `p_brand` = 'Brand#23' OR `p_brand` = 'Brand#34'), `p_size` <= 15, `p_container` IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG', 'MED BAG', 'MED BOX', 'MED PKG', 'MED PACK', 'LG CASE', 'LG BOX', 'LG PACK', 'LG PKG')")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
141
regression-test/suites/tpch_sf1/explain/test_q2.groovy
Normal file
141
regression-test/suites/tpch_sf1/explain/test_q2.groovy
Normal file
@ -0,0 +1,141 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q2", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
s_acctbal,
|
||||
s_name,
|
||||
n_name,
|
||||
p_partkey,
|
||||
p_mfgr,
|
||||
s_address,
|
||||
s_phone,
|
||||
s_comment
|
||||
FROM
|
||||
part,
|
||||
supplier,
|
||||
partsupp,
|
||||
nation,
|
||||
region
|
||||
WHERE
|
||||
p_partkey = ps_partkey
|
||||
AND s_suppkey = ps_suppkey
|
||||
AND p_size = 15
|
||||
AND p_type LIKE '%BRASS'
|
||||
AND s_nationkey = n_nationkey
|
||||
AND n_regionkey = r_regionkey
|
||||
AND r_name = 'EUROPE'
|
||||
AND ps_supplycost = (
|
||||
SELECT min(ps_supplycost)
|
||||
FROM
|
||||
partsupp, supplier,
|
||||
nation, region
|
||||
WHERE
|
||||
p_partkey = ps_partkey
|
||||
AND s_suppkey = ps_suppkey
|
||||
AND s_nationkey = n_nationkey
|
||||
AND n_regionkey = r_regionkey
|
||||
AND r_name = 'EUROPE'
|
||||
)
|
||||
ORDER BY
|
||||
s_acctbal DESC,
|
||||
n_name,
|
||||
s_name,
|
||||
p_partkey
|
||||
LIMIT 100
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 32> `s_acctbal` DESC, <slot 33> `n_name` ASC, <slot 34> `s_name` ASC, <slot 35> `p_partkey` ASC") &&
|
||||
explainStr.contains("join op: LEFT SEMI JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 78> = <slot 10> min(`ps_supplycost`)\n" +
|
||||
" | equal join conjunct: <slot 81> = <slot 9> `ps_partkey`") &&
|
||||
explainStr.contains("vec output tuple id: 19") &&
|
||||
explainStr.contains("output slot ids: 121 122 125 126 127 128 129 132 \n" +
|
||||
" | hash output slot ids: 81 82 85 86 87 88 89 92 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 77> = `r_regionkey`") &&
|
||||
explainStr.contains("vec output tuple id: 15") &&
|
||||
explainStr.contains("output slot ids: 78 81 82 85 86 87 88 89 92 \n" +
|
||||
" | hash output slot ids: 64 65 68 69 70 71 72 75 61 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 60> = `n_nationkey`") &&
|
||||
explainStr.contains("vec output tuple id: 14") &&
|
||||
explainStr.contains("output slot ids: 61 64 65 68 69 70 71 72 75 77 \n" +
|
||||
" | hash output slot ids: 17 50 51 54 55 56 57 58 29 47 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 42> = `s_suppkey`") &&
|
||||
explainStr.contains("vec output tuple id: 13") &&
|
||||
explainStr.contains("output slot ids: 47 50 51 54 55 56 57 58 60 \n" +
|
||||
" | hash output slot ids: 16 19 20 21 40 43 27 44 15 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `ps_partkey` = `p_partkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `p_partkey`") &&
|
||||
explainStr.contains("vec output tuple id: 12") &&
|
||||
explainStr.contains("output slot ids: 40 42 43 44 \n" +
|
||||
" | hash output slot ids: 18 24 13 14 ") &&
|
||||
explainStr.contains("TABLE: partsupp(partsupp), PREAGGREGATION: ON\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `ps_partkey`") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: min(<slot 10> min(`ps_supplycost`))\n" +
|
||||
" | group by: <slot 9> `ps_partkey`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: min(<slot 109>)\n" +
|
||||
" | group by: <slot 110>") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 108> = `r_regionkey`") &&
|
||||
explainStr.contains("vec output tuple id: 18") &&
|
||||
explainStr.contains("output slot ids: 109 110 \n" +
|
||||
" | hash output slot ids: 102 103 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 101> = `n_nationkey`") &&
|
||||
explainStr.contains("vec output tuple id: 17") &&
|
||||
explainStr.contains("output slot ids: 102 103 108 \n" +
|
||||
" | hash output slot ids: 97 98 6 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `ps_suppkey` = `s_suppkey`\n" +
|
||||
" | runtime filters: RF001[in_or_bloom] <- `s_suppkey`") &&
|
||||
explainStr.contains("vec output tuple id: 16") &&
|
||||
explainStr.contains("output slot ids: 97 98 101 \n" +
|
||||
" | hash output slot ids: 0 1 4 ") &&
|
||||
explainStr.contains("TABLE: partsupp(partsupp), PREAGGREGATION: ON\n" +
|
||||
" runtime filters: RF001[in_or_bloom] -> `ps_suppkey`") &&
|
||||
explainStr.contains("TABLE: region(region), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `r_name` = 'EUROPE'") &&
|
||||
explainStr.contains("TABLE: nation(nation), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: supplier(supplier), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: region(region), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `r_name` = 'EUROPE'") &&
|
||||
explainStr.contains("TABLE: nation(nation), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: supplier(supplier), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: part(part), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `p_size` = 15, `p_type` LIKE '%BRASS'")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
110
regression-test/suites/tpch_sf1/explain/test_q20.groovy
Normal file
110
regression-test/suites/tpch_sf1/explain/test_q20.groovy
Normal file
@ -0,0 +1,110 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q20", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
s_name,
|
||||
s_address
|
||||
FROM
|
||||
supplier, nation
|
||||
WHERE
|
||||
s_suppkey IN (
|
||||
SELECT ps_suppkey
|
||||
FROM
|
||||
partsupp
|
||||
WHERE
|
||||
ps_partkey IN (
|
||||
SELECT p_partkey
|
||||
FROM
|
||||
part
|
||||
WHERE
|
||||
p_name LIKE 'forest%'
|
||||
)
|
||||
AND ps_availqty > (
|
||||
SELECT 0.5 * sum(l_quantity)
|
||||
FROM
|
||||
lineitem
|
||||
WHERE
|
||||
l_partkey = ps_partkey
|
||||
AND l_suppkey = ps_suppkey
|
||||
AND l_shipdate >= date('1994-01-01')
|
||||
AND l_shipdate < date('1994-01-01') + interval '1' YEAR
|
||||
)
|
||||
)
|
||||
AND s_nationkey = n_nationkey
|
||||
AND n_name = 'CANADA'
|
||||
ORDER BY s_name
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 23> `s_name` ASC") &&
|
||||
explainStr.contains("join op: LEFT SEMI JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 25> = <slot 36>") &&
|
||||
explainStr.contains("vec output tuple id: 13") &&
|
||||
explainStr.contains("output slot ids: 38 39 \n" +
|
||||
" | hash output slot ids: 26 27 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `s_nationkey` = `n_nationkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `n_nationkey`") &&
|
||||
explainStr.contains("vec output tuple id: 10") &&
|
||||
explainStr.contains("output slot ids: 25 26 27 \n" +
|
||||
" | hash output slot ids: 17 18 19 ") &&
|
||||
explainStr.contains("TABLE: supplier(supplier), PREAGGREGATION: ON\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `s_nationkey`") &&
|
||||
explainStr.contains("join op: LEFT SEMI JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 33> = <slot 9> `l_suppkey`\n" +
|
||||
" | equal join conjunct: <slot 31> = <slot 8> `l_partkey`\n" +
|
||||
" | other join predicates: <slot 53> > 0.5 * <slot 57>") &&
|
||||
explainStr.contains("other join predicates: <slot 53> > 0.5 * <slot 57>") &&
|
||||
explainStr.contains("vec output tuple id: 12") &&
|
||||
explainStr.contains("output slot ids: 36 \n" +
|
||||
" | hash output slot ids: 32 33 10 ") &&
|
||||
explainStr.contains("join op: LEFT SEMI JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `ps_partkey` = `p_partkey`\n" +
|
||||
" | runtime filters: RF001[in_or_bloom] <- `p_partkey`") &&
|
||||
explainStr.contains("vec output tuple id: 11") &&
|
||||
explainStr.contains("output slot ids: 31 32 33 \n" +
|
||||
" | hash output slot ids: 3 14 15 ") &&
|
||||
explainStr.contains("TABLE: partsupp(partsupp), PREAGGREGATION: ON\n" +
|
||||
" runtime filters: RF001[in_or_bloom] -> `ps_partkey`") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 10> sum(`l_quantity`))\n" +
|
||||
" | group by: <slot 8> `l_partkey`, <slot 9> `l_suppkey`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: sum(`l_quantity`)\n" +
|
||||
" | group by: `l_partkey`, `l_suppkey`") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `l_shipdate` >= date('1994-01-01 00:00:00'), `l_shipdate` < date('1994-01-01 00:00:00') + INTERVAL 1 YEAR") &&
|
||||
explainStr.contains("TABLE: part(part), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `p_name` LIKE 'forest%'") &&
|
||||
explainStr.contains("TABLE: nation(nation), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `n_name` = 'CANADA'")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
122
regression-test/suites/tpch_sf1/explain/test_q21.groovy
Normal file
122
regression-test/suites/tpch_sf1/explain/test_q21.groovy
Normal file
@ -0,0 +1,122 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q21", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
s_name,
|
||||
count(*) AS numwait
|
||||
FROM
|
||||
supplier,
|
||||
lineitem l1,
|
||||
orders,
|
||||
nation
|
||||
WHERE
|
||||
s_suppkey = l1.l_suppkey
|
||||
AND o_orderkey = l1.l_orderkey
|
||||
AND o_orderstatus = 'F'
|
||||
AND l1.l_receiptdate > l1.l_commitdate
|
||||
AND exists(
|
||||
SELECT *
|
||||
FROM
|
||||
lineitem l2
|
||||
WHERE
|
||||
l2.l_orderkey = l1.l_orderkey
|
||||
AND l2.l_suppkey <> l1.l_suppkey
|
||||
)
|
||||
AND NOT exists(
|
||||
SELECT *
|
||||
FROM
|
||||
lineitem l3
|
||||
WHERE
|
||||
l3.l_orderkey = l1.l_orderkey
|
||||
AND l3.l_suppkey <> l1.l_suppkey
|
||||
AND l3.l_receiptdate > l3.l_commitdate
|
||||
)
|
||||
AND s_nationkey = n_nationkey
|
||||
AND n_name = 'SAUDI ARABIA'
|
||||
GROUP BY
|
||||
s_name
|
||||
ORDER BY
|
||||
numwait DESC,
|
||||
s_name
|
||||
LIMIT 100
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 81> <slot 80> count(*) DESC, <slot 82> <slot 79> `s_name` ASC") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: count(<slot 80> count(*))\n" +
|
||||
" | group by: <slot 79> `s_name`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: count(*)\n" +
|
||||
" | group by: <slot 125>") &&
|
||||
explainStr.contains("join op: LEFT ANTI JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 111> = `l3`.`l_orderkey`\n" +
|
||||
" | other join predicates: <slot 160> != <slot 156>") &&
|
||||
explainStr.contains("other join predicates: <slot 160> != <slot 156>") &&
|
||||
explainStr.contains("vec output tuple id: 14") &&
|
||||
explainStr.contains("output slot ids: 125 \n" +
|
||||
" | hash output slot ids: 114 37 110 ") &&
|
||||
explainStr.contains("join op: LEFT SEMI JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 100> = `l2`.`l_orderkey`\n" +
|
||||
" | other join predicates: <slot 155> != <slot 151>") &&
|
||||
explainStr.contains("other join predicates: <slot 155> != <slot 151>") &&
|
||||
explainStr.contains("vec output tuple id: 13") &&
|
||||
explainStr.contains("output slot ids: 110 111 114 \n" +
|
||||
" | hash output slot ids: 1 99 100 103 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 96> = `n_nationkey`") &&
|
||||
explainStr.contains("vec output tuple id: 12") &&
|
||||
explainStr.contains("output slot ids: 99 100 103 \n" +
|
||||
" | hash output slot ids: 90 91 94 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 84> = `o_orderkey`") &&
|
||||
explainStr.contains("vec output tuple id: 11") &&
|
||||
explainStr.contains("output slot ids: 90 91 94 96 \n" +
|
||||
" | hash output slot ids: 83 84 87 89 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `l1`.`l_suppkey` = `s_suppkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `s_suppkey`") &&
|
||||
explainStr.contains("vec output tuple id: 10") &&
|
||||
explainStr.contains("output slot ids: 83 84 87 89 \n" +
|
||||
" | hash output slot ids: 34 35 70 76 ") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `l1`.`l_receiptdate` > `l1`.`l_commitdate`\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `l1`.`l_suppkey`") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `l3`.`l_receiptdate` > `l3`.`l_commitdate`") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: nation(nation), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `n_name` = 'SAUDI ARABIA'") &&
|
||||
explainStr.contains("TABLE: orders(orders), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `o_orderstatus` = 'F'") &&
|
||||
explainStr.contains("TABLE: supplier(supplier), PREAGGREGATION: ON")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
95
regression-test/suites/tpch_sf1/explain/test_q22.groovy
Normal file
95
regression-test/suites/tpch_sf1/explain/test_q22.groovy
Normal file
@ -0,0 +1,95 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q22", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
cntrycode,
|
||||
count(*) AS numcust,
|
||||
sum(c_acctbal) AS totacctbal
|
||||
FROM (
|
||||
SELECT
|
||||
substr(c_phone, 1, 2) AS cntrycode,
|
||||
c_acctbal
|
||||
FROM
|
||||
customer
|
||||
WHERE
|
||||
substr(c_phone, 1, 2) IN
|
||||
('13', '31', '23', '29', '30', '18', '17')
|
||||
AND c_acctbal > (
|
||||
SELECT avg(c_acctbal)
|
||||
FROM
|
||||
customer
|
||||
WHERE
|
||||
c_acctbal > 0.00
|
||||
AND substr(c_phone, 1, 2) IN
|
||||
('13', '31', '23', '29', '30', '18', '17')
|
||||
)
|
||||
AND NOT exists(
|
||||
SELECT *
|
||||
FROM
|
||||
orders
|
||||
WHERE
|
||||
o_custkey = c_custkey
|
||||
)
|
||||
) AS custsale
|
||||
GROUP BY
|
||||
cntrycode
|
||||
ORDER BY
|
||||
cntrycode
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 32> <slot 29> `cntrycode` ASC") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: count(<slot 30> count(*)), sum(<slot 31> sum(`c_acctbal`))\n" +
|
||||
" | group by: <slot 29> `cntrycode`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: count(*), sum(<slot 37>)\n" +
|
||||
" | group by: substr(<slot 36>, 1, 2)") &&
|
||||
explainStr.contains("join op: LEFT ANTI JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `c_custkey` = `o_custkey`") &&
|
||||
explainStr.contains("vec output tuple id: 10") &&
|
||||
explainStr.contains("output slot ids: 36 37 \n" +
|
||||
" | hash output slot ids: 25 26 ") &&
|
||||
explainStr.contains("cross join:\n" +
|
||||
" | predicates: `c_acctbal` > <slot 3> avg(`c_acctbal`)") &&
|
||||
explainStr.contains("TABLE: customer(customer), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: substr(`c_phone`, 1, 2) IN ('13', '31', '23', '29', '30', '18', '17')") &&
|
||||
explainStr.contains("TABLE: orders(orders), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: avg(<slot 2> avg(`c_acctbal`))\n" +
|
||||
" | group by: ") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | output: avg(`c_acctbal`)\n" +
|
||||
" | group by: ") &&
|
||||
explainStr.contains("TABLE: customer(customer), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `c_acctbal` > 0.00, substr(`c_phone`, 1, 2) IN ('13', '31', '23', '29', '30', '18', '17')")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
84
regression-test/suites/tpch_sf1/explain/test_q3.groovy
Normal file
84
regression-test/suites/tpch_sf1/explain/test_q3.groovy
Normal file
@ -0,0 +1,84 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q3", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
l_orderkey,
|
||||
sum(l_extendedprice * (1 - l_discount)) AS revenue,
|
||||
o_orderdate,
|
||||
o_shippriority
|
||||
FROM
|
||||
customer,
|
||||
orders,
|
||||
lineitem
|
||||
WHERE
|
||||
c_mktsegment = 'BUILDING'
|
||||
AND c_custkey = o_custkey
|
||||
AND l_orderkey = o_orderkey
|
||||
AND o_orderdate < DATE '1995-03-15'
|
||||
AND l_shipdate > DATE '1995-03-15'
|
||||
GROUP BY
|
||||
l_orderkey,
|
||||
o_orderdate,
|
||||
o_shippriority
|
||||
ORDER BY
|
||||
revenue DESC,
|
||||
o_orderdate
|
||||
LIMIT 10
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 14> <slot 13> sum(`l_extendedprice` * (1 - `l_discount`)) DESC, <slot 15> <slot 11> `o_orderdate` ASC") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 13> sum(`l_extendedprice` * (1 - `l_discount`)))\n" +
|
||||
" | group by: <slot 10> `l_orderkey`, <slot 11> `o_orderdate`, <slot 12> `o_shippriority`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: sum(<slot 27> * (1 - <slot 28>))\n" +
|
||||
" | group by: <slot 26>, <slot 30>, <slot 31>") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 24> = `c_custkey`") &&
|
||||
explainStr.contains("vec output tuple id: 6") &&
|
||||
explainStr.contains("output slot ids: 26 27 28 30 31 \n" +
|
||||
" | hash output slot ids: 18 19 20 22 23 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `l_orderkey` = `o_orderkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `o_orderkey`") &&
|
||||
explainStr.contains("vec output tuple id: 5") &&
|
||||
explainStr.contains("output slot ids: 18 19 20 22 23 24 \n" +
|
||||
" | hash output slot ids: 0 1 2 3 4 7 ") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `l_shipdate` > '1995-03-15 00:00:00'\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `l_orderkey`") &&
|
||||
explainStr.contains("TABLE: customer(customer), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `c_mktsegment` = 'BUILDING'") &&
|
||||
explainStr.contains("TABLE: orders(orders), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `o_orderdate` < '1995-03-15 00:00:00'")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
72
regression-test/suites/tpch_sf1/explain/test_q4.groovy
Normal file
72
regression-test/suites/tpch_sf1/explain/test_q4.groovy
Normal file
@ -0,0 +1,72 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q4", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
o_orderpriority,
|
||||
count(*) AS order_count
|
||||
FROM orders
|
||||
WHERE
|
||||
o_orderdate >= DATE '1993-07-01'
|
||||
AND o_orderdate < DATE '1993-07-01' + INTERVAL '3' MONTH
|
||||
AND EXISTS (
|
||||
SELECT *
|
||||
FROM lineitem
|
||||
WHERE
|
||||
l_orderkey = o_orderkey
|
||||
AND l_commitdate < l_receiptdate
|
||||
)
|
||||
GROUP BY
|
||||
o_orderpriority
|
||||
ORDER BY
|
||||
o_orderpriority
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 38> <slot 36> `o_orderpriority` ASC") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: count(<slot 37> count(*))\n" +
|
||||
" | group by: <slot 36> `o_orderpriority`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: count(*)\n" +
|
||||
" | group by: <slot 41>") &&
|
||||
explainStr.contains("join op: LEFT SEMI JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `o_orderkey` = `l_orderkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `l_orderkey`") &&
|
||||
explainStr.contains("vec output tuple id: 5") &&
|
||||
explainStr.contains("output slot ids: 41 \n" +
|
||||
" | hash output slot ids: 34 ") &&
|
||||
explainStr.contains("TABLE: orders(orders), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `o_orderdate` >= '1993-07-01 00:00:00', `o_orderdate` < '1993-10-01 00:00:00'\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `o_orderkey`") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `l_commitdate` < `l_receiptdate`")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
103
regression-test/suites/tpch_sf1/explain/test_q5.groovy
Normal file
103
regression-test/suites/tpch_sf1/explain/test_q5.groovy
Normal file
@ -0,0 +1,103 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q5", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
n_name,
|
||||
sum(l_extendedprice * (1 - l_discount)) AS revenue
|
||||
FROM
|
||||
customer,
|
||||
orders,
|
||||
lineitem,
|
||||
supplier,
|
||||
nation,
|
||||
region
|
||||
WHERE
|
||||
c_custkey = o_custkey
|
||||
AND l_orderkey = o_orderkey
|
||||
AND l_suppkey = s_suppkey
|
||||
AND c_nationkey = s_nationkey
|
||||
AND s_nationkey = n_nationkey
|
||||
AND n_regionkey = r_regionkey
|
||||
AND r_name = 'ASIA'
|
||||
AND o_orderdate >= DATE '1994-01-01'
|
||||
AND o_orderdate < DATE '1994-01-01' + INTERVAL '1' YEAR
|
||||
GROUP BY
|
||||
n_name
|
||||
ORDER BY
|
||||
revenue DESC
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 18> <slot 17> sum(`l_extendedprice` * (1 - `l_discount`)) DESC") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 17> sum(`l_extendedprice` * (1 - `l_discount`)))\n" +
|
||||
" | group by: <slot 16> `n_name`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: sum(<slot 61> * (1 - <slot 62>))\n" +
|
||||
" | group by: <slot 72>") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 60> = `r_regionkey`") &&
|
||||
explainStr.contains("vec output tuple id: 12") &&
|
||||
explainStr.contains("output slot ids: 61 62 72 \n" +
|
||||
" | hash output slot ids: 48 58 47 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 44> = `n_nationkey`") &&
|
||||
explainStr.contains("vec output tuple id: 11") &&
|
||||
explainStr.contains("output slot ids: 47 48 58 60 \n" +
|
||||
" | hash output slot ids: 0 36 37 12 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 31> = `c_custkey`\n" +
|
||||
" | equal join conjunct: <slot 35> = `c_nationkey`") &&
|
||||
explainStr.contains("vec output tuple id: 10") &&
|
||||
explainStr.contains("output slot ids: 36 37 44 \n" +
|
||||
" | hash output slot ids: 35 27 28 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 23> = `s_suppkey`") &&
|
||||
explainStr.contains("vec output tuple id: 9") &&
|
||||
explainStr.contains("output slot ids: 27 28 31 35 \n" +
|
||||
" | hash output slot ids: 20 21 24 10 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `l_orderkey` = `o_orderkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `o_orderkey`") &&
|
||||
explainStr.contains("vec output tuple id: 8") &&
|
||||
explainStr.contains("output slot ids: 20 21 23 24 \n" +
|
||||
" | hash output slot ids: 1 2 4 7 ") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `l_orderkey`") &&
|
||||
explainStr.contains("TABLE: region(region), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `r_name` = 'ASIA'") &&
|
||||
explainStr.contains("TABLE: nation(nation), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: customer(customer), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: supplier(supplier), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: orders(orders), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `o_orderdate` >= '1994-01-01 00:00:00', `o_orderdate` < '1995-01-01 00:00:00'")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
52
regression-test/suites/tpch_sf1/explain/test_q6.groovy
Normal file
52
regression-test/suites/tpch_sf1/explain/test_q6.groovy
Normal file
@ -0,0 +1,52 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q6", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
|
||||
SELECT sum(l_extendedprice * l_discount) AS revenue
|
||||
FROM
|
||||
lineitem
|
||||
WHERE
|
||||
l_shipdate >= DATE '1994-01-01'
|
||||
AND l_shipdate < DATE '1994-01-01' + INTERVAL '1' YEAR
|
||||
AND l_discount BETWEEN 0.06 - 0.01 AND .06 + 0.01
|
||||
AND l_quantity < 24
|
||||
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 4> sum(`l_extendedprice` * `l_discount`))\n" +
|
||||
" | group by: ") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | output: sum(`l_extendedprice` * `l_discount`)\n" +
|
||||
" | group by: ") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `l_shipdate` >= '1994-01-01 00:00:00', `l_shipdate` < '1995-01-01 00:00:00', `l_discount` >= 0.05, `l_discount` <= 0.07, `l_quantity` < 24")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
119
regression-test/suites/tpch_sf1/explain/test_q7.groovy
Normal file
119
regression-test/suites/tpch_sf1/explain/test_q7.groovy
Normal file
@ -0,0 +1,119 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q7", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
supp_nation,
|
||||
cust_nation,
|
||||
l_year,
|
||||
sum(volume) AS revenue
|
||||
FROM (
|
||||
SELECT
|
||||
n1.n_name AS supp_nation,
|
||||
n2.n_name AS cust_nation,
|
||||
extract(YEAR FROM l_shipdate) AS l_year,
|
||||
l_extendedprice * (1 - l_discount) AS volume
|
||||
FROM
|
||||
supplier,
|
||||
lineitem,
|
||||
orders,
|
||||
customer,
|
||||
nation n1,
|
||||
nation n2
|
||||
WHERE
|
||||
s_suppkey = l_suppkey
|
||||
AND o_orderkey = l_orderkey
|
||||
AND c_custkey = o_custkey
|
||||
AND s_nationkey = n1.n_nationkey
|
||||
AND c_nationkey = n2.n_nationkey
|
||||
AND (
|
||||
(n1.n_name = 'FRANCE' AND n2.n_name = 'GERMANY')
|
||||
OR (n1.n_name = 'GERMANY' AND n2.n_name = 'FRANCE')
|
||||
)
|
||||
AND l_shipdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31'
|
||||
) AS shipping
|
||||
GROUP BY
|
||||
supp_nation,
|
||||
cust_nation,
|
||||
l_year
|
||||
ORDER BY
|
||||
supp_nation,
|
||||
cust_nation,
|
||||
l_year
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 23> <slot 19> `supp_nation` ASC, <slot 24> <slot 20> `cust_nation` ASC, <slot 25> <slot 21> `l_year` ASC") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 22> sum(`volume`))\n" +
|
||||
" | group by: <slot 19> `supp_nation`, <slot 20> `cust_nation`, <slot 21> `l_year`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: sum(<slot 68> * (1 - <slot 69>))\n" +
|
||||
" | group by: <slot 76>, <slot 80>, year(<slot 67>)") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 66> = `n2`.`n_nationkey`\n" +
|
||||
" | other predicates: ((<slot 113> = 'FRANCE' AND <slot 115> = 'GERMANY') OR (<slot 113> = 'GERMANY' AND <slot 115> = 'FRANCE'))") &&
|
||||
explainStr.contains("other predicates: ((<slot 113> = 'FRANCE' AND <slot 115> = 'GERMANY') OR (<slot 113> = 'GERMANY' AND <slot 115> = 'FRANCE'))") &&
|
||||
explainStr.contains("vec output tuple id: 13") &&
|
||||
explainStr.contains("output slot ids: 67 68 69 76 80 \n" +
|
||||
" | hash output slot ids: 1 54 55 56 63 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 51> = `c_custkey`") &&
|
||||
explainStr.contains("vec output tuple id: 12") &&
|
||||
explainStr.contains("output slot ids: 54 55 56 63 66 \n" +
|
||||
" | hash output slot ids: 52 43 44 45 13 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 40> = `n1`.`n_nationkey`") &&
|
||||
explainStr.contains("vec output tuple id: 11") &&
|
||||
explainStr.contains("output slot ids: 43 44 45 51 52 \n" +
|
||||
" | hash output slot ids: 0 34 35 36 42 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 31> = `o_orderkey`") &&
|
||||
explainStr.contains("vec output tuple id: 10") &&
|
||||
explainStr.contains("output slot ids: 34 35 36 40 42 \n" +
|
||||
" | hash output slot ids: 33 10 27 28 29 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `l_suppkey` = `s_suppkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `s_suppkey`") &&
|
||||
explainStr.contains("vec output tuple id: 9") &&
|
||||
explainStr.contains("output slot ids: 27 28 29 31 33 \n" +
|
||||
" | hash output slot ids: 2 3 4 8 11 ") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `l_shipdate` >= '1995-01-01 00:00:00', `l_shipdate` <= '1996-12-31 00:00:00'\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `l_suppkey`") &&
|
||||
explainStr.contains("TABLE: nation(nation), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: (`n2`.`n_name` = 'FRANCE' OR `n2`.`n_name` = 'GERMANY')") &&
|
||||
explainStr.contains("TABLE: customer(customer), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: nation(nation), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: (`n1`.`n_name` = 'FRANCE' OR `n1`.`n_name` = 'GERMANY')") &&
|
||||
explainStr.contains("TABLE: orders(orders), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: supplier(supplier), PREAGGREGATION: ON")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
128
regression-test/suites/tpch_sf1/explain/test_q8.groovy
Normal file
128
regression-test/suites/tpch_sf1/explain/test_q8.groovy
Normal file
@ -0,0 +1,128 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q8", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
o_year,
|
||||
sum(CASE
|
||||
WHEN nation = 'BRAZIL'
|
||||
THEN volume
|
||||
ELSE 0
|
||||
END) / sum(volume) AS mkt_share
|
||||
FROM (
|
||||
SELECT
|
||||
extract(YEAR FROM o_orderdate) AS o_year,
|
||||
l_extendedprice * (1 - l_discount) AS volume,
|
||||
n2.n_name AS nation
|
||||
FROM
|
||||
part,
|
||||
supplier,
|
||||
lineitem,
|
||||
orders,
|
||||
customer,
|
||||
nation n1,
|
||||
nation n2,
|
||||
region
|
||||
WHERE
|
||||
p_partkey = l_partkey
|
||||
AND s_suppkey = l_suppkey
|
||||
AND l_orderkey = o_orderkey
|
||||
AND o_custkey = c_custkey
|
||||
AND c_nationkey = n1.n_nationkey
|
||||
AND n1.n_regionkey = r_regionkey
|
||||
AND r_name = 'AMERICA'
|
||||
AND s_nationkey = n2.n_nationkey
|
||||
AND o_orderdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31'
|
||||
AND p_type = 'ECONOMY ANODIZED STEEL'
|
||||
) AS all_nations
|
||||
GROUP BY
|
||||
o_year
|
||||
ORDER BY
|
||||
o_year
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 26> <slot 23> `o_year` ASC") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 24> sum(CASE WHEN `nation` = 'BRAZIL' THEN `volume` ELSE 0 END)), sum(<slot 25> sum(`volume`))\n" +
|
||||
" | group by: <slot 23> `o_year`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: sum(CASE WHEN <slot 117> = 'BRAZIL' THEN <slot 105> * (1 - <slot 106>) ELSE 0 END), sum(<slot 105> * (1 - <slot 106>))\n" +
|
||||
" | group by: year(<slot 114>)") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 104> = `r_regionkey`") &&
|
||||
explainStr.contains("vec output tuple id: 17") &&
|
||||
explainStr.contains("output slot ids: 105 106 114 117 \n" +
|
||||
" | hash output slot ids: 96 99 87 88 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 86> = `n1`.`n_nationkey`") &&
|
||||
explainStr.contains("vec output tuple id: 16") &&
|
||||
explainStr.contains("output slot ids: 87 88 96 99 104 \n" +
|
||||
" | hash output slot ids: 80 83 71 72 14 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 68> = `c_custkey`") &&
|
||||
explainStr.contains("vec output tuple id: 15") &&
|
||||
explainStr.contains("output slot ids: 71 72 80 83 86 \n" +
|
||||
" | hash output slot ids: 66 69 57 58 12 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 53> = `n2`.`n_nationkey`") &&
|
||||
explainStr.contains("vec output tuple id: 14") &&
|
||||
explainStr.contains("output slot ids: 57 58 66 68 69 \n" +
|
||||
" | hash output slot ids: 3 54 56 45 46 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 40> = `o_orderkey`") &&
|
||||
explainStr.contains("vec output tuple id: 13") &&
|
||||
explainStr.contains("output slot ids: 45 46 53 54 56 \n" +
|
||||
" | hash output slot ids: 0 36 37 10 44 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 32> = `s_suppkey`") &&
|
||||
explainStr.contains("vec output tuple id: 12") &&
|
||||
explainStr.contains("output slot ids: 36 37 40 44 \n" +
|
||||
" | hash output slot ids: 33 17 29 30 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `l_partkey` = `p_partkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `p_partkey`") &&
|
||||
explainStr.contains("vec output tuple id: 11") &&
|
||||
explainStr.contains("output slot ids: 29 30 32 33 \n" +
|
||||
" | hash output slot ids: 1 2 7 8 ") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `l_partkey`") &&
|
||||
explainStr.contains("TABLE: region(region), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `r_name` = 'AMERICA'") &&
|
||||
explainStr.contains("TABLE: nation(nation), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: customer(customer), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: nation(nation), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: orders(orders), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `o_orderdate` >= '1995-01-01 00:00:00', `o_orderdate` <= '1996-12-31 00:00:00'") &&
|
||||
explainStr.contains("TABLE: supplier(supplier), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: part(part), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `p_type` = 'ECONOMY ANODIZED STEEL'")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
109
regression-test/suites/tpch_sf1/explain/test_q9.groovy
Normal file
109
regression-test/suites/tpch_sf1/explain/test_q9.groovy
Normal file
@ -0,0 +1,109 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
suite("test_explain_tpch_sf_1_q9", "tpch_sf1") {
|
||||
String realDb = context.config.getDbNameByFile(context.file)
|
||||
// get parent directory's group
|
||||
realDb = realDb.substring(0, realDb.lastIndexOf("_"))
|
||||
|
||||
sql "use ${realDb}"
|
||||
|
||||
explain {
|
||||
sql """
|
||||
SELECT
|
||||
nation,
|
||||
o_year,
|
||||
sum(amount) AS sum_profit
|
||||
FROM (
|
||||
SELECT
|
||||
n_name AS nation,
|
||||
extract(YEAR FROM o_orderdate) AS o_year,
|
||||
l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount
|
||||
FROM
|
||||
part,
|
||||
supplier,
|
||||
lineitem,
|
||||
partsupp,
|
||||
orders,
|
||||
nation
|
||||
WHERE
|
||||
s_suppkey = l_suppkey
|
||||
AND ps_suppkey = l_suppkey
|
||||
AND ps_partkey = l_partkey
|
||||
AND p_partkey = l_partkey
|
||||
AND o_orderkey = l_orderkey
|
||||
AND s_nationkey = n_nationkey
|
||||
AND p_name LIKE '%green%'
|
||||
) AS profit
|
||||
GROUP BY
|
||||
nation,
|
||||
o_year
|
||||
ORDER BY
|
||||
nation,
|
||||
o_year DESC
|
||||
|
||||
"""
|
||||
check {
|
||||
explainStr ->
|
||||
explainStr.contains("VTOP-N\n" +
|
||||
" | order by: <slot 23> <slot 20> `nation` ASC, <slot 24> <slot 21> `o_year` DESC") &&
|
||||
explainStr.contains("VAGGREGATE (merge finalize)\n" +
|
||||
" | output: sum(<slot 22> sum(`amount`))\n" +
|
||||
" | group by: <slot 20> `nation`, <slot 21> `o_year`") &&
|
||||
explainStr.contains("VAGGREGATE (update serialize)\n" +
|
||||
" | STREAMING\n" +
|
||||
" | output: sum(<slot 73> * (1 - <slot 74>) - <slot 81> * <slot 75>)\n" +
|
||||
" | group by: <slot 88>, year(<slot 86>)") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 65> = `n_nationkey`") &&
|
||||
explainStr.contains("vec output tuple id: 13") &&
|
||||
explainStr.contains("output slot ids: 73 74 75 81 86 88 \n" +
|
||||
" | hash output slot ids: 0 66 71 58 59 60 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 50> = `o_orderkey`") &&
|
||||
explainStr.contains("vec output tuple id: 12") &&
|
||||
explainStr.contains("output slot ids: 58 59 60 65 66 71 \n" +
|
||||
" | hash output slot ids: 1 52 53 45 46 47 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 38> = `p_partkey`") &&
|
||||
explainStr.contains("vec output tuple id: 11") &&
|
||||
explainStr.contains("output slot ids: 45 46 47 50 52 53 \n" +
|
||||
" | hash output slot ids: 34 35 36 39 41 42 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[The src data has been redistributed]\n" +
|
||||
" | equal join conjunct: <slot 29> = `ps_suppkey`\n" +
|
||||
" | equal join conjunct: <slot 30> = `ps_partkey`") &&
|
||||
explainStr.contains("vec output tuple id: 10") &&
|
||||
explainStr.contains("output slot ids: 34 35 36 38 39 41 42 \n" +
|
||||
" | hash output slot ids: 33 4 26 27 28 30 31 ") &&
|
||||
explainStr.contains("join op: INNER JOIN(BROADCAST)[Tables are not in the same group]\n" +
|
||||
" | equal join conjunct: `l_suppkey` = `s_suppkey`\n" +
|
||||
" | runtime filters: RF000[in_or_bloom] <- `s_suppkey`") &&
|
||||
explainStr.contains("vec output tuple id: 9") &&
|
||||
explainStr.contains("output slot ids: 26 27 28 29 30 31 33 \n" +
|
||||
" | hash output slot ids: 2 3 5 7 10 13 14 ") &&
|
||||
explainStr.contains("TABLE: lineitem(lineitem), PREAGGREGATION: ON\n" +
|
||||
" runtime filters: RF000[in_or_bloom] -> `l_suppkey`") &&
|
||||
explainStr.contains("TABLE: nation(nation), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: orders(orders), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: part(part), PREAGGREGATION: ON\n" +
|
||||
" PREDICATES: `p_name` LIKE '%green%'") &&
|
||||
explainStr.contains("TABLE: partsupp(partsupp), PREAGGREGATION: ON") &&
|
||||
explainStr.contains("TABLE: supplier(supplier), PREAGGREGATION: ON")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -77,4 +77,7 @@ suite("load") {
|
||||
def table = "revenue1"
|
||||
sql new File("""${context.file.parent}/ddl/${table}_delete.sql""").text
|
||||
sql new File("""${context.file.parent}/ddl/${table}.sql""").text
|
||||
// We need wait to make sure BE could pass the stats info to FE so that
|
||||
// avoid unnessary inconsistent generated plan which would cause the regression test fail
|
||||
sleep(60000)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user