From 5025c7054f81d28e0420b20ed0d266454a30ea57 Mon Sep 17 00:00:00 2001 From: Yahor Yuzefovich Date: Wed, 18 Mar 2020 16:09:57 -0700 Subject: [PATCH] logictest: audit logic tests to enable default configs Release justification: non-production code changes. This commit extends the number of configurations on some of the logic tests (mostly by removing explicit configs so that all default ones are used). It also uncomments few things, renames a few files, and moves the contents of `exec_window` into `window`. It also adds a new `5node-dist-vec-disk` config that about 10 files or so are now run with. Additionally, it removes `5node-local` config (which was used in two files), removes `dist-` part from all 5 node config names, and adds a special alias `5node-default-configs` which includes all 5 node configs. Release note: None --- .../testdata/logic_test/distsql_partitioning | 2 +- .../testdata/logic_test/drop_index | 2 +- pkg/ccl/logictestccl/testdata/logic_test/zone | 2 +- pkg/sql/logictest/logic.go | 41 ++++-- .../logic_test/{vectorize_expr => and_or} | 2 - .../logictest/testdata/logic_test/apply_join | 2 - .../logic_test/{vectorize_cast => cast} | 2 - .../logictest/testdata/logic_test/conditional | 1 - .../testdata/logic_test/dist_vectorize | 2 +- .../logictest/testdata/logic_test/distsql_agg | 2 +- .../testdata/logic_test/distsql_distinct_on | 2 +- .../testdata/logic_test/distsql_event_log | 2 +- .../logic_test/distsql_interleaved_join | 2 +- .../testdata/logic_test/distsql_join | 2 +- .../testdata/logic_test/distsql_numtables | 2 +- .../testdata/logic_test/distsql_srfs | 2 - .../testdata/logic_test/distsql_stats | 2 +- .../testdata/logic_test/distsql_subquery | 4 +- .../testdata/logic_test/distsql_tighten_spans | 2 +- .../testdata/logic_test/distsql_union | 2 +- .../logictest/testdata/logic_test/exec_window | 116 ----------------- pkg/sql/logictest/testdata/logic_test/explain | 2 +- .../testdata/logic_test/explain_analyze_plans | 2 +- .../logic_test/{exec_hash_join => hash_join} | 5 - .../{exec_hash_join_dist => hash_join_dist} | 2 +- .../logictest/testdata/logic_test/inner-join | 2 - .../logictest/testdata/logic_test/interleaved | 2 - .../logictest/testdata/logic_test/locality | 2 +- .../logictest/testdata/logic_test/lookup_join | 2 - .../{exec_merge_join => merge_join} | 25 +--- .../testdata/logic_test/merge_join_192 | 20 +++ .../testdata/logic_test/merge_join_dist | 56 +++++++++ ...ec_merge_join_dist => merge_join_dist_vec} | 15 +-- .../logictest/testdata/logic_test/ordinality | 2 - .../logictest/testdata/logic_test/overflow | 2 - pkg/sql/logictest/testdata/logic_test/ranges | 2 +- pkg/sql/logictest/testdata/logic_test/select | 2 - .../testdata/logic_test/sequences_distsql | 3 - .../testdata/logic_test/subquery_correlated | 2 - .../testdata/logic_test/system_namespace | 4 - .../logic_test/system_namespace_deprecated | 80 ++++++------ pkg/sql/logictest/testdata/logic_test/update | 15 ++- .../logictest/testdata/logic_test/vectorize | 2 +- .../testdata/logic_test/vectorize_agg | 9 +- .../testdata/logic_test/vectorize_threshold | 2 +- pkg/sql/logictest/testdata/logic_test/window | 119 +++++++++++++++++- pkg/sql/opt/exec/execbuilder/builder_test.go | 2 +- .../opt/exec/execbuilder/testdata/dist_union | 2 +- .../opt/exec/execbuilder/testdata/distsql_agg | 2 +- .../execbuilder/testdata/distsql_distinct_on | 2 +- .../execbuilder/testdata/distsql_indexjoin | 2 +- .../testdata/distsql_interleaved_join | 2 +- .../exec/execbuilder/testdata/distsql_join | 2 +- .../exec/execbuilder/testdata/distsql_misc | 2 +- .../execbuilder/testdata/distsql_numtables | 2 +- .../execbuilder/testdata/distsql_ordinality | 2 +- .../testdata/distsql_tighten_spans | 2 +- .../exec/execbuilder/testdata/distsql_union | 2 +- .../opt/exec/execbuilder/testdata/lookup_join | 2 +- pkg/sql/opt/exec/execbuilder/testdata/prepare | 2 +- pkg/sql/opt/exec/execbuilder/testdata/stats | 2 +- 61 files changed, 313 insertions(+), 292 deletions(-) rename pkg/sql/logictest/testdata/logic_test/{vectorize_expr => and_or} (97%) rename pkg/sql/logictest/testdata/logic_test/{vectorize_cast => cast} (91%) delete mode 100644 pkg/sql/logictest/testdata/logic_test/exec_window rename pkg/sql/logictest/testdata/logic_test/{exec_hash_join => hash_join} (96%) rename pkg/sql/logictest/testdata/logic_test/{exec_hash_join_dist => hash_join_dist} (97%) rename pkg/sql/logictest/testdata/logic_test/{exec_merge_join => merge_join} (50%) create mode 100644 pkg/sql/logictest/testdata/logic_test/merge_join_192 create mode 100644 pkg/sql/logictest/testdata/logic_test/merge_join_dist rename pkg/sql/logictest/testdata/logic_test/{exec_merge_join_dist => merge_join_dist_vec} (86%) diff --git a/pkg/ccl/logictestccl/testdata/logic_test/distsql_partitioning b/pkg/ccl/logictestccl/testdata/logic_test/distsql_partitioning index 112d25131d7d..6a0bc5529e01 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/distsql_partitioning +++ b/pkg/ccl/logictestccl/testdata/logic_test/distsql_partitioning @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node # Tests for the show partitions command. diff --git a/pkg/ccl/logictestccl/testdata/logic_test/drop_index b/pkg/ccl/logictestccl/testdata/logic_test/drop_index index c39156b6e701..a22f58fd578a 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/drop_index +++ b/pkg/ccl/logictestccl/testdata/logic_test/drop_index @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node statement ok CREATE TABLE t ( diff --git a/pkg/ccl/logictestccl/testdata/logic_test/zone b/pkg/ccl/logictestccl/testdata/logic_test/zone index 903ca8fb9726..fbb485970dda 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/zone +++ b/pkg/ccl/logictestccl/testdata/logic_test/zone @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node # Ensure that cost-based-optimizer uses an index with zone constraints that most # closely matches the gateway's locality. Use "retry" option, since it can take diff --git a/pkg/sql/logictest/logic.go b/pkg/sql/logictest/logic.go index 1d87a17d00ea..2b6992d60e28 100644 --- a/pkg/sql/logictest/logic.go +++ b/pkg/sql/logictest/logic.go @@ -512,39 +512,42 @@ var logicTestConfigs = []testClusterConfig{ skipShort: true, }, { - name: "5node-local", + name: "5node", numNodes: 5, - overrideDistSQLMode: "off", + overrideDistSQLMode: "on", overrideAutoStats: "false", }, { - name: "5node-dist", + name: "5node-vec", numNodes: 5, overrideDistSQLMode: "on", overrideAutoStats: "false", + overrideVectorize: "on", }, { - name: "5node-dist-vec", + name: "5node-vec-disk", numNodes: 5, overrideDistSQLMode: "on", - overrideVectorize: "on", overrideAutoStats: "false", + overrideVectorize: "on", + sqlExecUseDisk: true, + skipShort: true, }, { - name: "5node-dist-metadata", + name: "5node-metadata", numNodes: 5, overrideDistSQLMode: "on", + overrideAutoStats: "false", distSQLMetadataTestEnabled: true, skipShort: true, - overrideAutoStats: "false", }, { - name: "5node-dist-disk", + name: "5node-disk", numNodes: 5, overrideDistSQLMode: "on", + overrideAutoStats: "false", sqlExecUseDisk: true, skipShort: true, - overrideAutoStats: "false", }, } @@ -572,7 +575,17 @@ var ( "fakedist-metadata", "fakedist-disk", } - defaultConfig = parseTestConfig(defaultConfigNames) + // fiveNodeDefaultConfigName is a special alias for all 5 node configs. + fiveNodeDefaultConfigName = "5node-default-configs" + fiveNodeDefaultConfigNames = []string{ + "5node", + "5node-vec", + "5node-vec-disk", + "5node-metadata", + "5node-disk", + } + defaultConfig = parseTestConfig(defaultConfigNames) + fiveNodeDefaultConfig = parseTestConfig(fiveNodeDefaultConfigNames) ) // An index in the above slice. @@ -1335,9 +1348,13 @@ func readTestFileConfigs(t *testing.T, path string) []logicTestConfigIdx { for _, configName := range fields[2:] { idx, ok := findLogicTestConfig(configName) if !ok { - t.Fatalf("%s: unknown config name %s", path, configName) + if configName != fiveNodeDefaultConfigName { + t.Fatalf("%s: unknown config name %s", path, configName) + } + configs = append(configs, fiveNodeDefaultConfig...) + } else { + configs = append(configs, idx) } - configs = append(configs, idx) } return configs } diff --git a/pkg/sql/logictest/testdata/logic_test/vectorize_expr b/pkg/sql/logictest/testdata/logic_test/and_or similarity index 97% rename from pkg/sql/logictest/testdata/logic_test/vectorize_expr rename to pkg/sql/logictest/testdata/logic_test/and_or index 3a6a114718f6..3e48b1304a66 100644 --- a/pkg/sql/logictest/testdata/logic_test/vectorize_expr +++ b/pkg/sql/logictest/testdata/logic_test/and_or @@ -1,5 +1,3 @@ -# LogicTest: local local-vec - statement ok DROP TABLE IF EXISTS t; CREATE TABLE t (k INT PRIMARY KEY, a INT, b INT) diff --git a/pkg/sql/logictest/testdata/logic_test/apply_join b/pkg/sql/logictest/testdata/logic_test/apply_join index c5a0085f84ea..dc4c016c36b0 100644 --- a/pkg/sql/logictest/testdata/logic_test/apply_join +++ b/pkg/sql/logictest/testdata/logic_test/apply_join @@ -1,5 +1,3 @@ -# LogicTest: local fakedist - statement ok CREATE TABLE t (k INT PRIMARY KEY, str STRING); CREATE TABLE u (l INT PRIMARY KEY, str2 STRING); diff --git a/pkg/sql/logictest/testdata/logic_test/vectorize_cast b/pkg/sql/logictest/testdata/logic_test/cast similarity index 91% rename from pkg/sql/logictest/testdata/logic_test/vectorize_cast rename to pkg/sql/logictest/testdata/logic_test/cast index efb214ecd096..d0f8cb621f83 100644 --- a/pkg/sql/logictest/testdata/logic_test/vectorize_cast +++ b/pkg/sql/logictest/testdata/logic_test/cast @@ -1,5 +1,3 @@ -# LogicTest: local local-vec - statement ok CREATE TABLE t45837 AS SELECT 1.25::decimal AS d diff --git a/pkg/sql/logictest/testdata/logic_test/conditional b/pkg/sql/logictest/testdata/logic_test/conditional index c76ae816c8ee..138827c427b0 100644 --- a/pkg/sql/logictest/testdata/logic_test/conditional +++ b/pkg/sql/logictest/testdata/logic_test/conditional @@ -1,4 +1,3 @@ -# LogicTest: local local-vec fakedist fakedist-metadata fakedist-vec query II SELECT IF(1 = 2, NULL, 1), IF(2 = 2, NULL, 2) ---- diff --git a/pkg/sql/logictest/testdata/logic_test/dist_vectorize b/pkg/sql/logictest/testdata/logic_test/dist_vectorize index 71d7d01bf192..82ee9fe59fee 100644 --- a/pkg/sql/logictest/testdata/logic_test/dist_vectorize +++ b/pkg/sql/logictest/testdata/logic_test/dist_vectorize @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist-vec +# LogicTest: 5node-vec 5node-vec-disk statement ok CREATE TABLE kv (k INT PRIMARY KEY, v INT) diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_agg b/pkg/sql/logictest/testdata/logic_test/distsql_agg index 8a15ef8a7694..ebe6e2315f9c 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_agg +++ b/pkg/sql/logictest/testdata/logic_test/distsql_agg @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist 5node-dist-metadata 5node-dist-disk +# LogicTest: 5node-default-configs statement ok CREATE TABLE data (a INT, b INT, c FLOAT, d DECIMAL, PRIMARY KEY (a, b, c, d)) diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_distinct_on b/pkg/sql/logictest/testdata/logic_test/distsql_distinct_on index ef0363ea0c1b..01ab3a68d5da 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_distinct_on +++ b/pkg/sql/logictest/testdata/logic_test/distsql_distinct_on @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist 5node-dist-metadata 5node-dist-disk +# LogicTest: 5node-default-configs statement ok CREATE TABLE xyz ( diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_event_log b/pkg/sql/logictest/testdata/logic_test/distsql_event_log index 03bd6016b366..ed94b716ad1c 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_event_log +++ b/pkg/sql/logictest/testdata/logic_test/distsql_event_log @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist 5node-dist-metadata +# LogicTest: 5node 5node-metadata ################### # CREATE STATISTICS diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_interleaved_join b/pkg/sql/logictest/testdata/logic_test/distsql_interleaved_join index c0d9ec6c1480..bf31b5899fcd 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_interleaved_join +++ b/pkg/sql/logictest/testdata/logic_test/distsql_interleaved_join @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist 5node-dist-metadata +# LogicTest: 5node-default-configs # The following tables form the interleaved hierarchy: # name: primary key: # rows: 'a' = id mod X : diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_join b/pkg/sql/logictest/testdata/logic_test/distsql_join index 3a56686ed16c..5177c3bba0e2 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_join +++ b/pkg/sql/logictest/testdata/logic_test/distsql_join @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist 5node-dist-metadata +# LogicTest: 5node-default-configs # Test that the distSQL MergeJoiner follows SQL NULL semantics for ON predicate # equivilance. The use of sorts here force the planning of merge join. diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_numtables b/pkg/sql/logictest/testdata/logic_test/distsql_numtables index 6d3c9ed83021..a77906d8ee83 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_numtables +++ b/pkg/sql/logictest/testdata/logic_test/distsql_numtables @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist 5node-dist-metadata 5node-dist-disk +# LogicTest: 5node-default-configs # First, we set up two data tables: # - NumToSquare maps integers from 1 to 100 to their squares diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_srfs b/pkg/sql/logictest/testdata/logic_test/distsql_srfs index face789b112b..1f7702419aca 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_srfs +++ b/pkg/sql/logictest/testdata/logic_test/distsql_srfs @@ -1,5 +1,3 @@ -# LogicTest: fakedist fakedist-metadata - statement ok CREATE TABLE data (a INT PRIMARY KEY) diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_stats b/pkg/sql/logictest/testdata/logic_test/distsql_stats index fcd3e730608b..856b552778ac 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_stats +++ b/pkg/sql/logictest/testdata/logic_test/distsql_stats @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist 5node-dist-metadata +# LogicTest: 5node 5node-metadata # Disable automatic stats. statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_subquery b/pkg/sql/logictest/testdata/logic_test/distsql_subquery index e52e59998e54..a2c87ed2d261 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_subquery +++ b/pkg/sql/logictest/testdata/logic_test/distsql_subquery @@ -1,6 +1,4 @@ -# LogicTest: 5node-dist - -# TODO(radu): re-add 5node-dist-opt when #32648 is fixed. +# LogicTest: 5node-default-configs # Regression test for #32652: make sure subqueries that have extra columns for # stream merges don't crash when executed. diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_tighten_spans b/pkg/sql/logictest/testdata/logic_test/distsql_tighten_spans index 5974d27f9d18..824b5be8c0f1 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_tighten_spans +++ b/pkg/sql/logictest/testdata/logic_test/distsql_tighten_spans @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist 5node-dist-metadata +# LogicTest: 5node-default-configs # This test verifies that we correctly tighten spans during index selection as # well as after partitioning spans in distsql. diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_union b/pkg/sql/logictest/testdata/logic_test/distsql_union index 724c29310a46..a1150f4ae787 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_union +++ b/pkg/sql/logictest/testdata/logic_test/distsql_union @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist 5node-dist-metadata 5node-dist-disk +# LogicTest: 5node-default-configs statement ok CREATE TABLE xyz ( diff --git a/pkg/sql/logictest/testdata/logic_test/exec_window b/pkg/sql/logictest/testdata/logic_test/exec_window deleted file mode 100644 index 7a0b72286c6f..000000000000 --- a/pkg/sql/logictest/testdata/logic_test/exec_window +++ /dev/null @@ -1,116 +0,0 @@ -statement ok -CREATE TABLE t (a INT, b INT, c INT PRIMARY KEY) - -statement ok -INSERT INTO t VALUES - (0, 1, 0), - (1, 1, 1), - (0, 2, 2), - (1, 2, 3) - -# We sort the output on all queries with row_number window function to get -# deterministic results. -query III -SELECT a, b, row_number() OVER (ORDER BY a, b) FROM t ORDER BY a, b ----- -0 1 1 -0 2 2 -1 1 3 -1 2 4 - -query III -SELECT a, b, row_number() OVER (PARTITION BY a ORDER BY b) FROM t ORDER BY a, b ----- -0 1 1 -0 2 2 -1 1 1 -1 2 2 - -query III -SELECT a, b, row_number() OVER (PARTITION BY a, b) FROM t ORDER BY a, b ----- -0 1 1 -0 2 1 -1 1 1 -1 2 1 - -query III rowsort -SELECT a, b, rank() OVER () FROM t ----- -0 1 1 -0 2 1 -1 1 1 -1 2 1 - -query III rowsort -SELECT a, b, rank() OVER (ORDER BY a) FROM t ----- -0 1 1 -0 2 1 -1 1 3 -1 2 3 - -query IIII rowsort -SELECT a, b, c, rank() OVER (PARTITION BY a ORDER BY c) FROM t ----- -0 1 0 1 -0 2 2 2 -1 1 1 1 -1 2 3 2 - -query III rowsort -SELECT a, b, dense_rank() OVER () FROM t ----- -0 1 1 -0 2 1 -1 1 1 -1 2 1 - -query III rowsort -SELECT a, b, dense_rank() OVER (ORDER BY a) FROM t ----- -0 1 1 -0 2 1 -1 1 2 -1 2 2 - -query IIII rowsort -SELECT a, b, c, dense_rank() OVER (PARTITION BY a ORDER BY c) FROM t ----- -0 1 0 1 -0 2 2 2 -1 1 1 1 -1 2 3 2 - -query IIIIRR rowsort -SELECT a, b, rank() OVER w, dense_rank() OVER w, percent_rank() OVER w, cume_dist() OVER w FROM t WINDOW w AS () ----- -0 1 1 1 0 1 -1 1 1 1 0 1 -0 2 1 1 0 1 -1 2 1 1 0 1 - -query IIIIRR rowsort -SELECT a, b, rank() OVER w, dense_rank() OVER w, percent_rank() OVER w, cume_dist() OVER w FROM t WINDOW w AS (PARTITION BY a) ----- -0 1 1 1 0 1 -0 2 1 1 0 1 -1 1 1 1 0 1 -1 2 1 1 0 1 - - -query IIIIRR rowsort -SELECT a, b, rank() OVER w, dense_rank() OVER w, percent_rank() OVER w, cume_dist() OVER w FROM t WINDOW w AS (ORDER BY a) ----- -0 1 1 1 0 0.5 -0 2 1 1 0 0.5 -1 1 3 2 0.666666666666667 1 -1 2 3 2 0.666666666666667 1 - -query IIIIRR rowsort -SELECT a, b, rank() OVER w, dense_rank() OVER w, percent_rank() OVER w, cume_dist() OVER w FROM t WINDOW w AS (PARTITION BY a ORDER BY b) ----- -0 1 1 1 0 0.5 -0 2 2 2 1 1 -1 1 1 1 0 0.5 -1 2 2 2 1 1 diff --git a/pkg/sql/logictest/testdata/logic_test/explain b/pkg/sql/logictest/testdata/logic_test/explain index 83f33905d0a1..1436526367c3 100644 --- a/pkg/sql/logictest/testdata/logic_test/explain +++ b/pkg/sql/logictest/testdata/logic_test/explain @@ -1,4 +1,4 @@ -# LogicTest: local local-vec-off +# LogicTest: local local-vec-off local-vec statement ok CREATE TABLE t (a INT PRIMARY KEY) diff --git a/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans b/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans index 3e87c2183e5d..5fa533ea67ee 100644 --- a/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans +++ b/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node # These tests are different from explain_analyze because they require manual # data placement. diff --git a/pkg/sql/logictest/testdata/logic_test/exec_hash_join b/pkg/sql/logictest/testdata/logic_test/hash_join similarity index 96% rename from pkg/sql/logictest/testdata/logic_test/exec_hash_join rename to pkg/sql/logictest/testdata/logic_test/hash_join index 577c60ae3a91..736ff50ee9d6 100644 --- a/pkg/sql/logictest/testdata/logic_test/exec_hash_join +++ b/pkg/sql/logictest/testdata/logic_test/hash_join @@ -1,8 +1,3 @@ -# LogicTest: local-vec fakedist-vec-disk - -# Test that the exec HashJoiner follows SQL NULL semantics for ON predicate -# equivalence. - statement ok CREATE TABLE t1 (k INT PRIMARY KEY, v INT) diff --git a/pkg/sql/logictest/testdata/logic_test/exec_hash_join_dist b/pkg/sql/logictest/testdata/logic_test/hash_join_dist similarity index 97% rename from pkg/sql/logictest/testdata/logic_test/exec_hash_join_dist rename to pkg/sql/logictest/testdata/logic_test/hash_join_dist index bd488598107e..5729c5de53c1 100644 --- a/pkg/sql/logictest/testdata/logic_test/exec_hash_join_dist +++ b/pkg/sql/logictest/testdata/logic_test/hash_join_dist @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist-vec +# LogicTest: 5node-default-configs statement ok CREATE TABLE t (k INT, v INT) diff --git a/pkg/sql/logictest/testdata/logic_test/inner-join b/pkg/sql/logictest/testdata/logic_test/inner-join index 018dc545df84..f1f102c361ef 100644 --- a/pkg/sql/logictest/testdata/logic_test/inner-join +++ b/pkg/sql/logictest/testdata/logic_test/inner-join @@ -1,5 +1,3 @@ -# LogicTest: local fakedist - statement ok CREATE TABLE abc (a INT, b INT, c INT, PRIMARY KEY (a, b)); INSERT INTO abc VALUES (1, 1, 2), (2, 1, 1), (2, 2, NULL) diff --git a/pkg/sql/logictest/testdata/logic_test/interleaved b/pkg/sql/logictest/testdata/logic_test/interleaved index 708deed18fd9..235a77841285 100644 --- a/pkg/sql/logictest/testdata/logic_test/interleaved +++ b/pkg/sql/logictest/testdata/logic_test/interleaved @@ -1,5 +1,3 @@ -# LogicTest: local local-vec fakedist fakedist-metadata - # Grandparent table statement ok CREATE TABLE p2 (i INT PRIMARY KEY, s STRING) diff --git a/pkg/sql/logictest/testdata/logic_test/locality b/pkg/sql/logictest/testdata/logic_test/locality index d59e572cf22c..5c438c75b7c0 100644 --- a/pkg/sql/logictest/testdata/logic_test/locality +++ b/pkg/sql/logictest/testdata/logic_test/locality @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node query T SELECT crdb_internal.locality_value('region') diff --git a/pkg/sql/logictest/testdata/logic_test/lookup_join b/pkg/sql/logictest/testdata/logic_test/lookup_join index 0feb16518d13..cc0d5127a10b 100644 --- a/pkg/sql/logictest/testdata/logic_test/lookup_join +++ b/pkg/sql/logictest/testdata/logic_test/lookup_join @@ -1,5 +1,3 @@ -# LogicTest: fakedist local - statement ok CREATE TABLE abc (a INT, b INT, c INT, PRIMARY KEY (a, c)); INSERT INTO abc VALUES (1, 1, 2), (2, 1, 1), (2, NULL, 2) diff --git a/pkg/sql/logictest/testdata/logic_test/exec_merge_join b/pkg/sql/logictest/testdata/logic_test/merge_join similarity index 50% rename from pkg/sql/logictest/testdata/logic_test/exec_merge_join rename to pkg/sql/logictest/testdata/logic_test/merge_join index 3bf71c733695..660af64b60f7 100644 --- a/pkg/sql/logictest/testdata/logic_test/exec_merge_join +++ b/pkg/sql/logictest/testdata/logic_test/merge_join @@ -1,5 +1,3 @@ -# LogicTest: local-vec - # Basic tables, no nulls statement ok @@ -14,7 +12,7 @@ CREATE TABLE t2 (x INT, y INT, INDEX x (x)) statement ok INSERT INTO t2 VALUES (0, 5), (1, 3), (1, 4), (3, 2), (3, 3), (4, 6) -query IIII +query IIII rowsort SELECT k, v, x, y FROM t1 INNER MERGE JOIN t2 ON k = x ---- 0 4 0 5 @@ -46,25 +44,6 @@ SELECT k, x FROM t1 INNER MERGE JOIN t2 ON k = x ---- 0 0 -# Test to make sure that vectorized engine is used when merge joiner is -# streaming when vectorize=auto (when we're doing a local computation). -statement ok -SET vectorize=auto; SET vectorize_row_count_threshold=0 - -statement ok -CREATE TABLE t (k INT PRIMARY KEY) - -statement ok -INSERT INTO t VALUES (1), (2), (3) - -query T -SELECT url FROM [EXPLAIN ANALYZE SELECT t1.k FROM t AS t1, t AS t2 WHERE t1.k = t2.k] ----- -https://cockroachdb.github.io/distsqlplan/decode.html#eJzMkk9r20AQxe_9FMOcErp1tPJtIWDTqtTFsVPL0D9Bh400dZasteruqCQYffciraFxSBvcXnLbnXm_0byn3WH4YVFhns2zt2tovYX3q-UFXGVfLufT2QKmi-n867cMTt7N8nX-aX4KeynL0W3UMkxzYCn2hxQ-f8hWWRScA6ej2wIF1q6ihd5SQHWFEguBjXclheB8X9oNgll1hyoRaOqm5b5cCCydJ1Q7ZMOWUOFaX1taka7InyUosCLWxg5jG2-22t9PGAXmja6Dgjco8FpzeUMBXMtNywokCuS2sQ9KYxQYyFLJ5qfhewXJKOmHB9bWApstKUgCFp3AiOyXC6w3hEp24t8MyBdiIP2jgd97t7XzFXmqDnYuevI5yRMpXJDf0EdnavJn6WEKlr7zyUS-Pj33ZnMTjyhw2fucyP_Lg-6obNm4-vlMxsf81BWFxtWBHmfz5OSkD4SqDcWAg2t9SZfelcNn4nU5cEOhosCxm8bLrB5aw6t7CMsj4PQxnP4VHh_ASVd0r34FAAD___kkXuQ= - -statement ok -RESET vectorize; RESET vectorize_row_count_threshold - # Regression test for the inputs that have comparable but different types (see # issue #44798). statement ok @@ -74,7 +53,7 @@ statement ok INSERT INTO t44798_0(c0) VALUES(0), (1), (2); INSERT INTO t44798_1(c0) VALUES(0), (2), (4) # Note that integers of different width are still considered equal. -query I +query I rowsort SELECT * FROM t44798_0 NATURAL JOIN t44798_1 ---- 0 diff --git a/pkg/sql/logictest/testdata/logic_test/merge_join_192 b/pkg/sql/logictest/testdata/logic_test/merge_join_192 new file mode 100644 index 000000000000..37ccce0f7d10 --- /dev/null +++ b/pkg/sql/logictest/testdata/logic_test/merge_join_192 @@ -0,0 +1,20 @@ +# LogicTest: local-vec + +# Test to make sure that vectorized engine is used when merge joiner is +# streaming when vectorize=192auto. +statement ok +SET vectorize='192auto'; SET vectorize_row_count_threshold=0 + +statement ok +CREATE TABLE t (k INT PRIMARY KEY) + +statement ok +INSERT INTO t VALUES (1), (2), (3) + +query T +SELECT url FROM [EXPLAIN ANALYZE SELECT t1.k FROM t AS t1, t AS t2 WHERE t1.k = t2.k] +---- +https://cockroachdb.github.io/distsqlplan/decode.html#eJzMkk9r20AQxe_9FMOcErp1tPJtIWDTqtTFsVPL0D9Bh400dZasteruqCQYffciraFxSBvcXnLbnXm_0byn3WH4YVFhns2zt2tovYX3q-UFXGVfLufT2QKmi-n867cMTt7N8nX-aX4KeynL0W3UMkxzYCn2hxQ-f8hWWRScA6ej2wIF1q6ihd5SQHWFEguBjXclheB8X9oNgll1hyoRaOqm5b5cCCydJ1Q7ZMOWUOFaX1taka7InyUosCLWxg5jG2-22t9PGAXmja6Dgjco8FpzeUMBXMtNywokCuS2sQ9KYxQYyFLJ5qfhewXJKOmHB9bWApstKUgCFp3AiOyXC6w3hEp24t8MyBdiIP2jgd97t7XzFXmqDnYuevI5yRMpXJDf0EdnavJn6WEKlr7zyUS-Pj33ZnMTjyhw2fucyP_Lg-6obNm4-vlMxsf81BWFxtWBHmfz5OSkD4SqDcWAg2t9SZfelcNn4nU5cEOhosCxm8bLrB5aw6t7CMsj4PQxnP4VHh_ASVd0r34FAAD___kkXuQ= + +statement ok +RESET vectorize; RESET vectorize_row_count_threshold diff --git a/pkg/sql/logictest/testdata/logic_test/merge_join_dist b/pkg/sql/logictest/testdata/logic_test/merge_join_dist new file mode 100644 index 000000000000..72cd1429bbc8 --- /dev/null +++ b/pkg/sql/logictest/testdata/logic_test/merge_join_dist @@ -0,0 +1,56 @@ +# LogicTest: 5node-default-configs + +# Regression test for #39317. + +statement ok +CREATE TABLE l (a INT PRIMARY KEY, b INT, FAMILY (a, b)) + +statement ok +CREATE TABLE r (a INT PRIMARY KEY, b INT, FAMILY (a, b)) + +statement ok +INSERT INTO l VALUES (1, 10), (2, 20), (3, 30) + +statement ok +INSERT INTO r VALUES (2, 200), (3, 300), (4, 400) + +statement ok +ALTER TABLE l SPLIT AT VALUES (2), (3) + +statement ok +ALTER TABLE r SPLIT AT VALUES (2), (3) + +statement ok +ALTER TABLE l EXPERIMENTAL_RELOCATE VALUES (ARRAY[1], 1), (ARRAY[2], 2), (ARRAY[3], 3) + +statement ok +ALTER TABLE r EXPERIMENTAL_RELOCATE VALUES (ARRAY[1], 2), (ARRAY[2], 3), (ARRAY[3], 1) + +query TTTI colnames +SELECT start_key, end_key, replicas, lease_holder from [SHOW EXPERIMENTAL_RANGES FROM TABLE l] ORDER BY lease_holder +---- +start_key end_key replicas lease_holder +NULL /2 {1} 1 +/2 /3 {2} 2 +/3 NULL {3} 3 + +query TTTI colnames +SELECT start_key, end_key, replicas, lease_holder from [SHOW EXPERIMENTAL_RANGES FROM TABLE r] ORDER BY lease_holder +---- +start_key end_key replicas lease_holder +/2 /3 {1} 1 +/3 NULL {2} 2 +NULL /2 {3} 3 + +query III +SELECT * FROM l LEFT OUTER JOIN r USING(a) WHERE a = 2 +---- +2 20 200 + +# Test that LEFT SEMI merge join outputs batches only with the columns from the +# left side. +query II rowsort +SELECT * FROM l WHERE EXISTS(SELECT * FROM r WHERE r.a=l.a) +---- +2 20 +3 30 diff --git a/pkg/sql/logictest/testdata/logic_test/exec_merge_join_dist b/pkg/sql/logictest/testdata/logic_test/merge_join_dist_vec similarity index 86% rename from pkg/sql/logictest/testdata/logic_test/exec_merge_join_dist rename to pkg/sql/logictest/testdata/logic_test/merge_join_dist_vec index 5b2560d94547..c4dccf075991 100644 --- a/pkg/sql/logictest/testdata/logic_test/exec_merge_join_dist +++ b/pkg/sql/logictest/testdata/logic_test/merge_join_dist_vec @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist-vec +# LogicTest: 5node-vec # Regression test for #39317. @@ -46,16 +46,3 @@ query T SELECT url FROM [EXPLAIN (DISTSQL) SELECT * FROM l LEFT OUTER JOIN r USING(a) WHERE a = 2] ---- https://cockroachdb.github.io/distsqlplan/decode.html#eJzEk9GPk0AQxt_9KzbjS6t7gaX4ssklGOWUSw9O4KLJhYe9MrYkHIu7S2LT9H83wCUV5Gobjb6xu_P7Zub7wg70txI4JP7Sf5eSRpXkKo5uyL3_5Xb5NgjJ7H2QpMmn5Zw8lbzqC0qy9K9Sch0FIVHkLgnCD2Qm5uTzRz_2iSCXxMmAQiVzDMUjauD3wICCAxmFWskVai1Ve73rioL8O3CbQlHVjWmvMworqRD4DkxhSgQOqXgoMUaRo7JarRyNKMpOulbFo1BbTwGFpBaV5sRyLizHegnZnoJszJPsQe1hSzZCb4Y6HoNsn1HQRqwRuLOnz4x30GkqqXJUmA-Uspb8XcnEjjeo1ngtiwqVtRjOlm5r5L3t0V3qx535QKHEr2bmsdfzS1WsN_0nUIgaw4nHqOdQzx25cNhw8QcbTowfygtZW-7YisnW7qA1Oz17ezr78u9mz54d719k7_zX7CeGi1HXstJ4UrR2ux7ma-zt0rJRK7xVctW16Y9Rx3XO5qhN_-r2h6Dqnrrf73SYHYfZGLZ_hp0BzMawcxR-M4DtMbw4Y-dfOh-H2XHYPWvnbP_iRwAAAP__W2L0nA== - -query III -SELECT * FROM l LEFT OUTER JOIN r USING(a) WHERE a = 2 ----- -2 20 200 - -# Test that LEFT SEMI merge join outputs batches only with the columns from the -# left side. -query II rowsort -SELECT * FROM l WHERE EXISTS(SELECT * FROM r WHERE r.a=l.a) ----- -2 20 -3 30 diff --git a/pkg/sql/logictest/testdata/logic_test/ordinality b/pkg/sql/logictest/testdata/logic_test/ordinality index 50fa906a0669..c054747cd7b2 100644 --- a/pkg/sql/logictest/testdata/logic_test/ordinality +++ b/pkg/sql/logictest/testdata/logic_test/ordinality @@ -1,5 +1,3 @@ -# LogicTest: local fakedist fakedist-metadata fakedist-disk fakedist-vec - query TI colnames SELECT * FROM (VALUES ('a'), ('b')) WITH ORDINALITY AS x(name, i) ---- diff --git a/pkg/sql/logictest/testdata/logic_test/overflow b/pkg/sql/logictest/testdata/logic_test/overflow index fc6bdde55116..d7eb7f9b331e 100644 --- a/pkg/sql/logictest/testdata/logic_test/overflow +++ b/pkg/sql/logictest/testdata/logic_test/overflow @@ -1,5 +1,3 @@ -# LogicTest: local local-vec fakedist fakedist-metadata fakedist-vec - # Test for overflow handling in sum aggregate. statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/ranges b/pkg/sql/logictest/testdata/logic_test/ranges index c6c1eda85ef4..b2136166cf48 100644 --- a/pkg/sql/logictest/testdata/logic_test/ranges +++ b/pkg/sql/logictest/testdata/logic_test/ranges @@ -1,4 +1,4 @@ -# LogicTest: 5node-local 5node-dist +# LogicTest: 5node statement ok CREATE TABLE t (k1 INT, k2 INT, v INT, w INT, PRIMARY KEY (k1, k2)) diff --git a/pkg/sql/logictest/testdata/logic_test/select b/pkg/sql/logictest/testdata/logic_test/select index 49e14a42f3ff..6b0607f4b3e6 100644 --- a/pkg/sql/logictest/testdata/logic_test/select +++ b/pkg/sql/logictest/testdata/logic_test/select @@ -1,5 +1,3 @@ -# LogicTest: local local-vec fakedist fakedist-metadata - # SELECT with no table. query I diff --git a/pkg/sql/logictest/testdata/logic_test/sequences_distsql b/pkg/sql/logictest/testdata/logic_test/sequences_distsql index b53cff55472d..49f6f60d45e2 100644 --- a/pkg/sql/logictest/testdata/logic_test/sequences_distsql +++ b/pkg/sql/logictest/testdata/logic_test/sequences_distsql @@ -1,6 +1,3 @@ -# LogicTest: fakedist fakedist-metadata - - # Test that sequence functions work in DistSQL queries. statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/subquery_correlated b/pkg/sql/logictest/testdata/logic_test/subquery_correlated index 17f77044d8df..6b07ff38d5d0 100644 --- a/pkg/sql/logictest/testdata/logic_test/subquery_correlated +++ b/pkg/sql/logictest/testdata/logic_test/subquery_correlated @@ -1,5 +1,3 @@ -# LogicTest: local fakedist - # ------------------------------------------------------------------------------ # Create a simple schema that models customers and orders. Each customer has an # id (c_id), and has zero or more orders that are related via a foreign key of diff --git a/pkg/sql/logictest/testdata/logic_test/system_namespace b/pkg/sql/logictest/testdata/logic_test/system_namespace index 3161aacc1edc..ae2c41641f8a 100644 --- a/pkg/sql/logictest/testdata/logic_test/system_namespace +++ b/pkg/sql/logictest/testdata/logic_test/system_namespace @@ -1,7 +1,3 @@ -# LogicTest: local local-vec-off fakedist fakedist-vec-off fakedist-disk fakedist-metadata -# The local-mixed-19.1-19.2 configuration is excluded for this file because system.namespace -# changed in 20.1 - query IITI rowsort SELECT * FROM system.namespace ---- diff --git a/pkg/sql/logictest/testdata/logic_test/system_namespace_deprecated b/pkg/sql/logictest/testdata/logic_test/system_namespace_deprecated index 01c007de9fa1..44e3f92c1881 100644 --- a/pkg/sql/logictest/testdata/logic_test/system_namespace_deprecated +++ b/pkg/sql/logictest/testdata/logic_test/system_namespace_deprecated @@ -1,41 +1,47 @@ +# LogicTest: local-mixed-19.2-20.1 + # This should test the local-mixed-19.2-20.1 configuration because system.namespace # changed in 20.1. -# TODO(whomever): #42931 uncomment these tests and only run them for -# local-mixed-19.2-20.1 configuration. -# query ITI rowsort -# SELECT * FROM system.namespace -# ---- -# 0 defaultdb 50 -# 0 postgres 51 -# 0 system 1 -# 0 test 52 -# 1 comments 24 -# 1 descriptor 3 -# 1 eventlog 12 -# 1 jobs 15 -# 1 lease 11 -# 1 locations 21 -# 1 namespace 30 -# 1 namespace_deprecated 2 -# 1 rangelog 13 -# 1 replication_constraint_stats 25 -# 1 replication_critical_localities 26 -# 1 replication_stats 27 -# 1 reports_meta 28 -# 1 role_members 23 -# 1 settings 6 -# 1 table_statistics 20 -# 1 ui 14 -# 1 users 4 -# 1 web_sessions 19 -# 1 zones 5 +query ITI rowsort +SELECT * FROM system.namespace +---- +0 defaultdb 50 +0 postgres 51 +0 system 1 +0 test 52 +1 comments 24 +1 descriptor 3 +1 eventlog 12 +1 jobs 15 +1 lease 11 +1 locations 21 +1 namespace 30 +1 namespace_deprecated 2 +1 protected_ts_meta 31 +1 protected_ts_records 32 +1 rangelog 13 +1 replication_constraint_stats 25 +1 replication_critical_localities 26 +1 replication_stats 27 +1 reports_meta 28 +1 role_members 23 +1 role_options 33 +1 settings 6 +1 statement_bundle_chunks 34 +1 statement_diagnostics 36 +1 statement_diagnostics_requests 35 +1 table_statistics 20 +1 ui 14 +1 users 4 +1 web_sessions 19 +1 zones 5 -# # Verify format of system namespace. -# query TTBTTTB -# SHOW COLUMNS FROM system.namespace -# ---- -# parentID INT8 false NULL · {primary} false -# parentSchemaID INT8 false NULL · {primary} false -# name STRING false NULL · {primary} false -# id INT8 true NULL · {} false +# Verify format of system namespace. +query TTBTTTB +SHOW COLUMNS FROM system.namespace +---- +parentID INT8 false NULL · {primary} false +parentSchemaID INT8 false NULL · {primary} false +name STRING false NULL · {primary} false +id INT8 true NULL · {} false diff --git a/pkg/sql/logictest/testdata/logic_test/update b/pkg/sql/logictest/testdata/logic_test/update index efdd032efbec..e8abe0027145 100644 --- a/pkg/sql/logictest/testdata/logic_test/update +++ b/pkg/sql/logictest/testdata/logic_test/update @@ -263,14 +263,13 @@ statement count 1 INSERT INTO xyz VALUES (111, 222, 333) -# TODO(jordan): re-enable post #28716 -# statement count 1 -# UPDATE xyz SET (z, y) = (SELECT 666, 777), x = (SELECT 2) -# -# query III -# SELECT * from xyz -# ---- -# 2 777 666 +statement count 1 +UPDATE xyz SET (z, y) = (SELECT 666, 777), x = (SELECT 2) + +query III +SELECT * from xyz +---- +2 777 666 statement ok CREATE TABLE lots ( diff --git a/pkg/sql/logictest/testdata/logic_test/vectorize b/pkg/sql/logictest/testdata/logic_test/vectorize index a288dd05b1aa..b5d904080be2 100644 --- a/pkg/sql/logictest/testdata/logic_test/vectorize +++ b/pkg/sql/logictest/testdata/logic_test/vectorize @@ -1,4 +1,4 @@ -# LogicTest: local local-vec fakedist-vec-disk +# LogicTest: local local-vec fakedist fakedist-vec-disk fakedist-disk # Disable automatic stats. statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/vectorize_agg b/pkg/sql/logictest/testdata/logic_test/vectorize_agg index bcd4b4ed5819..14b8e9c83ec0 100644 --- a/pkg/sql/logictest/testdata/logic_test/vectorize_agg +++ b/pkg/sql/logictest/testdata/logic_test/vectorize_agg @@ -1,12 +1,8 @@ -# LogicTest: local-vec +# LogicTest: local local-vec fakedist fakedist-vec-disk fakedist-disk statement ok CREATE TABLE bools (a INT, b BOOL) -# Ensure vectorize engine is used -statement ok -SET vectorize=experimental_always - query BB SELECT bool_and(b), bool_or(b) FROM bools ---- @@ -16,9 +12,6 @@ query BB SELECT bool_and(b), bool_or(b) FROM bools GROUP BY a ---- -statement ok -RESET vectorize - statement OK INSERT INTO bools VALUES (0, NULL), diff --git a/pkg/sql/logictest/testdata/logic_test/vectorize_threshold b/pkg/sql/logictest/testdata/logic_test/vectorize_threshold index c258cde3a4ca..7c7d3126ba66 100644 --- a/pkg/sql/logictest/testdata/logic_test/vectorize_threshold +++ b/pkg/sql/logictest/testdata/logic_test/vectorize_threshold @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node # Disable automatic stats. statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/window b/pkg/sql/logictest/testdata/logic_test/window index 11ec4db5e943..78e331fffed6 100644 --- a/pkg/sql/logictest/testdata/logic_test/window +++ b/pkg/sql/logictest/testdata/logic_test/window @@ -1,4 +1,4 @@ -# LogicTest: local local-vec fakedist fakedist-metadata fakedist-vec fakedist-vec-disk 5node-local 5node-dist 5node-dist-metadata 5node-dist-disk +# LogicTest: local local-vec fakedist fakedist-metadata fakedist-vec fakedist-vec-disk 5node-default-configs statement ok CREATE TABLE kv ( @@ -3689,3 +3689,120 @@ query B SELECT count(*) = 26 FROM crdb_internal.feature_usage WHERE feature_name LIKE 'sql.plan.window_function%' AND usage_count > 0 ---- true + +statement ok +DROP TABLE t; CREATE TABLE t (a INT, b INT, c INT PRIMARY KEY) + +statement ok +INSERT INTO t VALUES + (0, 1, 0), + (1, 1, 1), + (0, 2, 2), + (1, 2, 3) + +# We sort the output on all queries with row_number window function to get +# deterministic results. +query III +SELECT a, b, row_number() OVER (ORDER BY a, b) FROM t ORDER BY a, b +---- +0 1 1 +0 2 2 +1 1 3 +1 2 4 + +query III +SELECT a, b, row_number() OVER (PARTITION BY a ORDER BY b) FROM t ORDER BY a, b +---- +0 1 1 +0 2 2 +1 1 1 +1 2 2 + +query III +SELECT a, b, row_number() OVER (PARTITION BY a, b) FROM t ORDER BY a, b +---- +0 1 1 +0 2 1 +1 1 1 +1 2 1 + +query III rowsort +SELECT a, b, rank() OVER () FROM t +---- +0 1 1 +0 2 1 +1 1 1 +1 2 1 + +query III rowsort +SELECT a, b, rank() OVER (ORDER BY a) FROM t +---- +0 1 1 +0 2 1 +1 1 3 +1 2 3 + +query IIII rowsort +SELECT a, b, c, rank() OVER (PARTITION BY a ORDER BY c) FROM t +---- +0 1 0 1 +0 2 2 2 +1 1 1 1 +1 2 3 2 + +query III rowsort +SELECT a, b, dense_rank() OVER () FROM t +---- +0 1 1 +0 2 1 +1 1 1 +1 2 1 + +query III rowsort +SELECT a, b, dense_rank() OVER (ORDER BY a) FROM t +---- +0 1 1 +0 2 1 +1 1 2 +1 2 2 + +query IIII rowsort +SELECT a, b, c, dense_rank() OVER (PARTITION BY a ORDER BY c) FROM t +---- +0 1 0 1 +0 2 2 2 +1 1 1 1 +1 2 3 2 + +query IIIIRR rowsort +SELECT a, b, rank() OVER w, dense_rank() OVER w, percent_rank() OVER w, cume_dist() OVER w FROM t WINDOW w AS () +---- +0 1 1 1 0 1 +1 1 1 1 0 1 +0 2 1 1 0 1 +1 2 1 1 0 1 + +query IIIIRR rowsort +SELECT a, b, rank() OVER w, dense_rank() OVER w, percent_rank() OVER w, cume_dist() OVER w FROM t WINDOW w AS (PARTITION BY a) +---- +0 1 1 1 0 1 +0 2 1 1 0 1 +1 1 1 1 0 1 +1 2 1 1 0 1 + + +query IIIIRR rowsort +SELECT a, b, rank() OVER w, dense_rank() OVER w, percent_rank() OVER w, cume_dist() OVER w FROM t WINDOW w AS (ORDER BY a) +---- +0 1 1 1 0 0.5 +0 2 1 1 0 0.5 +1 1 3 2 0.666666666666667 1 +1 2 3 2 0.666666666666667 1 + +query IIIIRR rowsort +SELECT a, b, rank() OVER w, dense_rank() OVER w, percent_rank() OVER w, cume_dist() OVER w FROM t WINDOW w AS (PARTITION BY a ORDER BY b) +---- +0 1 1 1 0 0.5 +0 2 2 2 1 1 +1 1 1 1 0 0.5 +1 2 2 2 1 1 diff --git a/pkg/sql/opt/exec/execbuilder/builder_test.go b/pkg/sql/opt/exec/execbuilder/builder_test.go index 265f121137da..3d677b40c316 100644 --- a/pkg/sql/opt/exec/execbuilder/builder_test.go +++ b/pkg/sql/opt/exec/execbuilder/builder_test.go @@ -22,7 +22,7 @@ import ( // queries. // // The test files should use combinations of the local, fakedist and -// 5node-dist configs. For tests that only have EXPLAIN (PLAN) statements, +// 5node configs. For tests that only have EXPLAIN (PLAN) statements, // it's sufficient to run on a single configuration. func TestExecBuild(t *testing.T) { defer leaktest.AfterTest(t)() diff --git a/pkg/sql/opt/exec/execbuilder/testdata/dist_union b/pkg/sql/opt/exec/execbuilder/testdata/dist_union index 491057a1610b..af0eaf54863b 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/dist_union +++ b/pkg/sql/opt/exec/execbuilder/testdata/dist_union @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node statement ok CREATE TABLE uniontest ( diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg b/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg index 09eabae191bb..1bcd00f5d58a 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_agg @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node statement ok CREATE TABLE data (a INT, b INT, c FLOAT, d DECIMAL, PRIMARY KEY (a, b, c, d)) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on b/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on index 69bae239ac6f..145bc3887fc2 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_distinct_on @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node statement ok CREATE TABLE xyz ( diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin b/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin index 34af0570e44d..9d6d4a2aeafc 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_indexjoin @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node statement ok CREATE TABLE t (k INT PRIMARY KEY, v INT, w INT, INDEX v(v)) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_interleaved_join b/pkg/sql/opt/exec/execbuilder/testdata/distsql_interleaved_join index 875d0a64a69f..0cd4292337c9 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_interleaved_join +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_interleaved_join @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node # The following tables form the interleaved hierarchy: # name: primary key: # rows: 'a' = id mod X : diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_join b/pkg/sql/opt/exec/execbuilder/testdata/distsql_join index 30af8fb6736d..ce145aec1f85 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_join +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_join @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node statement ok CREATE TABLE data (a INT, b INT, c INT, d INT, PRIMARY KEY (a, b, c, d)) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc b/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc index 81c3637c60e5..e77af97e27d9 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node subtest scrub diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables b/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables index 753db1f62f0a..9d46fbe9e08a 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_numtables @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node # First, we set up two data tables: # - NumToSquare maps integers from 1 to 100 to their squares diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality b/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality index aa70052b931c..61a23855a6b6 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_ordinality @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node statement ok CREATE TABLE xyz ( diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_tighten_spans b/pkg/sql/opt/exec/execbuilder/testdata/distsql_tighten_spans index 161fbb6c19c2..6b51aca0a418 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_tighten_spans +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_tighten_spans @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node # This test verifies that we correctly tighten spans during index selection as # well as after partitioning spans in distsql. diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_union b/pkg/sql/opt/exec/execbuilder/testdata/distsql_union index 482d0eafadf1..60083cb27e3c 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_union +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_union @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node statement ok CREATE TABLE xyz ( diff --git a/pkg/sql/opt/exec/execbuilder/testdata/lookup_join b/pkg/sql/opt/exec/execbuilder/testdata/lookup_join index 2fb6d7227fb2..b43bd58ec0a3 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/lookup_join +++ b/pkg/sql/opt/exec/execbuilder/testdata/lookup_join @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node statement ok CREATE TABLE abc (a INT, b INT, c INT, PRIMARY KEY (a, c)) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/prepare b/pkg/sql/opt/exec/execbuilder/testdata/prepare index 8d555778390f..7524adce3ecf 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/prepare +++ b/pkg/sql/opt/exec/execbuilder/testdata/prepare @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node statement ok CREATE TABLE ab (a INT PRIMARY KEY, b INT); INSERT INTO ab (a, b) VALUES (1, 10) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/stats b/pkg/sql/opt/exec/execbuilder/testdata/stats index 4e27185e82c0..3291ce4e008e 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/stats +++ b/pkg/sql/opt/exec/execbuilder/testdata/stats @@ -1,4 +1,4 @@ -# LogicTest: 5node-dist +# LogicTest: 5node # Tests that verify we retrieve the stats correctly. Note that we can't create # statistics if distsql mode is OFF.