From 980064d0dd01c70d2bc1bd933ef1e270afdafa90 Mon Sep 17 00:00:00 2001 From: Yahor Yuzefovich Date: Tue, 26 May 2020 08:58:04 -0700 Subject: [PATCH] roachtest: fix typo in tpchvec/perf 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 --- pkg/cmd/roachtest/tpchvec.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkg/cmd/roachtest/tpchvec.go b/pkg/cmd/roachtest/tpchvec.go index 637b49d0d085..2ad97fbc7eb1 100644 --- a/pkg/cmd/roachtest/tpchvec.go +++ b/pkg/cmd/roachtest/tpchvec.go @@ -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))