Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workload, logictest: fix miscellaneous TODOs related to TPCH #46034

Merged
merged 1 commit into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tpchbench.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func registerTPCHBench(r *testRegistry) {
ScaleFactor: 1,
benchType: tpch,
numRunsPerQuery: 3,
minVersion: `v19.1.0`,
minVersion: `v19.2.0`,
maxLatency: 500 * time.Second,
},
}
Expand Down
23 changes: 20 additions & 3 deletions pkg/sql/logictest/testdata/logic_test/tpch_vec
Original file line number Diff line number Diff line change
Expand Up @@ -817,9 +817,26 @@ EXPLAIN (VEC) SELECT 100.00 * sum(CASE WHEN p_type LIKE 'PROMO%' THEN l_extended
└ *colexec.bufferOp

# Query 15
#-- TODO(yuzefovich): figure out how to execute this query consisting of three
#-- statements.
#-- CREATE VIEW revenue0 (supplier_no, total_revenue) AS SELECT l_suppkey, sum(l_extendedprice * (1 - l_discount)) FROM lineitem WHERE l_shipdate >= DATE '1996-01-01' AND l_shipdate < DATE '1996-01-01' + INTERVAL '3' MONTH GROUP BY l_suppkey; SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT max(total_revenue) FROM revenue0) ORDER BY s_suppkey; DROP VIEW revenue0
statement ok
CREATE VIEW revenue0 (supplier_no, total_revenue) AS SELECT l_suppkey, sum(l_extendedprice * (1 - l_discount)) FROM lineitem WHERE l_shipdate >= DATE '1996-01-01' AND l_shipdate < DATE '1996-01-01' + INTERVAL '3' MONTH GROUP BY l_suppkey

query T
EXPLAIN (VEC) SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT max(total_revenue) FROM revenue0) ORDER BY s_suppkey
----
└ Node 1
└ *colexec.mergeJoinInnerOp
├ *colexec.colBatchScan
└ *colexec.sortOp
└ *colexec.selEQFloat64Float64Op
└ *colexec.castOpNullAny
└ *colexec.constNullOp
└ *colexec.hashAggregator
└ *rowexec.indexJoiner
└ *colexec.colBatchScan

statement ok
DROP VIEW revenue0

# Query 16
query T
Expand Down
19 changes: 1 addition & 18 deletions pkg/workload/querybench/query_bench.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ var queryBenchMeta = workload.Meta{
},
}

// vectorizeSetting19_1Translation is a mapping from the 20.1+ vectorize session
// variable value to the 19.1 syntax.
var vectorizeSetting19_1Translation = map[string]string{
"experimental_always": "always",
// Translate auto as on, this was not an option in 19.1.
"auto": "on",
}

// vectorizeSetting19_2Translation is a mapping from the 20.1+ vectorize session
// variable value to the 19.2 syntax.
var vectorizeSetting19_2Translation = map[string]string{
Expand Down Expand Up @@ -129,19 +121,10 @@ func (g *queryBench) Ops(urls []string, reg *histogram.Registry) (workload.Query

if g.vectorize != "" {
_, err := db.Exec("SET vectorize=" + g.vectorize)
if err != nil && strings.Contains(err.Error(), "unrecognized configuration") {
if err != nil && strings.Contains(err.Error(), "invalid value") {
if _, ok := vectorizeSetting19_2Translation[g.vectorize]; ok {
// Fall back to using the pre-20.1 vectorize options.
_, err = db.Exec("SET vectorize=" + vectorizeSetting19_2Translation[g.vectorize])
} else {
if _, ok := vectorizeSetting19_1Translation[g.vectorize]; !ok {
// Unrecognized setting value.
return workload.QueryLoad{}, err
}
// Fall back to using the pre-19.2 syntax.
// TODO(asubiotto): Remove this once we stop running this test
// against 19.1.
_, err = db.Exec("SET experimental_vectorize=" + vectorizeSetting19_1Translation[g.vectorize])
}
}
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/workload/querybench/tpch-queries
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ SELECT c_count, count(*) AS custdist FROM ( SELECT c_custkey, count(o_orderkey)
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

-- query 15
-- TODO(yuzefovich): figure out how to execute this query consisting of three
-- statements.
-- CREATE VIEW revenue0 (supplier_no, total_revenue) AS SELECT l_suppkey, sum(l_extendedprice * (1 - l_discount)) FROM lineitem WHERE l_shipdate >= DATE '1996-01-01' AND l_shipdate < DATE '1996-01-01' + INTERVAL '3' MONTH GROUP BY l_suppkey; SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT max(total_revenue) FROM revenue0) ORDER BY s_suppkey; DROP VIEW revenue0
CREATE VIEW revenue0 (supplier_no, total_revenue) AS SELECT l_suppkey, sum(l_extendedprice * (1 - l_discount)) FROM lineitem WHERE l_shipdate >= DATE '1996-01-01' AND l_shipdate < DATE '1996-01-01' + INTERVAL '3' MONTH GROUP BY l_suppkey
SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier, revenue0 WHERE s_suppkey = supplier_no AND total_revenue = ( SELECT max(total_revenue) FROM revenue0) ORDER BY s_suppkey
DROP VIEW revenue0

-- query 16
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
Expand Down