Skip to content

Commit

Permalink
roachtest: fix typo in tpchvec/perf
Browse files Browse the repository at this point in the history
TPCH queries have semicolon at the end, so when trying to do `SELECT url
FROM [EXPLAIN ANALYZE %s];` with query replacing the `%s`, we would have
a semicolon within square brackets which would produce a syntax error.
Fix this by reading both `automatic` boolean and `url` string and
outputting the latter.

Release note: None
  • Loading branch information
yuzefovich committed May 26, 2020
1 parent e6c15ca commit 980064d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/cmd/roachtest/tpchvec.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,20 @@ func (p *tpchVecPerfTest) postTestRunHook(t *test, conn *gosql.DB, version crdbV
}
for i := 0; i < tpchPerfTestNumRunsPerQuery; i++ {
rows, err := conn.Query(fmt.Sprintf(
"SELECT url FROM [EXPLAIN ANALYZE %s];", tpch.QueriesByNumber[queryNum],
"EXPLAIN ANALYZE %s;", tpch.QueriesByNumber[queryNum],
))
if err != nil {
t.Fatal(err)
}
defer rows.Close()
var url string
var (
automatic bool
url string
)
rows.Next()
if err = rows.Scan(&url); err != nil {
if err = rows.Scan(&automatic, &url); err != nil {
t.Fatal(err)
}
if err = rows.Close(); err != nil {
t.Fatal(err)
}
t.Status(fmt.Sprintf("EXPLAIN ANALYZE with vectorize=%s url:\n%s", vectorizeSetting, url))
Expand Down

0 comments on commit 980064d

Please sign in to comment.