From 0c6b9fadccfc318a75d5dd0f6ed998c722c7c429 Mon Sep 17 00:00:00 2001 From: ohad Date: Thu, 20 Feb 2025 16:09:10 -0500 Subject: [PATCH 01/62] Create a sandbox with all tests enabled, running with current vs. 4.0.559.6 --- .../src/test/java/YamlIntegrationTests.java | 38 ------------------- .../resources/aggregate-empty-table.yamsql | 2 - yaml-tests/src/test/resources/enum.yamsql | 3 -- .../src/test/resources/insert-enum.yamsql | 3 -- .../resources/inserts-updates-deletes.yamsql | 6 --- yaml-tests/src/test/resources/prepared.yamsql | 3 -- .../src/test/resources/recursive-cte.yamsql | 2 - yaml-tests/yaml-tests.gradle | 15 +------- 8 files changed, 1 insertion(+), 71 deletions(-) diff --git a/yaml-tests/src/test/java/YamlIntegrationTests.java b/yaml-tests/src/test/java/YamlIntegrationTests.java index 8e8e2d17c1..b0727c05ba 100644 --- a/yaml-tests/src/test/java/YamlIntegrationTests.java +++ b/yaml-tests/src/test/java/YamlIntegrationTests.java @@ -39,43 +39,31 @@ public void showcasingTests(YamlTest.Runner runner) throws Exception { } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Infinite continuation loop (https://github.com/FoundationDB/fdb-record-layer/issues/3095)") public void groupByTests(YamlTest.Runner runner) throws Exception { runner.runYamsql("groupby-tests.yamsql"); } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "continuation verification (https://github.com/FoundationDB/fdb-record-layer/issues/3096)") public void standardTests(YamlTest.Runner runner) throws Exception { runner.runYamsql("standard-tests.yamsql"); } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "continuation verification (https://github.com/FoundationDB/fdb-record-layer/issues/3096)") public void standardTestsWithProto(YamlTest.Runner runner) throws Exception { runner.runYamsql("standard-tests-proto.yamsql"); } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Continuation verification (https://github.com/FoundationDB/fdb-record-layer/issues/3096)") public void fieldIndexTestsProto(YamlTest.Runner runner) throws Exception { runner.runYamsql("field-index-tests-proto.yamsql"); } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Continuation verification (https://github.com/FoundationDB/fdb-record-layer/issues/3096)") public void standardTestsWithMetaData(YamlTest.Runner runner) throws Exception { runner.runYamsql("standard-tests-metadata.yamsql"); } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "continuation verification (https://github.com/FoundationDB/fdb-record-layer/issues/3096)") public void nullOperator(YamlTest.Runner runner) throws Exception { runner.runYamsql("null-operator-tests.yamsql"); } @@ -129,29 +117,21 @@ public void createDropCreateTemplate(YamlTest.Runner runner) throws Exception { } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Continuation verification (https://github.com/FoundationDB/fdb-record-layer/issues/3096)") public void aggregateIndexTests(YamlTest.Runner runner) throws Exception { runner.runYamsql("aggregate-index-tests.yamsql"); } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Infinite continuation loop (https://github.com/FoundationDB/fdb-record-layer/issues/3095)") public void aggregateEmptyTable(YamlTest.Runner runner) throws Exception { runner.runYamsql("aggregate-empty-table.yamsql"); } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Infinite continuation loop (https://github.com/FoundationDB/fdb-record-layer/issues/3095)") public void aggregateIndexTestsCount(YamlTest.Runner runner) throws Exception { runner.runYamsql("aggregate-index-tests-count.yamsql"); } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Infinite continuation loop (https://github.com/FoundationDB/fdb-record-layer/issues/3095)") public void aggregateIndexTestsCountEmpty(YamlTest.Runner runner) throws Exception { runner.runYamsql("aggregate-index-tests-count-empty.yamsql"); } @@ -172,8 +152,6 @@ public void orderBy(YamlTest.Runner runner) throws Exception { } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Infinite loop (https://github.com/FoundationDB/fdb-record-layer/issues/3095)") public void primaryKey(YamlTest.Runner runner) throws Exception { runner.runYamsql("primary-key-tests.yamsql"); } @@ -194,8 +172,6 @@ public void inPredicate(YamlTest.Runner runner) throws Exception { } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Infinite continuation (https://github.com/FoundationDB/fdb-record-layer/issues/3095)") void booleanTypes(YamlTest.Runner runner) throws Exception { runner.runYamsql("boolean.yamsql"); } @@ -206,8 +182,6 @@ void bytes(YamlTest.Runner runner) throws Exception { } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Continuation verification (https://github.com/FoundationDB/fdb-record-layer/issues/3096)") void catalog(YamlTest.Runner runner) throws Exception { runner.runYamsql("catalog.yamsql"); } @@ -218,29 +192,21 @@ public void caseWhen(YamlTest.Runner runner) throws Exception { } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "maxRows ignored on update (https://github.com/FoundationDB/fdb-record-layer/issues/3100)") public void updateDeleteReturning(YamlTest.Runner runner) throws Exception { runner.runYamsql("update-delete-returning.yamsql"); } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Like continuation failure (https://github.com/FoundationDB/fdb-record-layer/issues/3099)") void like(YamlTest.Runner runner) throws Exception { runner.runYamsql("like.yamsql"); } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Continuation mismatch (https://github.com/FoundationDB/fdb-record-layer/issues/3098)") void functions(YamlTest.Runner runner) throws Exception { runner.runYamsql("functions.yamsql"); } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Continuation verification (https://github.com/FoundationDB/fdb-record-layer/issues/3096)") void createDrop(YamlTest.Runner runner) throws Exception { runner.runYamsql("create-drop.yamsql"); } @@ -285,15 +251,11 @@ public void cte(YamlTest.Runner runner) throws Exception { } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Continuation error (https://github.com/FoundationDB/fdb-record-layer/issues/3097)") public void bitmap(YamlTest.Runner runner) throws Exception { runner.runYamsql("bitmap-aggregate-index.yamsql"); } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "maxRows ignored (https://github.com/FoundationDB/fdb-record-layer/issues/3100)") public void recursiveCte(YamlTest.Runner runner) throws Exception { runner.runYamsql("recursive-cte.yamsql"); } diff --git a/yaml-tests/src/test/resources/aggregate-empty-table.yamsql b/yaml-tests/src/test/resources/aggregate-empty-table.yamsql index b440a395c0..d5de590ef4 100644 --- a/yaml-tests/src/test/resources/aggregate-empty-table.yamsql +++ b/yaml-tests/src/test/resources/aggregate-empty-table.yamsql @@ -36,7 +36,6 @@ test_block: tests: - - query: select count(*) from T1; - - supported_version: 4.1.4.0 - explain: "SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - maxRows: 1 - result: [{0}] @@ -189,7 +188,6 @@ test_block: - result: [] - - query: select sum(col1) from T1; - - supported_version: 4.1.4.0 - explain: "SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - maxRows: 1 - result: [{!null _}] diff --git a/yaml-tests/src/test/resources/enum.yamsql b/yaml-tests/src/test/resources/enum.yamsql index 06391e715b..ad1f281579 100644 --- a/yaml-tests/src/test/resources/enum.yamsql +++ b/yaml-tests/src/test/resources/enum.yamsql @@ -17,9 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. --- -options: - supported_version: 4.1.6.0 ---- schema_template: CREATE TYPE AS ENUM MOOD ( 'JOYFUL', 'HAPPY', 'RELAXED', 'INDIFFERENT', 'CONFUSED', 'SAD', 'ANXIOUS', 'ANGRY' ) CREATE TABLE TABLE_A ("id" BIGINT, "name" STRING, "mood" MOOD, PRIMARY KEY("id") ) diff --git a/yaml-tests/src/test/resources/insert-enum.yamsql b/yaml-tests/src/test/resources/insert-enum.yamsql index dcb1eccc60..7f26ceba80 100644 --- a/yaml-tests/src/test/resources/insert-enum.yamsql +++ b/yaml-tests/src/test/resources/insert-enum.yamsql @@ -17,9 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. --- -options: - supported_version: 4.1.6.0 ---- schema_template: CREATE TYPE AS ENUM "WHATEVER" ( 'OWNING', 'WEAK', 'VALIDATING' ) CREATE TABLE "TableA" ("field1" "WHATEVER", "field2" BIGINT, PRIMARY KEY("field2") ) diff --git a/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql b/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql index 3bd6ea1818..8ab04feecc 100644 --- a/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql +++ b/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql @@ -108,30 +108,24 @@ test_block: - # Case where not all values are provided of A. Still works, since the columns for which no values are provided can be nullable. - query: insert into A(A1, A2, A3) values (4); - - supported_version: 4.1.6.0 - error: "42601" - # Case when the number of values is more than the number of columns specified. - query: insert into A(A1, A2, A3) values (5, 6, 7, 8, 9); - - supported_version: 4.1.6.0 - error: "42601" - # Case when a nullable column's value is not provided - query: insert into A(A1, A3) values (6, 7); - - supported_version: 4.1.6.0 - count: 1 - # Case when a nullable column's value is not provided and column is the first one - query: insert into A(A2, A3) values (6, 7); - - supported_version: 4.1.6.0 - count: 1 - # Case when a nullable column's value is not provided and column is the last one - query: insert into A(A1, A2) values (7, 8); - - supported_version: 4.1.6.0 - count: 1 - - query: select * from A where A1 = 6 - - supported_version: 4.1.6.0 - result: [{ A1: 6, A2: !null , A3: 7 }] ... diff --git a/yaml-tests/src/test/resources/prepared.yamsql b/yaml-tests/src/test/resources/prepared.yamsql index 84538b6130..f67f074593 100644 --- a/yaml-tests/src/test/resources/prepared.yamsql +++ b/yaml-tests/src/test/resources/prepared.yamsql @@ -17,9 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. ---- -options: - supported_version: 4.1.6.0 --- schema_template: create table ta(a bigint, b double, c boolean, d integer, e integer array, f string, primary key(a)) diff --git a/yaml-tests/src/test/resources/recursive-cte.yamsql b/yaml-tests/src/test/resources/recursive-cte.yamsql index 5ebf53db32..45e6b167f3 100644 --- a/yaml-tests/src/test/resources/recursive-cte.yamsql +++ b/yaml-tests/src/test/resources/recursive-cte.yamsql @@ -77,7 +77,6 @@ test_block: select id, parent from t1 where parent = -1 union all select b.id, b.parent from c1 as a, t1 as b where a.id = b.parent) select id from c1 - - supported_version: 4.1.6.0 - explain: RUNION q0, q1 { INITIAL { ISCAN(PARENTIDX [EQUALS promote(@c15 AS LONG)]) | INSERT INTO TEMP q1 } RECURSIVE { ISCAN(CHILDIDX <,>) | FLATMAP q2 -> { TEMP SCAN base() | FILTER _.ID EQUALS q2.PARENT AS q3 RETURN (q2.ID AS ID, q2.PARENT AS PARENT) } | INSERT INTO TEMP q1 }} | MAP (_.ID AS ID) - maxRows: 1 - result: [{ID: 1}] @@ -98,7 +97,6 @@ test_block: select b.id, b.parent from ancestorsOf250 as a, t1 as b where a.parent = b.id) select id, parent from ancestorsOf250 union all select b.id, b.parent from allDescendants as a, t1 as b where a.id = b.parent) select id, parent from allDescendants - - supported_version: 4.1.6.0 - explain: "RUNION q0, q1 { INITIAL { RUNION q2, q3 { INITIAL { ISCAN(CHILDIDX [EQUALS promote(@c20 AS LONG)]) | INSERT INTO TEMP q3 } RECURSIVE { ISCAN(CHILDIDX <,>) | FLATMAP q4 -> { TEMP SCAN base() | FILTER _.PARENT EQUALS q4.ID AS q5 RETURN (q4.ID AS ID, q4.PARENT AS PARENT) } | INSERT INTO TEMP q3 }} | MAP (_.ID AS ID, _.PARENT AS PARENT) | INSERT INTO TEMP q1 } RECURSIVE { ISCAN(CHILDIDX <,>) | FLATMAP q6 -> { TEMP SCAN base() | FILTER _.ID EQUALS q6.PARENT AS q7 RETURN (q6.ID AS ID, q6.PARENT AS PARENT) } | INSERT INTO TEMP q1 }} | MAP (_.ID AS ID, _.PARENT AS PARENT)" - maxRows: 1 - result: [{250, 50}] diff --git a/yaml-tests/yaml-tests.gradle b/yaml-tests/yaml-tests.gradle index 7b52f269a2..b018033097 100644 --- a/yaml-tests/yaml-tests.gradle +++ b/yaml-tests/yaml-tests.gradle @@ -95,7 +95,7 @@ ext.resolveOtherServer = { Set rejectedVersions -> 'classifier': 'all'], { version { - strictly '+' + strictly '4.0.559.6' if (rejectedVersions.size() > 0) { reject rejectedVersions.toArray(new String[0]) } @@ -169,19 +169,6 @@ task serverJars(type: Copy) { } } -task downloadManyExternalServers(type: Copy) { - dependsOn "cleanExternalServerDirectory" - from resolveManyServers() - into project.layout.buildDirectory.dir('externalServer') -} - -mixedModeTest { - dependsOn("downloadManyExternalServers") - systemProperty("yaml_testing_external_server", project.layout.buildDirectory.dir('externalServer').get().asFile) - // this is specified in testing.gradle, but it looks like it needs to be repeated here. - ignoreFailures = true -} - test { dependsOn "serverJars" systemProperty("yaml_testing_external_server", project.layout.buildDirectory.dir('externalServer').get().asFile) From 6f83adf1cf622f69ba6034d59e08fe2588d56bd3 Mon Sep 17 00:00:00 2001 From: ohad Date: Thu, 20 Feb 2025 16:21:08 -0500 Subject: [PATCH 02/62] Add triage comments to bitmap-aggregate-index tests --- .../src/test/resources/bitmap-aggregate-index.yamsql | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql b/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql index 0aedc30da1..fb70237f84 100644 --- a/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql +++ b/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql @@ -70,11 +70,13 @@ test_block: - - query: SELECT bitmap_construct_agg(bitmap_bit_position(id)) as bitmap, bitmap_bucket_offset(id) as offset FROM T2 GROUP BY bitmap_bucket_offset(id) - explain: "ISCAN(AGG_INDEX_1 <,>) | MAP (_ AS _0) | AGG (bitmap_construct_agg_l((_._0.ID) bitmap_bit_position 10000) AS _0) GROUP BY ((_._0.ID) bitmap_bucket_offset 10000 AS _0) | MAP (_._1._0 AS BITMAP, _._0._0 AS OFFSET)" - - unorderedResult: [{BITMAP: xStartsWith_1250'060000c', 'OFFSET':0}, {BITMAP: xStartsWith_1250'02', 'OFFSET':10000}] + # 4.1 Triage: this fails with continuation tests against 4.0.559.6. Wrong results + # - unorderedResult: [{BITMAP: xStartsWith_1250'060000c', 'OFFSET':0}, {BITMAP: xStartsWith_1250'02', 'OFFSET':10000}] - - query: SELECT bitmap_construct_agg(bitmap_bit_position(id)) as bitmap, category, bitmap_bucket_offset(id) as offset FROM T2 GROUP BY category, bitmap_bucket_offset(id) - explain: "ISCAN(AGG_INDEX_2 <,>) | MAP (_ AS _0) | AGG (bitmap_construct_agg_l((_._0.ID) bitmap_bit_position 10000) AS _0) GROUP BY (_._0.CATEGORY AS _0, (_._0.ID) bitmap_bucket_offset 10000 AS _1) | MAP (_._1._0 AS BITMAP, _._0._0 AS CATEGORY, _._0._1 AS OFFSET)" - - unorderedResult: [{BITMAP: xStartsWith_1250'0200004', 'CATEGORY': 'hello', 'OFFSET':0}, - {BITMAP: xStartsWith_1250'02', 'CATEGORY': 'hello', 'OFFSET':10000}, - {BITMAP: xStartsWith_1250'0400008', 'CATEGORY': 'world', 'OFFSET':0}] + # 4.1 Triage: this fails with continuation tests against 4.0.559.6. Wrong results + # - unorderedResult: [{BITMAP: xStartsWith_1250'0200004', 'CATEGORY': 'hello', 'OFFSET':0}, + # {BITMAP: xStartsWith_1250'02', 'CATEGORY': 'hello', 'OFFSET':10000}, + # {BITMAP: xStartsWith_1250'0400008', 'CATEGORY': 'world', 'OFFSET':0}] ... From 09c7dcf46a0638558a039993d5a87c943a59d17b Mon Sep 17 00:00:00 2001 From: ohad Date: Thu, 20 Feb 2025 17:41:37 -0500 Subject: [PATCH 03/62] Remove exclusion and added triage comments to join-tests, select-a-star, subquery-tests and union --- yaml-tests/src/test/java/YamlIntegrationTests.java | 8 -------- yaml-tests/src/test/resources/join-tests.yamsql | 4 ++++ yaml-tests/src/test/resources/select-a-star.yamsql | 6 ++++++ yaml-tests/src/test/resources/subquery-tests.yamsql | 8 ++++++++ yaml-tests/src/test/resources/union.yamsql | 11 ++++++++++- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/yaml-tests/src/test/java/YamlIntegrationTests.java b/yaml-tests/src/test/java/YamlIntegrationTests.java index b0727c05ba..aaf696e044 100644 --- a/yaml-tests/src/test/java/YamlIntegrationTests.java +++ b/yaml-tests/src/test/java/YamlIntegrationTests.java @@ -85,22 +85,16 @@ public void scenarioTests(YamlTest.Runner runner) throws Exception { } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Infinite continuation loop (https://github.com/FoundationDB/fdb-record-layer/issues/3095)") public void joinTests(YamlTest.Runner runner) throws Exception { runner.runYamsql("join-tests.yamsql"); } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Infinite continuation loop (https://github.com/FoundationDB/fdb-record-layer/issues/3095)") public void subqueryTests(YamlTest.Runner runner) throws Exception { runner.runYamsql("subquery-tests.yamsql"); } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Infinite continuation loop (https://github.com/FoundationDB/fdb-record-layer/issues/3095)") public void selectAStar(YamlTest.Runner runner) throws Exception { runner.runYamsql("select-a-star.yamsql"); } @@ -232,8 +226,6 @@ public void indexedFunctions(YamlTest.Runner runner) throws Exception { } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Infinite continuation loop (https://github.com/FoundationDB/fdb-record-layer/issues/3095)") public void union(YamlTest.Runner runner) throws Exception { runner.runYamsql("union.yamsql"); } diff --git a/yaml-tests/src/test/resources/join-tests.yamsql b/yaml-tests/src/test/resources/join-tests.yamsql index 177923438f..5e6c9c0c25 100644 --- a/yaml-tests/src/test/resources/join-tests.yamsql +++ b/yaml-tests/src/test/resources/join-tests.yamsql @@ -67,6 +67,8 @@ test_block: - # Get names of people working on a project - query: select fname, lname from emp where exists (select * from project where emp_id = emp.id); + # 4.1 Triage: This runs into infinite loop + - maxRows: 0 - unorderedResult: [{"Emily", "Martinez"}, {"Daniel", "Miller"}, {"Megan", "Miller"}] @@ -76,6 +78,8 @@ test_block: (select fname, lname, dept_id from emp where exists (select * from project where emp_id = emp.id)) as sq, dept where sq.dept_id = dept.id and dept.name = 'Sales'; + # 4.1 Triage: This runs into infinite loop + - maxRows: 0 - unorderedResult: [{"Daniel", "Miller"}] - # three-way join to find which departments' corresponding projects. diff --git a/yaml-tests/src/test/resources/select-a-star.yamsql b/yaml-tests/src/test/resources/select-a-star.yamsql index 1f9fe01fe1..f94013f5f8 100644 --- a/yaml-tests/src/test/resources/select-a-star.yamsql +++ b/yaml-tests/src/test/resources/select-a-star.yamsql @@ -40,6 +40,8 @@ test_block: tests: - - query: select B1 from B where exists (select A.*, B1 from A group by A1,A2,A3); + # 4.1 Triage: Infinite loop + - maxRows: 0 - result: [{1}, {2}, {3}] - - query: select A.* from A; @@ -78,9 +80,13 @@ test_block: - error: "42803" - - query: select B1 from B where exists (select A.*, B1 from A group by A1,A2,A3); + # 4.1 Triage: Infinite loop + - maxRows: 0 - result: [{1}, {2}, {3}] - - query: select B.* from B where exists (select A.*, B.* from A group by A1,A2,A3); + # 4.1 Triage: Infinite loop + - maxRows: 0 - result: [{1, 20, {4, 40}}, {2, 20, {5, 50}}, {3, 20, {6, 60}}] diff --git a/yaml-tests/src/test/resources/subquery-tests.yamsql b/yaml-tests/src/test/resources/subquery-tests.yamsql index 03c8dbdd4f..d848e02ac0 100644 --- a/yaml-tests/src/test/resources/subquery-tests.yamsql +++ b/yaml-tests/src/test/resources/subquery-tests.yamsql @@ -62,17 +62,25 @@ test_block: - # correlations are allowed inside a nested subquery with group by - query: select x from a where exists (select a.x, max(idb) from b where q > a.x group by q) + # 4.1 Triage: Verify Exception for continuation + - maxRows: 0 - result: [{1}, {2}, {3}] - # correlations are allowed inside a nested subquery with group by, not necessarily qualified - query: select x from a where exists (select x, max(idb) from b where q > x group by q) + # 4.1 Triage: Contextual SQL Exception for continuation + - maxRows: 0 - result: [{1}, {2}, {3}] - # correlations inside aggregations are allowed inside a nested subquery with group by - query: select x from a where exists (select max(x), max(idb) from b where q > x group by q) + # 4.1 Triage: infinite loop for continuation + - maxRows: 0 - result: [{1}, {2}, {3}] - # correlations inside aggregations are allowed inside a nested subquery with group by - query: select x from a where exists (select max(a.x), max(idb) from b where q > x group by q) + # 4.1 Triage: infinite loop for continuation + - maxRows: 0 - result: [{1}, {2}, {3}] ... diff --git a/yaml-tests/src/test/resources/union.yamsql b/yaml-tests/src/test/resources/union.yamsql index 9c44250ef9..5e4ce0281b 100644 --- a/yaml-tests/src/test/resources/union.yamsql +++ b/yaml-tests/src/test/resources/union.yamsql @@ -58,6 +58,8 @@ test_block: tests: - - query: select sum(a) as a, sum(b) as b from (select sum(col1) as a, count(*) as b from t1 union all select sum(col1) as a, count(*) as b from t2) as x + # 4.1 Triage: infinite loop + - maxRows: 0 - unorderedResult: [{A: 74 , B: 13}] - - query: select col1, col2 from t1 union all select col1, col2 from t1 @@ -155,14 +157,20 @@ test_block: {A: 10.0, B: 20.0}] - - query: select sum(Y) as S from (select count(*) as Y from t3 where a < 10 group by a union all select count(*) from t4) as X + # 4.1 Triage: Infinite loop + - maxRows: 0 - explain: "AISCAN(MV10 [[LESS_THAN promote(@c22 AS DOUBLE)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS Y) | MAP (_.Y AS Y) ⊎ SCAN(<,>) | TFILTER T4 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)" - result: [{S: 2}] - - query: select sum(Y) as S from (select count(*) as Y from t3 union all select count(*) from t1) as X - explain: "SCAN(<,>) | TFILTER T3 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ ISCAN(VI1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)" + # 4.1 Triage: Infinite loop + - maxRows: 0 - result: [{S: 5}] - - query: select col2 from t1 where exists (select a from t3 where col2 <= id union all select b from t4 where col2 <= id) + # 4.1 Triage: Invalid continuation + - maxRows: 0 - result: [{1}, {2}, {6}, {7}] - - query: select col1, col2 from t1 union all select col1 from t1 @@ -176,5 +184,6 @@ test_block: - - query: select sum(Y) as S from (select count(*) as Y from t6 union all select count(*) from t7) as X - explain: "AISCAN(MV11 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ AISCAN(MV12 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)" - - result: [{0}] + # 4.1 Triage: Wrong result with forced continuation (NULL vs 0) + # - result: [{0}] ... From 1bfc0fe4135effafee1a9af1279059bdde63f419 Mon Sep 17 00:00:00 2001 From: ohad Date: Fri, 21 Feb 2025 11:23:20 -0500 Subject: [PATCH 04/62] Mark 4.1 Triage tests for aggregate-empty-table --- .../resources/aggregate-empty-table.yamsql | 351 +++++++++++------- 1 file changed, 210 insertions(+), 141 deletions(-) diff --git a/yaml-tests/src/test/resources/aggregate-empty-table.yamsql b/yaml-tests/src/test/resources/aggregate-empty-table.yamsql index d5de590ef4..4b882ec30f 100644 --- a/yaml-tests/src/test/resources/aggregate-empty-table.yamsql +++ b/yaml-tests/src/test/resources/aggregate-empty-table.yamsql @@ -34,19 +34,24 @@ schema_template: test_block: name: agg-empty-table-tests tests: - - - - query: select count(*) from T1; - - explain: "SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - maxRows: 1 - - result: [{0}] - - result: [] + # 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - + # - query: select count(*) from T1; + # - explain: "SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + # - maxRows: 1 + # - result: [{0}] + # - result: [] - - query: select count(*) from T1 where col1 = 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + - maxRows: 0 - result: [{0}] - - query: select count(*) from T1 where col1 > 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + - maxRows: 0 - result: [{0}] - - query: select count(*) from T1 where col1 = 0 group by col1; @@ -63,18 +68,21 @@ test_block: - - query: select count(*) from T1 where col1 > 0 group by col1; - error: "0AF00" - - - - query: select count(*) from T2; - - explain: "AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (result does not contain all expected rows! expected 1 rows, got 0) + # - + # - query: select count(*) from T2; + # - explain: "AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + # - result: [{0}] - - query: select count(*) from T2 where col1 = 0; - explain: "AISCAN(T2_I2 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - result: [{0}] - - query: select count(*) from T2 where col1 > 0; - explain: "SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - result: [{0}] - - query: select count(*) from T2 group by col1; - explain: "AISCAN(T2_I2 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" @@ -90,15 +98,18 @@ test_block: - - query: select count(*) from T3; - explain: "ISCAN(T3_I2 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - result: [{0}] - - query: select count(*) from T3 where col1 = 0; - explain: "ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{0}] - - query: select count(*) from T3 where col1 > 0; - explain: "ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - result: [{0}] - - query: select count(*) from T3 group by col1; - explain: "ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)" @@ -114,15 +125,18 @@ test_block: - - query: select count(col2) from T1; - explain: "SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{0}] - - query: select count(col2) from T1 where col1 = 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{0}] - - query: select count(col2) from T1 where col1 > 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{0}] - - query: select count(col2) from T1 where col1 = 0 group by col1; - error: "0AF00" @@ -141,15 +155,18 @@ test_block: - - query: select count(col2) from T2; - explain: "AISCAN(T2_I3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (result does not contain all expected rows! expected 1 rows, got 0) + # - result: [{0}] - - query: select count(col2) from T2 where col1 = 0; - explain: "AISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{0}] - - query: select count(col2) from T2 where col1 > 0; - explain: "SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - result: [{0}] - - query: select count(col2) from T2 group by col1; - explain: "AISCAN(T2_I4 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" @@ -165,15 +182,18 @@ test_block: - - query: select count(col2) from T3; - explain: "ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - result: [{0}] - - query: select count(col2) from T3 where col1 = 0; - explain: "ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{0}] - - query: select count(col2) from T3 where col1 > 0; - explain: "ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - result: [{0}] - - query: select count(col2) from T3 group by col1; - explain: "ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)" @@ -189,45 +209,55 @@ test_block: - - query: select sum(col1) from T1; - explain: "SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - maxRows: 1 - - result: [{!null _}] - - result: [] + # 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (too many rows in actual result set! expected 0 rows, got 1) + # - maxRows: 1 + # - result: [{!null _}] + # - result: [] - - query: select sum(col1) from T1 where col1 = 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - result: [{!null _}] - - query: select sum(col1) from T1 where col2 = 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL2 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{!null _}] - - query: select sum(col1) from T1 where col1 > 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{!null _}] - - query: select sum(col1) from T1 where col2 > 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - result: [{!null _}] - - query: select sum(col1) from T2; - explain: "AISCAN(T2_I5 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!null _}] + # 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (result does not contain all expected rows! expected 1 rows, got 0) + # - result: [{!null _}] - - query: select sum(col1) from T2 where col1 = 0; - explain: "SCAN(<,>) | TFILTER T2 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{!null _}] - - query: select sum(col1) from T2 where col2 = 0; - explain: "AISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{!null _}] - - query: select sum(col1) from T2 where col1 > 0; - explain: "SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{!null _}] - - query: select sum(col1) from T2 where col2 > 0; - explain: "SCAN(<,>) | TFILTER T2 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - result: [{!null _}] - - query: select sum(col1) from T2 where col1 = 0 group by col2; - error: "0AF00" @@ -241,27 +271,33 @@ test_block: - - query: select sum(col1) from T2 where col2 > 0 group by col2; - explain: "AISCAN(T2_I6 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" - - result: [] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [] - - query: select sum(col1) from T3; - explain: "ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{!null _}] - - query: select sum(col1) from T3 where col1 = 0; - explain: "ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{!null _}] - - query: select sum(col1) from T3 where col2 = 0; - explain: "ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{!null _}] - - query: select sum(col1) from T3 where col1 > 0; - explain: "ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - result: [{!null _}] - - query: select sum(col1) from T3 where col2 > 0; - explain: "ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - result: [{!null _}] - - query: select sum(col1) from T3 where col1 = 0 group by col2; - explain: "ISCAN(T3_I2 <,>) | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)" @@ -304,15 +340,18 @@ test_block: test_block: name: agg-empty-table-tests-after-modifications tests: - - - - query: select count(*) from T1; - - result: [{0}] - - - - query: select count(*) from T1 where col1 = 0; - - result: [{0}] - - - - query: select count(*) from T1 where col1 > 0; - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - + # - query: select count(*) from T1; + # - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - + # - query: select count(*) from T1 where col1 = 0; + # - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - + # - query: select count(*) from T1 where col1 > 0; + # - result: [{0}] - - query: select count(*) from T1 where col1 = 0 group by col1; - error: "0AF00" @@ -328,15 +367,18 @@ test_block: - - query: select count(*) from T1 where col1 > 0 group by col1; - error: "0AF00" - - - - query: select count(*) from T2; - - result: [{0}] - - - - query: select count(*) from T2 where col1 = 0; - - result: [{0}] - - - - query: select count(*) from T2 where col1 > 0; - - result: [{0}] + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - + # - query: select count(*) from T2; + # - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - + # - query: select count(*) from T2 where col1 = 0; + # - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - + # - query: select count(*) from T2 where col1 > 0; + # - result: [{0}] # - # # TODO ([POST] count index returns 0 instead of nothing when running on a table that was cleared) # - query: select count(*) from T2 group by col1; @@ -348,15 +390,18 @@ test_block: # # TODO ([POST] count index returns 0 instead of nothing when running on a table that was cleared) # - query: select count(*) from T2 where col1 > 0 group by col1; # - result: [] - - - - query: select count(*) from T3; - - result: [{0}] - - - - query: select count(*) from T3 where col1 = 0; - - result: [{0}] - - - - query: select count(*) from T3 where col1 > 0; - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - + # - query: select count(*) from T3; + # - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - + # - query: select count(*) from T3 where col1 = 0; + # - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - + # - query: select count(*) from T3 where col1 > 0; + # - result: [{0}] - - query: select count(*) from T3 group by col1; - result: [] @@ -366,15 +411,18 @@ test_block: - - query: select count(*) from T3 where col1 > 0 group by col1; - result: [] - - - - query: select count(col2) from T1; - - result: [{0}] - - - - query: select count(col2) from T1 where col1 = 0; - - result: [{0}] - - - - query: select count(col2) from T1 where col1 > 0; - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - + # - query: select count(col2) from T1; + # - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - + # - query: select count(col2) from T1 where col1 = 0; + # - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - + # - query: select count(col2) from T1 where col1 > 0; + # - result: [{0}] - - query: select count(col2) from T1 where col1 = 0 group by col1; - error: "0AF00" @@ -390,15 +438,18 @@ test_block: - - query: select count(col2) from T1 where col1 > 0 group by col1; - error: "0AF00" - - - - query: select count(col2) from T2; - - result: [{0}] - - - - query: select count(col2) from T2 where col1 = 0; - - result: [{0}] - - - - query: select count(col2) from T2 where col1 > 0; - - result: [{0}] + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - + # - query: select count(col2) from T2; + # - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - + # - query: select count(col2) from T2 where col1 = 0; + # - result: [{0}] + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - + # - query: select count(col2) from T2 where col1 > 0; + # - result: [{0}] # - # # TODO ([POST] count index returns 0 instead of nothing when running on a table that was cleared) # - query: select count(col2) from T2 group by col1; @@ -410,15 +461,18 @@ test_block: # # TODO ([POST] count index returns 0 instead of nothing when running on a table that was cleared) # - query: select count(col2) from T2 where col1 > 0 group by col1; # - result: [] - - - - query: select count(col2) from T3; - - result: [{0}] - - - - query: select count(col2) from T3 where col1 = 0; - - result: [{0}] - - - - query: select count(col2) from T3 where col1 > 0; - - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - + # - query: select count(col2) from T3; + # - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - + # - query: select count(col2) from T3 where col1 = 0; + # - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - + # - query: select count(col2) from T3 where col1 > 0; + # - result: [{0}] - - query: select count(col2) from T3 group by col1; - result: [] @@ -428,41 +482,51 @@ test_block: - - query: select count(col2) from T3 where col1 > 0 group by col1; - result: [] - - - - query: select sum(col1) from T1; - - result: [{!null _}] - - - - query: select sum(col1) from T1 where col1 = 0; - - result: [{!null _}] - - - - query: select sum(col1) from T1 where col2 = 0; - - result: [{!null _}] - - - - query: select sum(col1) from T1 where col1 > 0; - - result: [{!null _}] - - - - query: select sum(col1) from T1 where col2 > 0; - - result: [{!null _}] - - + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - + # - query: select sum(col1) from T1; + # - result: [{!null _}] + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - + # - query: select sum(col1) from T1 where col1 = 0; + # - result: [{!null _}] + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - + # - query: select sum(col1) from T1 where col2 = 0; + # - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - + # - query: select sum(col1) from T1 where col1 > 0; + # - result: [{!null _}] + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - + # - query: select sum(col1) from T1 where col2 > 0; + # - result: [{!null _}] + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - # TODO (enhance SUM aggregate index to disambiguate null results and 0 results) # This query is using the index T2_I5, the reason we're returning 0 here comes from the SUM index maintainer that # is configured by default to: # - subtract the indexed value when the corresponding tuple is removed from the base table. # - if the sum reaches zero, it keeps it in the sum index and does not remove the entry from there. - - query: select sum(col1) from T2; - - result: [{0}] - - - - query: select sum(col1) from T2 where col1 = 0; - - result: [{!null _}] - - - - query: select sum(col1) from T2 where col2 = 0; - - result: [{!null _}] - - - - query: select sum(col1) from T2 where col1 > 0; - - result: [{!null _}] - - - - query: select sum(col1) from T2 where col2 > 0; - - result: [{!null _}] + # - query: select sum(col1) from T2; + # - result: [{0}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - + # - query: select sum(col1) from T2 where col1 = 0; + # - result: [{!null _}] + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - + # - query: select sum(col1) from T2 where col2 = 0; + # - result: [{!null _}] + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - + # - query: select sum(col1) from T2 where col1 > 0; + # - result: [{!null _}] + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - + # - query: select sum(col1) from T2 where col2 > 0; + # - result: [{!null _}] - - query: select sum(col1) from T2 where col1 = 0 group by col2; - error: "0AF00" @@ -476,21 +540,26 @@ test_block: # # TODO ([POST] Enhance SUM aggregate index to disambiguate null results and 0 results) # - query: select sum(col1) from T2 where col2 > 0 group by col2; # - result: [] - - - - query: select sum(col1) from T3; - - result: [{!null _}] - - - - query: select sum(col1) from T3 where col1 = 0; - - result: [{!null _}] - - - - query: select sum(col1) from T3 where col2 = 0; - - result: [{!null _}] - - - - query: select sum(col1) from T3 where col1 > 0; - - result: [{!null _}] - - - - query: select sum(col1) from T3 where col2 > 0; - - result: [{!null _}] + # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) + # - + # - query: select sum(col1) from T3; + # - result: [{!null _}] + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - + # - query: select sum(col1) from T3 where col1 = 0; + # - result: [{!null _}] + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - + # - query: select sum(col1) from T3 where col2 = 0; + # - result: [{!null _}] + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - + # - query: select sum(col1) from T3 where col1 > 0; + # - result: [{!null _}] + # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) + # - + # - query: select sum(col1) from T3 where col2 > 0; + # - result: [{!null _}] - - query: select sum(col1) from T3 where col1 = 0 group by col2; - result: [] From f4d2502fa0f399afacf1bc668987dee5da2a9163 Mon Sep 17 00:00:00 2001 From: ohad Date: Fri, 21 Feb 2025 15:05:26 -0500 Subject: [PATCH 05/62] Add 4.1 triage annotations to groupby-tests --- .../src/test/resources/groupby-tests.yamsql | 133 ++++++++++-------- 1 file changed, 76 insertions(+), 57 deletions(-) diff --git a/yaml-tests/src/test/resources/groupby-tests.yamsql b/yaml-tests/src/test/resources/groupby-tests.yamsql index 60058c02b3..9bcb0198df 100644 --- a/yaml-tests/src/test/resources/groupby-tests.yamsql +++ b/yaml-tests/src/test/resources/groupby-tests.yamsql @@ -57,18 +57,21 @@ setup: test_block: name: group-by-tests tests: - - - - query: select max(q.s) from nested group by r.v.z having r.v.z > 120 - - result: [{330}] - - - - query: select max(q.s) from nested group by r.v.z as GRP having GRP > 120 - - result: [{330}] + # 4.1 Triage: Test failed when run with forced continuations (used by: com.google.common.base.VerifyException) + # - + # - query: select max(q.s) from nested group by r.v.z having r.v.z > 120 + # - result: [{330}] + # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) + # - + # - query: select max(q.s) from nested group by r.v.z as GRP having GRP > 120 + # - result: [{330}] - - query: select max(id) from t1 group by col1 having min(id) > 0 and col1 = 20; - result: [{13}] - - - - query: select max(id) from t1 group by col1 - - result: [{5}, {13}] + # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) + # - + # - query: select max(id) from t1 group by col1 + # - result: [{5}, {13}] # - # # grouping by constant is not yet supported. # - query: select sum(col2) from T1 group by 3; @@ -119,49 +122,61 @@ test_block: - - query: select col1 from (select col1 from t1) as x group by x.col1; - result: [{!l 10}, {!l 20}] - - - - query: select MAX(x.col1) from (select col1 from t1) as x group by x.col1; - - result: [{!l 10}, {!l 20}] - - - - query: select MAX(z) from (select col1 from t1) as x group by x.col1 as z; - - result: [{!l 10}, {!l 20}] - - - - query: select MAX(x.col2) from (select col1,col2 from t1) as x group by x.col1; - - result: [{!l 5}, {!l 13}] - - - - query: select MIN(x.col2) from (select col1,col2 from t1) as x group by x.col1; - - result: [{!l 1}, {!l 6}] - - - - query: select COUNT(x.col2) from (select col1,col2 from t1) as x group by x.col1; - - result: [{!l 5}, {!l 8}] - - - - query: select AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; - - result: [{3.0}, {9.5}] - - - - query: select SUM(x.col2) from (select col1,col2 from t1) as x group by x.col1; - - result: [{!l 15}, {!l 76}] - - + # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) + # - + # - query: select MAX(x.col1) from (select col1 from t1) as x group by x.col1; + # - result: [{!l 10}, {!l 20}] + # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) + # - + # - query: select MAX(z) from (select col1 from t1) as x group by x.col1 as z; + # - result: [{!l 10}, {!l 20}] + # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) + # - + # - query: select MAX(x.col2) from (select col1,col2 from t1) as x group by x.col1; + # - result: [{!l 5}, {!l 13}] + # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) + # - + # - query: select MIN(x.col2) from (select col1,col2 from t1) as x group by x.col1; + # - result: [{!l 1}, {!l 6}] + # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) + # - + # - query: select COUNT(x.col2) from (select col1,col2 from t1) as x group by x.col1; + # - result: [{!l 5}, {!l 8}] + # 4.1 Triage: Test failed when run with forced continuations (Result mismatch) + # - + # - query: select AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; + # - result: [{3.0}, {9.5}] + # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) + # - + # - query: select SUM(x.col2) from (select col1,col2 from t1) as x group by x.col1; + # - result: [{!l 15}, {!l 76}] + # 4.1 Triage: Test failed when run with forced continuations (Result mismatch) + # - # result is correct since we don't use (not support, yet) explicit casting. - - query: select SUM(x.col2) / COUNT(x.col2), AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; - - result: [{!l 3, 3.0}, {!l 9, 9.5}] + # - query: select SUM(x.col2) / COUNT(x.col2), AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; + # - result: [{!l 3, 3.0}, {!l 9, 9.5}] - - query: select MAX(x.col2) from (select col1 from t1) as x group by x.col1; - error: "42703" - - query: select X.col2 from (select col1, col2 from t1) as x group by x.col1; - error: "42803" - - - - query: select MAX(x.col2) from (select col1,col2 from t1) as x; - - result: [{!l 13}] - - - - query: select MIN(x.col2) from (select col1,col2 from t1) as x; - - result: [{!l 1}] - - - - query: select COUNT(x.col2) from (select col1,col2 from t1) as x; - - result: [{!l 13}] - - - - query: select AVG(x.col2) from (select col1,col2 from t1) as x; - - result: [{7.0}] + # 4.1 Triage: Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select MAX(x.col2) from (select col1,col2 from t1) as x; + # - result: [{!l 13}] + # 4.1 Triage: Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select MIN(x.col2) from (select col1,col2 from t1) as x; + # - result: [{!l 1}] + # 4.1 Triage: Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select COUNT(x.col2) from (select col1,col2 from t1) as x; + # - result: [{!l 13}] + # 4.1 Triage: Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select AVG(x.col2) from (select col1,col2 from t1) as x; + # - result: [{7.0}] - - query: select x.col1 + 10 from (select col1 from t1) as x group by x.col1; - result: [{!l 20}, {!l 30}] @@ -171,18 +186,22 @@ test_block: - - query: select x.col1 + x.col1 from (select col1, col2 from t1) as x group by x.col1; - result: [{!l 20}, {!l 40}] - - - - query: select G + 4 from (select MIN(x.col2) as G from (select col1,col2 from t1) as x group by x.col1) as Y where G > 5; - - result: [{!l 10}] - - - - query: select G + 4 from (select MIN(x.col2) as G from (select col1,col2 from t1) as x group by x.col1 as K) as Y where G > 5; - - result: [{!l 10}] - - - - query: select COUNT(*) from T1; - - result: [{!l 13}] - - - - query: select COUNT(col1) from T1; - - result: [{!l 13}] + # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) + # - + # - query: select G + 4 from (select MIN(x.col2) as G from (select col1,col2 from t1) as x group by x.col1) as Y where G > 5; + # - result: [{!l 10}] + # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) + # - + # - query: select G + 4 from (select MIN(x.col2) as G from (select col1,col2 from t1) as x group by x.col1 as K) as Y where G > 5; + # - result: [{!l 10}] + # 4.1 Triage: Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select COUNT(*) from T1; + # - result: [{!l 13}] + # 4.1 Triage: Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select COUNT(col1) from T1; + # - result: [{!l 13}] - - query: select x from t1 group by col1 as x, col2 as x; - error: "42702" From d5b685eab675dbd72ad08f44d39e224e71c1f459 Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 24 Feb 2025 09:39:28 -0700 Subject: [PATCH 06/62] Add 4.1 triage annotations to standard-tests.yamsql --- yaml-tests/src/test/resources/standard-tests.yamsql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yaml-tests/src/test/resources/standard-tests.yamsql b/yaml-tests/src/test/resources/standard-tests.yamsql index ab57f612de..1784b5a046 100644 --- a/yaml-tests/src/test/resources/standard-tests.yamsql +++ b/yaml-tests/src/test/resources/standard-tests.yamsql @@ -83,9 +83,10 @@ test_block: - - query: select * from (select * from (select * from T1) as x) as y where ID = 5; - result: [{ID: !l 5, !l 10, !l 5}] - - - - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; - - result: [{!l 1}] + # 4.1 Triage: Failed running with forced continuations: (Received continuation shouldn't be at beginning) + # - + # - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; + # - result: [{!l 1}] - - query: select * from (select * from (select * from (select * from T1 where ID > 10) as x) as y) as z; - result: [{ID: !l 11, !l 20, !l 11}, {ID: !l 12, !l 20, !l 12}, {ID: !l 13, !l 20, !l 13}] From b0e463ae33cb1fc3790ac2557d8a1b013eb13899 Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 24 Feb 2025 09:43:05 -0700 Subject: [PATCH 07/62] Add 4.1 triage annotations to standard-tests-proto.yamsql --- yaml-tests/src/test/resources/standard-tests-proto.yamsql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yaml-tests/src/test/resources/standard-tests-proto.yamsql b/yaml-tests/src/test/resources/standard-tests-proto.yamsql index 6a64724c6c..c242d5f0d1 100644 --- a/yaml-tests/src/test/resources/standard-tests-proto.yamsql +++ b/yaml-tests/src/test/resources/standard-tests-proto.yamsql @@ -55,9 +55,10 @@ test_block: - - query: select * from (select * from (select * from T1) as x) as y where ID = 5; - result: [{ID: !l 5, !l 10, !l 5}] - - - - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; - - result: [{!l 1}] + # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; + # - result: [{!l 1}] - - query: select * from (select * from (select * from (select * from T1 where ID > 10) as x) as y) as z; - result: [{ID: !l 11, !l 20, !l 11}, {ID: !l 12, !l 20, !l 12}, {ID: !l 13, !l 20, !l 13}] From 7be0ce32fb5830a0a0715b793f34523223cab81f Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 24 Feb 2025 09:46:52 -0700 Subject: [PATCH 08/62] Add 4.1 triage annotations to field-index-tests-proto.yamsql --- .../resources/field-index-tests-proto.yamsql | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/yaml-tests/src/test/resources/field-index-tests-proto.yamsql b/yaml-tests/src/test/resources/field-index-tests-proto.yamsql index f981d28a48..ef74c66ed8 100644 --- a/yaml-tests/src/test/resources/field-index-tests-proto.yamsql +++ b/yaml-tests/src/test/resources/field-index-tests-proto.yamsql @@ -56,18 +56,21 @@ test_block: - - query: select * from (select * from (select * from "MyTable") as x) as y where ID = 5; - result: [{ID: !l 5, COL1: !l 10, COL31: !l 5, COL32: !null _, COL2: !l 5}] - - - - query: select count(*) from (select * from (select * from (select * from "MyTable" where ID = 5) as x) as y) as z; - - result: [{!l 1}] + # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select count(*) from (select * from (select * from (select * from "MyTable" where ID = 5) as x) as y) as z; + # - result: [{!l 1}] - - query: select COL31, COL32 from (select * from (select * from "MyTable") as x) as y where ID = 5; - result: [{COL31: !l 5, COL32: !null _}] - - - - query: select sum(COL1) from "MyTable"; - - result: [{!l 210}] - - - - query: select count(COL1) from "MyTable"; - - result: [{!l 13}] + # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select sum(COL1) from "MyTable"; + # - result: [{!l 210}] + # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select count(COL1) from "MyTable"; + # - result: [{!l 13}] - - query: select * from (select * from (select * from (select * from "MyTable" where ID > 10) as x) as y) as z; - result: [{ID: !l 11, COL1: !l 20, COL31: !null _, COL32: !l 12, COL2: !l 11}, From 10fc852286499d0e0adb63db2afb08acd93e916b Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 24 Feb 2025 09:49:06 -0700 Subject: [PATCH 09/62] Add 4.1 triage annotations to standard-tests-metadata.yamsql --- .../src/test/resources/standard-tests-metadata.yamsql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yaml-tests/src/test/resources/standard-tests-metadata.yamsql b/yaml-tests/src/test/resources/standard-tests-metadata.yamsql index f3ae27077b..c618b5015a 100644 --- a/yaml-tests/src/test/resources/standard-tests-metadata.yamsql +++ b/yaml-tests/src/test/resources/standard-tests-metadata.yamsql @@ -56,9 +56,10 @@ test_block: - - query: select * from (select * from (select * from T1) as x) as y where ID = 5; - result: [{ID: !l 5, !l 10, !l 5}] - - - - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; - - result: [{!l 1}] + # 4.1 Triage: failed running with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; + # - result: [{!l 1}] - - query: select * from (select * from (select * from (select * from T1 where ID > 10) as x) as y) as z; - result: [{ID: !l 11, !l 20, !l 11}, {ID: !l 12, !l 20, !l 12}, {ID: !l 13, !l 20, !l 13}] From 36af5b796b7578cd2f3ace443125790eb5af8a2c Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 24 Feb 2025 09:51:13 -0700 Subject: [PATCH 10/62] Add 4.1 triage annotations to null-operator-tests.yamsql --- yaml-tests/src/test/resources/null-operator-tests.yamsql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yaml-tests/src/test/resources/null-operator-tests.yamsql b/yaml-tests/src/test/resources/null-operator-tests.yamsql index 1856319115..352837cc70 100644 --- a/yaml-tests/src/test/resources/null-operator-tests.yamsql +++ b/yaml-tests/src/test/resources/null-operator-tests.yamsql @@ -45,9 +45,10 @@ test_block: - - query: select * from (select * from (select * from T1) as x where ID is null) as y; - result: [] - - - - query: select count(*) from (select * from (select * from T1) as x where ID is not null) as y; - - unorderedResult: [{13}] + # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select count(*) from (select * from (select * from T1) as x where ID is not null) as y; + # - unorderedResult: [{13}] # - # - query: select count(*) from (select * from (select * from T1) as x where ID != null) as y; # - unorderedResult: [{13}] From b9992f2a6bede0af5c06086b0181c358051d7eca Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 24 Feb 2025 10:07:41 -0700 Subject: [PATCH 11/62] Add 4.1 triage annotations to inserts-updates-deletes.yamsql --- .../test/resources/inserts-updates-deletes.yamsql | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql b/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql index 8ab04feecc..12ff4733ed 100644 --- a/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql +++ b/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql @@ -105,14 +105,16 @@ test_block: - result: [{ B1: 10, B2: 22, B3: { 5, 41 } }, { B1: 20, B2: 22, B3: { 6, 51 } }, { B1: 30, B2: 22, B3: { 7, 61 } } ] - - + # 4.1 Triage: failed when running against 4.0.559.6 (expecting '42601' error code, got 'XXXXX' instead) + # - # Case where not all values are provided of A. Still works, since the columns for which no values are provided can be nullable. - - query: insert into A(A1, A2, A3) values (4); - - error: "42601" - - + # - query: insert into A(A1, A2, A3) values (4); + # - error: "42601" + # 4.1 Triage: Failed when initial version is 4.0.559.6 (expecting statement to throw an error, however it returned a count) + # - # Case when the number of values is more than the number of columns specified. - - query: insert into A(A1, A2, A3) values (5, 6, 7, 8, 9); - - error: "42601" + # - query: insert into A(A1, A2, A3) values (5, 6, 7, 8, 9); + # - error: "42601" - # Case when a nullable column's value is not provided - query: insert into A(A1, A3) values (6, 7); From ac88dcd44bf5d008476d51004d269dd22a352a37 Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 24 Feb 2025 10:28:02 -0700 Subject: [PATCH 12/62] Add 4.1 triage annotations to aggregate-index-tests.yamsql --- .../resources/aggregate-index-tests.yamsql | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/yaml-tests/src/test/resources/aggregate-index-tests.yamsql b/yaml-tests/src/test/resources/aggregate-index-tests.yamsql index b5b8d8868a..a5a4c3dd7a 100644 --- a/yaml-tests/src/test/resources/aggregate-index-tests.yamsql +++ b/yaml-tests/src/test/resources/aggregate-index-tests.yamsql @@ -133,7 +133,8 @@ test_block: # controlling for that, it can still use the index - query: select max(col2) from T1 use index (mv8); - explain: "ISCAN(MV8 <,>) | MAP (_ AS _0) | AGG (max_l(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!l 13}] + # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) + # - result: [{!l 13}] - # Min/max indexes need keep what amounts to a standard value index on their keys (in order to properly look up # the min/max). That index should be usable for normal queries just like a value index. Note that the scan is @@ -148,13 +149,15 @@ test_block: - - query: select min(col3) from T2 group by col1, col2; - explain: "ISCAN(MV2 <,>) | MAP (_ AS _0) | AGG (min_l(_._0.COL3) AS _0) GROUP BY (_._0.COL1 AS _0, _._0.COL2 AS _1) | MAP (_._1._0 AS _0)" - - result: [{!l 1}, {!l 2}, {!l 3}] + # 4.1 Triage: failed when running with forced continuations (result mismatch) + # - result: [{!l 1}, {!l 2}, {!l 3}] - # this should use the aggregate index in the future, for now, it is using streaming aggregate # over base table scan. - query: select max(col2) from t2; - explain: "ISCAN(MV3 <,>) | MAP (_ AS _0) | AGG (max_l(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - result: [{!l 2}] + # 4.1 Triage: failed when running with forced continuations (result mismatch) + # - result: [{!l 2}] - - query: select col1, sum(col2) from T1 USE INDEX (vi1) group by col1; - explain: "ISCAN(VI1 <,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._0._0 AS COL1, _._1._0 AS _1)" @@ -209,11 +212,13 @@ test_block: # Permuted max index can also be used to evaluate other aggregate functions via aggregation and roll-up - query: select col3, sum(col2) as s from t2 use index (mv9) where col1 = 1 group by col1, col3 order by col3 asc; - explain: "ISCAN(MV9 [EQUALS promote(@c20 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0, _._0.COL3 AS _1) | MAP (_._0._1 AS COL3, _._1._0 AS S)" - - result: [{COL3: 1, S: 1}, {COL3: 2, S: 2}, {COL3: 100, S: 1}, {COL3: 200, S: 2}] + # 4.1 Triage: failed when running with forced continuations (result mismatch) + # - result: [{COL3: 1, S: 1}, {COL3: 2, S: 2}, {COL3: 100, S: 1}, {COL3: 200, S: 2}] - - query: select col3, sum(col2) as s from t2 use index (mv9) where col1 = 1 group by col1, col3 order by col3 desc; - explain: "ISCAN(MV9 [EQUALS promote(@c20 AS LONG)] REVERSE) | MAP (_ AS _0) | AGG (sum_l(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0, _._0.COL3 AS _1) | MAP (_._0._1 AS COL3, _._1._0 AS S)" - - result: [{COL3: 200, S: 2}, {COL3: 100, S: 1}, {COL3: 2, S: 2}, {COL3: 1, S: 1}] + # 4.1 Triage: failed when running with forced continuations (result mismatch) + # - result: [{COL3: 200, S: 2}, {COL3: 100, S: 1}, {COL3: 2, S: 2}, {COL3: 1, S: 1}] # - # # grouping by constant is not yet supported. # - query: select sum(col2) from t1 group by 3,2,1; @@ -228,9 +233,10 @@ test_block: - - query: select max_ever(col3) from T2 group by col1, col2; - result: [{!l 100}, {!l 200}, {!l 400}] - - - - query: select min_ever(col3) from t2 - - result: [{!l 1}] + # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select min_ever(col3) from t2 + # - result: [{!l 1}] - - query: select min_ever(col3) from t2 - explain: "AISCAN(MV7 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" From db9dedf7124b6e188b8c5ab2b487c9c834d82acd Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 24 Feb 2025 11:09:44 -0700 Subject: [PATCH 13/62] Add 4.1 triage annotations to aggregate-index-tests-count.yamsql.yamsql --- .../aggregate-index-tests-count.yamsql | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/yaml-tests/src/test/resources/aggregate-index-tests-count.yamsql b/yaml-tests/src/test/resources/aggregate-index-tests-count.yamsql index 1ce95c4add..092607cf73 100644 --- a/yaml-tests/src/test/resources/aggregate-index-tests-count.yamsql +++ b/yaml-tests/src/test/resources/aggregate-index-tests-count.yamsql @@ -47,7 +47,8 @@ test_block: - - query: select count(*) from t1 - explain: "AISCAN(MV1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{4}] + # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) + # - result: [{4}] - - query: select count(*) from t1 group by col2 - explain: "AISCAN(MV2 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" @@ -55,7 +56,8 @@ test_block: - - query: select count(col1) from t1 - explain: "AISCAN(MV3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{2}] + # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) + # - result: [{2}] - - query: select count(col1) from t1 group by col2 - explain: "AISCAN(MV4 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" @@ -81,17 +83,21 @@ test_block: - - query: select count(*) from t2 - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{4}] + # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) + # - result: [{4}] - - query: select count(*) from t2 group by col2 - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)" - - result: [{1}, {3}] + # 4.1 Triage: failed when running with forced continuations (Server-side exception) + # - result: [{1}, {3}] - - query: select count(col1) from t2 - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{2}] + # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) + # - result: [{2}] - - query: select count(col1) from t2 group by col2 - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)" - - result: [{1}, {1}] + # 4.1 Triage: failed when running with forced continuations (server-side error) + # - result: [{1}, {1}] ... From 7593e96b08425f0dd92dab50d3a6e8e361b095c5 Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 24 Feb 2025 11:18:05 -0700 Subject: [PATCH 14/62] Add 4.1 triage annotations to aggregate-index-tests-count-empty.yamsql.yamsql.yamsql --- .../aggregate-index-tests-count-empty.yamsql | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql b/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql index a84d244bcd..3b1951aac0 100644 --- a/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql +++ b/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql @@ -33,7 +33,8 @@ test_block: - - query: select count(*) from t1 - explain: "AISCAN(MV1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: failing when running against 4.0.559.6 (result mismatch) + # - result: [{0}] - - query: select count(*) from t1 group by col2 - explain: "AISCAN(MV2 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" @@ -41,7 +42,8 @@ test_block: - - query: select count(col1) from t1 - explain: "AISCAN(MV3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: failing when running against 4.0.559.6 (result mismatch) + # - result: [{0}] - - query: select count(col1) from t1 group by col2 - explain: "AISCAN(MV4 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" @@ -52,7 +54,8 @@ test_block: - - query: select count(*) from t2 - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: failing when running against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{0}] - - query: select count(*) from t2 group by col2 - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)" @@ -60,7 +63,8 @@ test_block: - - query: select count(col1) from t2 - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - result: [{0}] + # 4.1 Triage: failing when running against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - result: [{0}] - - query: select count(col1) from t2 group by col2 - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)" From ff20e759bfc6aa0967ba9f11c81a514353245bd7 Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 24 Feb 2025 11:22:28 -0700 Subject: [PATCH 15/62] Add 4.1 triage annotations to primary-key-tests.yamsql --- yaml-tests/src/test/resources/primary-key-tests.yamsql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yaml-tests/src/test/resources/primary-key-tests.yamsql b/yaml-tests/src/test/resources/primary-key-tests.yamsql index 6c205e5af7..186440e182 100644 --- a/yaml-tests/src/test/resources/primary-key-tests.yamsql +++ b/yaml-tests/src/test/resources/primary-key-tests.yamsql @@ -31,9 +31,10 @@ test_block: VALUES ((1, 2, 3, 4), 5), ((1, 2, 30, 40), 50) - error: "23505" - - - - query: SELECT COUNT(*) FROM T1 - - result: [{0}] + # 4.1 Triage: failed when running with forced continuations against 4.0.559.6 (Received continuation shouldn't be at beginning) + # - + # - query: SELECT COUNT(*) FROM T1 + # - result: [{0}] - - query: INSERT INTO T1 VALUES ((1, 2, 3, 4), 5), From 85b263e01e41897498c167438ccca88fecebcb3e Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 24 Feb 2025 11:40:51 -0700 Subject: [PATCH 16/62] Add 4.1 triage annotations to boolean.yamsql --- yaml-tests/src/test/resources/boolean.yamsql | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/yaml-tests/src/test/resources/boolean.yamsql b/yaml-tests/src/test/resources/boolean.yamsql index 224e8c53f7..9fa3f526d9 100644 --- a/yaml-tests/src/test/resources/boolean.yamsql +++ b/yaml-tests/src/test/resources/boolean.yamsql @@ -94,18 +94,20 @@ test_block: - - query: select B AND FALSE from lb - result: [ { false }, { false }, { false } ] - - - - query: select B AND NULL from lb - - result: [ { !null }, { false }, { !null } ] + # 4.1 Triage: failing when running with forced continuations (cannot continue query due to mismatch between serialized and actual plan hash) + # - + # - query: select B AND NULL from lb + # - result: [ { !null }, { false }, { !null } ] - - query: select B OR TRUE from lb - result: [ { true }, { true }, { true } ] - - query: select B OR FALSE from lb - result: [ { true }, { false }, { !null } ] - - - - query: select B OR NULL from lb - - result: [ { true }, { !null }, { !null } ] + # 4.1 Triage: failing when running with forced continuations (cannot continue query due to mismatch between serialized and actual plan hash) + # - + # - query: select B OR NULL from lb + # - result: [ { true }, { !null }, { !null } ] - - query: select NOT B from lb - result: [ { false }, { true }, { !null } ] From c303d46f292920ec656cb7a0bde676835a426f13 Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 24 Feb 2025 11:44:57 -0700 Subject: [PATCH 17/62] Add 4.1 triage annotations to catalog.yamsql --- yaml-tests/src/test/resources/catalog.yamsql | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/yaml-tests/src/test/resources/catalog.yamsql b/yaml-tests/src/test/resources/catalog.yamsql index a2d87f0a75..297216bf29 100644 --- a/yaml-tests/src/test/resources/catalog.yamsql +++ b/yaml-tests/src/test/resources/catalog.yamsql @@ -58,19 +58,21 @@ test_block: - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas group by template_name, template_version having template_name = 't') as t; - explainContains: 'AISCAN(TEMPLATES_COUNT_INDEX' - - - - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas - group by template_name, template_version having template_name = 'TEST_TEMPLATE_1') as t; - - result: [{4}] + # 4.1 Triage: failing when running with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas + # group by template_name, template_version having template_name = 'TEST_TEMPLATE_1') as t; + # - result: [{4}] - # How many schemas with the specified schemaTemplateName and schemaTemplateVersion exist in this cluster? - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas group by template_name, template_version having template_name = 't' and template_version = 1) as t; - explainContains: 'AISCAN(TEMPLATES_COUNT_INDEX' - - - - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas - group by template_name, template_version having template_name = 'TEST_TEMPLATE_1' and template_version = 1) as t; - - result: [{4}] + # 4.1 Triage: failing when running with forced continuations (Received continuation shouldn't be at beginning) + # - + # - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas + # group by template_name, template_version having template_name = 'TEST_TEMPLATE_1' and template_version = 1) as t; + # - result: [{4}] - # how many unique templates in a cluster? - query: select count(*) from (select count(*), template_name, template_version from schemas From 1d2da883b6c935fc953a3ab108509ec18634485d Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 24 Feb 2025 12:01:01 -0700 Subject: [PATCH 18/62] Disable forced continuations for updateDeleteReturning --- yaml-tests/src/test/java/YamlIntegrationTests.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yaml-tests/src/test/java/YamlIntegrationTests.java b/yaml-tests/src/test/java/YamlIntegrationTests.java index aaf696e044..5e4ec8a9e6 100644 --- a/yaml-tests/src/test/java/YamlIntegrationTests.java +++ b/yaml-tests/src/test/java/YamlIntegrationTests.java @@ -186,6 +186,8 @@ public void caseWhen(YamlTest.Runner runner) throws Exception { } @TestTemplate + @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, + reason = "Update statements fail with force continuations") public void updateDeleteReturning(YamlTest.Runner runner) throws Exception { runner.runYamsql("update-delete-returning.yamsql"); } From ac8205ede38cd03107be1d8df82805b644114fb7 Mon Sep 17 00:00:00 2001 From: Scott Dugas Date: Mon, 24 Feb 2025 14:41:21 -0500 Subject: [PATCH 19/62] 4.1-triage annotations to enum.yamsql --- yaml-tests/src/test/resources/enum.yamsql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/yaml-tests/src/test/resources/enum.yamsql b/yaml-tests/src/test/resources/enum.yamsql index ad1f281579..ac06880ef6 100644 --- a/yaml-tests/src/test/resources/enum.yamsql +++ b/yaml-tests/src/test/resources/enum.yamsql @@ -16,6 +16,12 @@ # 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. + +# 4.1-triage: enum support was not added to client until 4.1.6.0, none of these queries pass, all with: +# The comparand to a comparison expecting an argument of a primitive type, is invoked with an argument of a complex type, e.g. an array or a record. +--- +options: + supported_version: 4.1.6.0 --- schema_template: CREATE TYPE AS ENUM MOOD ( 'JOYFUL', 'HAPPY', 'RELAXED', 'INDIFFERENT', 'CONFUSED', 'SAD', 'ANXIOUS', 'ANGRY' ) From 31f1e0b3a59c75fc38ca1027cbce5b1c4fe0b4cc Mon Sep 17 00:00:00 2001 From: Scott Dugas Date: Mon, 24 Feb 2025 14:42:29 -0500 Subject: [PATCH 20/62] 4.1-triage annotations to insert-enum.yamsql --- yaml-tests/src/test/resources/insert-enum.yamsql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/yaml-tests/src/test/resources/insert-enum.yamsql b/yaml-tests/src/test/resources/insert-enum.yamsql index 7f26ceba80..b000ae8f16 100644 --- a/yaml-tests/src/test/resources/insert-enum.yamsql +++ b/yaml-tests/src/test/resources/insert-enum.yamsql @@ -16,6 +16,11 @@ # 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. +# 4.1-triage: Enum support wasn't added until 4.1.6.0 All tests fail to insert enums with: +# Caused by: java.sql.SQLException: java.sql.Type=1111 not supported +--- +options: + supported_version: 4.1.6.0 --- schema_template: CREATE TYPE AS ENUM "WHATEVER" ( 'OWNING', 'WEAK', 'VALIDATING' ) From fd9c28111788d670fc10727f08f7c4afc4272382 Mon Sep 17 00:00:00 2001 From: Scott Dugas Date: Mon, 24 Feb 2025 15:21:14 -0500 Subject: [PATCH 21/62] 4.1-triage annotations to like.yamsql --- yaml-tests/src/test/resources/like.yamsql | 176 +++++++++++----------- 1 file changed, 89 insertions(+), 87 deletions(-) diff --git a/yaml-tests/src/test/resources/like.yamsql b/yaml-tests/src/test/resources/like.yamsql index ab12895a6e..d01d1f4a05 100644 --- a/yaml-tests/src/test/resources/like.yamsql +++ b/yaml-tests/src/test/resources/like.yamsql @@ -17,6 +17,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# 4.1 triage: All queries that return any results, fail with force continuations, even against current version +# with: The like operator expects an escape character of length 1. --- schema_template: create table A(a1 string, primary key(a1)) @@ -50,45 +52,45 @@ test_block: - - query: select * from A WHERE A1 LIKE '%abc' - result: [] - - - - query: select * from A WHERE A1 LIKE '%abc%' - - unorderedResult: [ - {'abcdefghijklmnopqrstuvwxyz'}, - {'___abcdef'}, - {'%%abcdef'}, - {'*abcdef'}, - {'(abcdefghijk)'}, - {'[abcdefghijk]'}, - {'{abcdefghijk}'}] - - - - query: select * from A WHERE A1 LIKE '_abc%' - - unorderedResult: [ - {'(abcdefghijk)'}, - {'[abcdefghijk]'}, - {'{abcdefghijk}'}, - {'*abcdef'}] - - - # TODO (Investigate `Missing binding for __const_CONSTANT` error with queries when using plan from cache) - - query: select * from A WHERE A1 LIKE '%ABC%' - - unorderedResult: [{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}] - - - - query: select * from A WHERE A1 LIKE '%ABC%X_Z' - - unorderedResult: [{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}] +# - +# - query: select * from A WHERE A1 LIKE '%abc%' +# - unorderedResult: [ +# {'abcdefghijklmnopqrstuvwxyz'}, +# {'___abcdef'}, +# {'%%abcdef'}, +# {'*abcdef'}, +# {'(abcdefghijk)'}, +# {'[abcdefghijk]'}, +# {'{abcdefghijk}'}] +# - +# - query: select * from A WHERE A1 LIKE '_abc%' +# - unorderedResult: [ +# {'(abcdefghijk)'}, +# {'[abcdefghijk]'}, +# {'{abcdefghijk}'}, +# {'*abcdef'}] +# - +# # TODO (Investigate `Missing binding for __const_CONSTANT` error with queries when using plan from cache) +# - query: select * from A WHERE A1 LIKE '%ABC%' +# - unorderedResult: [{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}] +# - +# - query: select * from A WHERE A1 LIKE '%ABC%X_Z' +# - unorderedResult: [{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}] - - query: select * from A WHERE A1 LIKE '%ABC%XY_Z' - unorderedResult: [] - - - - query: select * from A WHERE A1 LIKE '__' - - unorderedResult: [ - {'学校'}, - {'^$'}] - - - - query: select * from A WHERE A1 LIKE '_____' - - unorderedResult: [ - {'école'}, - {'ありがとう'}, - {'مدرسة'}, - {'\\||%'}] +# - +# - query: select * from A WHERE A1 LIKE '__' +# - unorderedResult: [ +# {'学校'}, +# {'^$'}] +# - +# - query: select * from A WHERE A1 LIKE '_____' +# - unorderedResult: [ +# {'école'}, +# {'ありがとう'}, +# {'مدرسة'}, +# {'\\||%'}] --- # TODO (Investigate `Missing binding for __const_CONSTANT` error with queries when using plan from cache) test_block: @@ -96,61 +98,61 @@ test_block: repetition: 1 check_cache: false tests: - - - - query: select * from A WHERE A1 LIKE '|_|_%' ESCAPE '|' - - result: [{'___abcdef'}] - - - - query: select * from A WHERE A1 LIKE '\_%' ESCAPE '\' - - result: [{'___abcdef'}] - - - - query: select * from A WHERE A1 LIKE '\_%' ESCAPE '|' - - result: [{'\\||%'}] - - - - query: select * from A WHERE A1 LIKE '\_%' - - result: [{'\\||%'}] - - - - query: select * from A WHERE A1 LIKE '\_\_\_abcdef' ESCAPE '\' - - result: [{'___abcdef'}] - - - - query: select * from A WHERE A1 LIKE '\_\_\_______' ESCAPE '\' - - result: [{'___abcdef'}] - - - - query: select * from A WHERE A1 LIKE '\__\_______' ESCAPE '\' - - result: [{'___abcdef'}] +# - +# - query: select * from A WHERE A1 LIKE '|_|_%' ESCAPE '|' +# - result: [{'___abcdef'}] +# - +# - query: select * from A WHERE A1 LIKE '\_%' ESCAPE '\' +# - result: [{'___abcdef'}] +# - +# - query: select * from A WHERE A1 LIKE '\_%' ESCAPE '|' +# - result: [{'\\||%'}] +# - +# - query: select * from A WHERE A1 LIKE '\_%' +# - result: [{'\\||%'}] +# - +# - query: select * from A WHERE A1 LIKE '\_\_\_abcdef' ESCAPE '\' +# - result: [{'___abcdef'}] +# - +# - query: select * from A WHERE A1 LIKE '\_\_\_______' ESCAPE '\' +# - result: [{'___abcdef'}] +# - +# - query: select * from A WHERE A1 LIKE '\__\_______' ESCAPE '\' +# - result: [{'___abcdef'}] - - query: select * from A WHERE A1 LIKE '\__\______\_' ESCAPE '\' - result: [] - - - - query: select * from A WHERE A1 LIKE '%\%' ESCAPE '\' - - result: [{'\\||%'}] - - - - query: select * from A WHERE A1 NOT LIKE '|_|_%' ESCAPE '|' - - unorderedResult: [ - {'abcdefghijklmnopqrstuvwxyz'}, - {'%%abcdef'}, - {'*abcdef'}, - {'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}, - {'école'}, - {'ありがとう'}, - {'学校'}, - {'مدرسة'}, - {'(abcdefghijk)'}, - {'[abcdefghijk]'}, - {'{abcdefghijk}'}, - {'^$'}, - {'\\||%'} - ] +# - +# - query: select * from A WHERE A1 LIKE '%\%' ESCAPE '\' +# - result: [{'\\||%'}] +# - +# - query: select * from A WHERE A1 NOT LIKE '|_|_%' ESCAPE '|' +# - unorderedResult: [ +# {'abcdefghijklmnopqrstuvwxyz'}, +# {'%%abcdef'}, +# {'*abcdef'}, +# {'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}, +# {'école'}, +# {'ありがとう'}, +# {'学校'}, +# {'مدرسة'}, +# {'(abcdefghijk)'}, +# {'[abcdefghijk]'}, +# {'{abcdefghijk}'}, +# {'^$'}, +# {'\\||%'} +# ] - - query: select * from A WHERE A1 NOT LIKE '%' - unorderedResult: [] - - - - query: select * from A WHERE A1 NOT LIKE '%abcde%' - - unorderedResult: [ - {'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}, - {'école'}, - {'ありがとう'}, - {'学校'}, - {'مدرسة'}, - {'^$'}, - {'\\||%'} ] +# - +# - query: select * from A WHERE A1 NOT LIKE '%abcde%' +# - unorderedResult: [ +# {'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}, +# {'école'}, +# {'ありがとう'}, +# {'学校'}, +# {'مدرسة'}, +# {'^$'}, +# {'\\||%'} ] ... From aecd1e209cdafce16695c3166a840efee99593fd Mon Sep 17 00:00:00 2001 From: Scott Dugas Date: Mon, 24 Feb 2025 16:10:51 -0500 Subject: [PATCH 22/62] 4.1-triage annotations to create-drop.yamsql --- .../src/test/resources/create-drop.yamsql | 265 +++++++++++------- 1 file changed, 160 insertions(+), 105 deletions(-) diff --git a/yaml-tests/src/test/resources/create-drop.yamsql b/yaml-tests/src/test/resources/create-drop.yamsql index 66aa7a0838..2fcbad6032 100644 --- a/yaml-tests/src/test/resources/create-drop.yamsql +++ b/yaml-tests/src/test/resources/create-drop.yamsql @@ -43,134 +43,179 @@ setup: - query: drop schema template if exists temp - query: drop database if exists /frl/DB - query: create schema template temp1 create table T1(a1 bigint, primary key(a1)) ---- -test_block: - connect: "jdbc:embed:/__SYS?schema=CATALOG" - preset: single_repetition_ordered - tests: - - - - query: select count(*) from "TEMPLATES" where template_name = 'TEMP1' - - result: [{1}] + +# 4.1 triage: Fails with force continuations for all versions with: +# Received continuation shouldn't be at beginning +#--- +#test_block: +# connect: "jdbc:embed:/__SYS?schema=CATALOG" +# preset: single_repetition_ordered +# tests: +# - +# - query: select count(*) from "TEMPLATES" where template_name = 'TEMP1' +# - result: [{1}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop schema template temp1 ---- -test_block: - connect: "jdbc:embed:/__SYS?schema=CATALOG" - preset: single_repetition_ordered - tests: - - - - query: select count(*) from "TEMPLATES" where template_name = 'TEMP1' - - result: [{0}] +# 4.1 triage: Fails with force continuations (Does not fail with SNAPSHOT) +# Embedded -> 4.0.559.6: +# Received continuation shouldn't be at beginning +# 4.0.559.6 -> Embedded: +# expected: but was: +# org.opentest4j.AssertionFailedError: expected: but was: +# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementWithForcedContinuations(QueryExecutor.java:258) +# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementAndCheckForceContinuations(QueryExecutor.java:219) +#--- +#test_block: +# connect: "jdbc:embed:/__SYS?schema=CATALOG" +# preset: single_repetition_ordered +# tests: +# - +# - query: select count(*) from "TEMPLATES" where template_name = 'TEMP1' +# - result: [{0}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create schema template temp2 create table T1(a1 bigint, primary key(a1)) ---- -test_block: - connect: "jdbc:embed:/__SYS?schema=CATALOG" - preset: single_repetition_ordered - tests: - - - - query: select count(*) from "TEMPLATES" where template_name = 'TEMP2' - - result: [{1}] +# 4.1 triage: Fails with force continuations for all versions (including SNAPSHOT): +# Received continuation shouldn't be at beginning +#--- +#test_block: +# connect: "jdbc:embed:/__SYS?schema=CATALOG" +# preset: single_repetition_ordered +# tests: +# - +# - query: select count(*) from "TEMPLATES" where template_name = 'TEMP2' +# - result: [{1}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create database /frl/db ---- -test_block: - connect: "jdbc:embed:/__SYS?schema=CATALOG" - preset: single_repetition_ordered - tests: - - - - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' - - result: [{1}] +# 4.1 triage: Fails with force continuations for all versions (including SNAPSHOT): +# Received continuation shouldn't be at beginning +#--- +#test_block: +# connect: "jdbc:embed:/__SYS?schema=CATALOG" +# preset: single_repetition_ordered +# tests: +# - +# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' +# - result: [{1}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database /frl/db ---- -test_block: - connect: "jdbc:embed:/__SYS?schema=CATALOG" - preset: single_repetition_ordered - tests: - - - - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' - - result: [{0}] +# 4.1 triage: Fails with force continuations (but not for snapshot) +# Embedded -> 4.0.559.6: +# Received continuation shouldn't be at beginning +# 4.0.559.6 -> Embedded: +# expected: but was: +# org.opentest4j.AssertionFailedError: expected: but was: +# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementWithForcedContinuations(QueryExecutor.java:258) +# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementAndCheckForceContinuations(QueryExecutor.java:219) +#--- +#test_block: +# connect: "jdbc:embed:/__SYS?schema=CATALOG" +# preset: single_repetition_ordered +# tests: +# - +# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' +# - result: [{0}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create database /frl/db ---- -test_block: - connect: "jdbc:embed:/__SYS?schema=CATALOG" - preset: single_repetition_ordered - tests: - - - - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' - - result: [{1}] +# 4.1 triage: Fails with force continuations for all versions (including SNAPSHOT): +# Received continuation shouldn't be at beginning +#--- +#test_block: +# connect: "jdbc:embed:/__SYS?schema=CATALOG" +# preset: single_repetition_ordered +# tests: +# - +# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' +# - result: [{1}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database if exists /frl/db ---- -test_block: - connect: "jdbc:embed:/__SYS?schema=CATALOG" - preset: single_repetition_ordered - tests: - - - - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' - - result: [{0}] +# 4.1 triage: Fails with force continuations (but not for snapshot) +# Embedded -> 4.0.559.6: +# expected: but was: +# org.opentest4j.AssertionFailedError: expected: but was: +# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementWithForcedContinuations(QueryExecutor.java:258) +# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementAndCheckForceContinuations(QueryExecutor.java:219) +# 4.0.559.6 -> Embedded: +# Received continuation shouldn't be at beginning +#--- +#test_block: +# connect: "jdbc:embed:/__SYS?schema=CATALOG" +# preset: single_repetition_ordered +# tests: +# - +# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' +# - result: [{0}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create database /frl/db ---- -test_block: - connect: "jdbc:embed:/__SYS?schema=CATALOG" - preset: single_repetition_ordered - tests: - - - - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' - - result: [{1}] +# 4.1 triage: Fails with force continuations for all versions (including SNAPSHOT): +# Received continuation shouldn't be at beginning +#--- +#test_block: +# connect: "jdbc:embed:/__SYS?schema=CATALOG" +# preset: single_repetition_ordered +# tests: +# - +# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' +# - result: [{1}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create schema /frl/db/s1 with template temp2 ---- -test_block: - connect: "jdbc:embed:/__SYS?schema=CATALOG" - preset: single_repetition_ordered - tests: - - - - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' - - result: [{1}] +# 4.1 triage: Fails with force continuations for all versions (including SNAPSHOT): +# Received continuation shouldn't be at beginning +#--- +#test_block: +# connect: "jdbc:embed:/__SYS?schema=CATALOG" +# preset: single_repetition_ordered +# tests: +# - +# - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' +# - result: [{1}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database /frl/db ---- -test_block: - connect: "jdbc:embed:/__SYS?schema=CATALOG" - preset: single_repetition_ordered - tests: - - - - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' - - result: [{0}] - - - - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' - - result: [{0}] +# 4.1 triage: Both queries fail with force continuations (but not for snapshot) +# Embedded -> 4.0.559.6: +# Received continuation shouldn't be at beginning +# 4.0.559.6 -> Embedded: +# expected: but was: +# org.opentest4j.AssertionFailedError: expected: but was: +# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementWithForcedContinuations(QueryExecutor.java:258) +# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementAndCheckForceContinuations(QueryExecutor.java:219) +#--- +#test_block: +# connect: "jdbc:embed:/__SYS?schema=CATALOG" +# preset: single_repetition_ordered +# tests: +# - +# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' +# - result: [{0}] +# - +# - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' +# - result: [{0}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" @@ -179,33 +224,43 @@ setup: - query: create database /frl/db - query: create schema /frl/db/s1 with template temp2 - query: create schema /frl/db/s2 with template temp2 ---- -test_block: - connect: "jdbc:embed:/__SYS?schema=CATALOG" - preset: single_repetition_ordered - tests: - - - - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' - - result: [{1}] - - - - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' - - result: [{2}] +# 4.1 triage: Both queries fail with force continuations for all versions (including SNAPSHOT): +# Received continuation shouldn't be at beginning +#--- +#test_block: +# connect: "jdbc:embed:/__SYS?schema=CATALOG" +# preset: single_repetition_ordered +# tests: +# - +# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' +# - result: [{1}] +# - +# - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' +# - result: [{2}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database /frl/db ---- -test_block: - connect: "jdbc:embed:/__SYS?schema=CATALOG" - preset: single_repetition_ordered - tests: - - - - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' - - result: [{0}] - - - - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' - - result: [{0}] +# 4.1 triage: Both queries fail with force continuations (but not for snapshot) +# Embedded -> 4.0.559.6: +# Received continuation shouldn't be at beginning +# 4.0.559.6 -> Embedded: +# expected: but was: +# org.opentest4j.AssertionFailedError: expected: but was: +# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementWithForcedContinuations(QueryExecutor.java:258) +# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementAndCheckForceContinuations(QueryExecutor.java:219) +#--- +#test_block: +# connect: "jdbc:embed:/__SYS?schema=CATALOG" +# preset: single_repetition_ordered +# tests: +# - +# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' +# - result: [{0}] +# - +# - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' +# - result: [{0}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" From ecb4d3a5d57d3604749f81bf72ee9274cd1a1c7c Mon Sep 17 00:00:00 2001 From: Scott Dugas Date: Mon, 24 Feb 2025 16:22:07 -0500 Subject: [PATCH 23/62] 4.1-triage annotations to functions.yamsql --- .../src/test/resources/functions.yamsql | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/yaml-tests/src/test/resources/functions.yamsql b/yaml-tests/src/test/resources/functions.yamsql index 497fc98b2f..9b6e65b818 100644 --- a/yaml-tests/src/test/resources/functions.yamsql +++ b/yaml-tests/src/test/resources/functions.yamsql @@ -48,6 +48,7 @@ test_block: - - query: select greatest(a6, a6) from A - error: '22F00' + # Note: the following query has been disabled since July 2023 # - # - query: select greatest(a7, 0), greatest(a7, 1), greatest(a7, 2), greatest(a7, null) from A # - result: [{_0: 1.0, _1: 1.0, _2: 2.0, !null _}] @@ -78,6 +79,7 @@ test_block: - - query: select least(a6, a6) from A - error: '22F00' + # Note: the following query has been disabled since July 2023 # - # - query: select least(a7, 0), least(a7, 1), least(a7, 2), least(a7, null) from A # - result: [{_0: 0.0, _1: 1.0, _2: 1.0, !null _}] @@ -90,9 +92,11 @@ test_block: - - query: select least(a1, a2, a8), least(1, 2, 3.0, 4, 5) from A - result: [{_0: 1.0, _1: 1.0}] - - - - query: select coalesce(null, null, 5), coalesce(null, 1, null), coalesce(null, a1, a8) from A - - result: [{_0: 5, _1: 1, _2: 1.0}] + # 4.1 triage: Fails with force continuations for all versions with (including snapshot): + # cannot continue query due to mismatch between serialized and actual plan hash +# - +# - query: select coalesce(null, null, 5), coalesce(null, 1, null), coalesce(null, a1, a8) from A +# - result: [{_0: 5, _1: 1, _2: 1.0}] - - query: select b1, b2, coalesce(b1, b2, 42) from B - unorderedResult: [ @@ -121,13 +125,15 @@ test_block: {{ T1: 3, A: 'c', B: 3.0}}, {{ T1: 4, A: 'd', B: 4.0}}, {!null _}] - - - - query: select coalesce(null, (1, 1.0, 'a', true)) from C - - unorderedResult: [ - {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, - {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, - {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, - {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}] + # 4.1 triage: Fails with force continuations for all versions with (including snapshot): + # cannot continue query due to mismatch between serialized and actual plan hash +# - +# - query: select coalesce(null, (1, 1.0, 'a', true)) from C +# - unorderedResult: [ +# {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, +# {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, +# {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, +# {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}] --- test_block: preset: single_repetition_ordered From e4b9626f710818cfad98334144d685099c179d34 Mon Sep 17 00:00:00 2001 From: ohad Date: Mon, 24 Feb 2025 14:41:59 -0700 Subject: [PATCH 24/62] annotate recursive-cte.yamsql --- yaml-tests/src/test/resources/recursive-cte.yamsql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yaml-tests/src/test/resources/recursive-cte.yamsql b/yaml-tests/src/test/resources/recursive-cte.yamsql index 45e6b167f3..df3d2fd6bc 100644 --- a/yaml-tests/src/test/resources/recursive-cte.yamsql +++ b/yaml-tests/src/test/resources/recursive-cte.yamsql @@ -1,4 +1,7 @@ --- +options: + supported_version: 4.1.6.0 +--- schema_template: create table t1(id bigint, parent bigint, primary key(id)) create index parentIdx as select parent, id from t1 order by parent, id From c1fa4868df7c69038abad8406c61bc4b9b2c95db Mon Sep 17 00:00:00 2001 From: ohad Date: Wed, 26 Feb 2025 11:58:40 -0700 Subject: [PATCH 25/62] Triage: - Received continuation shouldn't be at beginning - Initial version --- .../aggregate-index-tests-count-empty.yamsql | 3 +- .../resources/bitmap-aggregate-index.yamsql | 4 +- yaml-tests/src/test/resources/boolean.yamsql | 4 +- yaml-tests/src/test/resources/catalog.yamsql | 4 +- .../src/test/resources/create-drop.yamsql | 27 ++++++---- .../resources/field-index-tests-proto.yamsql | 27 +++++----- .../src/test/resources/groupby-tests.yamsql | 54 ++++++++++--------- .../test/resources/null-operator-tests.yamsql | 9 ++-- .../test/resources/primary-key-tests.yamsql | 9 ++-- .../resources/standard-tests-metadata.yamsql | 9 ++-- .../resources/standard-tests-proto.yamsql | 9 ++-- .../src/test/resources/standard-tests.yamsql | 9 ++-- 12 files changed, 94 insertions(+), 74 deletions(-) diff --git a/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql b/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql index 3b1951aac0..95379e4492 100644 --- a/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql +++ b/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql @@ -33,7 +33,8 @@ test_block: - - query: select count(*) from t1 - explain: "AISCAN(MV1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: failing when running against 4.0.559.6 (result mismatch) + # 4.1 Triage: [No Fix Necessary] failing when running against 4.0.559.6 (result mismatch) + # Triage Note: 4.2.9.0 to 4.0.559.6 works correctly, need to write a test to verify # - result: [{0}] - - query: select count(*) from t1 group by col2 diff --git a/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql b/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql index fb70237f84..787122d10f 100644 --- a/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql +++ b/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql @@ -70,12 +70,12 @@ test_block: - - query: SELECT bitmap_construct_agg(bitmap_bit_position(id)) as bitmap, bitmap_bucket_offset(id) as offset FROM T2 GROUP BY bitmap_bucket_offset(id) - explain: "ISCAN(AGG_INDEX_1 <,>) | MAP (_ AS _0) | AGG (bitmap_construct_agg_l((_._0.ID) bitmap_bit_position 10000) AS _0) GROUP BY ((_._0.ID) bitmap_bucket_offset 10000 AS _0) | MAP (_._1._0 AS BITMAP, _._0._0 AS OFFSET)" - # 4.1 Triage: this fails with continuation tests against 4.0.559.6. Wrong results + # 4.1 Triage: [Initial version] this fails with continuation tests against 4.0.559.6. Wrong results # - unorderedResult: [{BITMAP: xStartsWith_1250'060000c', 'OFFSET':0}, {BITMAP: xStartsWith_1250'02', 'OFFSET':10000}] - - query: SELECT bitmap_construct_agg(bitmap_bit_position(id)) as bitmap, category, bitmap_bucket_offset(id) as offset FROM T2 GROUP BY category, bitmap_bucket_offset(id) - explain: "ISCAN(AGG_INDEX_2 <,>) | MAP (_ AS _0) | AGG (bitmap_construct_agg_l((_._0.ID) bitmap_bit_position 10000) AS _0) GROUP BY (_._0.CATEGORY AS _0, (_._0.ID) bitmap_bucket_offset 10000 AS _1) | MAP (_._1._0 AS BITMAP, _._0._0 AS CATEGORY, _._0._1 AS OFFSET)" - # 4.1 Triage: this fails with continuation tests against 4.0.559.6. Wrong results + # 4.1 Triage: [Initial version] this fails with continuation tests against 4.0.559.6. Wrong results # - unorderedResult: [{BITMAP: xStartsWith_1250'0200004', 'CATEGORY': 'hello', 'OFFSET':0}, # {BITMAP: xStartsWith_1250'02', 'CATEGORY': 'hello', 'OFFSET':10000}, # {BITMAP: xStartsWith_1250'0400008', 'CATEGORY': 'world', 'OFFSET':0}] diff --git a/yaml-tests/src/test/resources/boolean.yamsql b/yaml-tests/src/test/resources/boolean.yamsql index 9fa3f526d9..0ff8f1e2d4 100644 --- a/yaml-tests/src/test/resources/boolean.yamsql +++ b/yaml-tests/src/test/resources/boolean.yamsql @@ -94,7 +94,7 @@ test_block: - - query: select B AND FALSE from lb - result: [ { false }, { false }, { false } ] - # 4.1 Triage: failing when running with forced continuations (cannot continue query due to mismatch between serialized and actual plan hash) + # 4.1 Triage: [Deferred: literal null issue] failing when running with forced continuations (cannot continue query due to mismatch between serialized and actual plan hash) # - # - query: select B AND NULL from lb # - result: [ { !null }, { false }, { !null } ] @@ -104,7 +104,7 @@ test_block: - - query: select B OR FALSE from lb - result: [ { true }, { false }, { !null } ] - # 4.1 Triage: failing when running with forced continuations (cannot continue query due to mismatch between serialized and actual plan hash) + # 4.1 Triage: [Deferred: literal null issue] failing when running with forced continuations (cannot continue query due to mismatch between serialized and actual plan hash) # - # - query: select B OR NULL from lb # - result: [ { true }, { !null }, { !null } ] diff --git a/yaml-tests/src/test/resources/catalog.yamsql b/yaml-tests/src/test/resources/catalog.yamsql index 297216bf29..5d8d388aca 100644 --- a/yaml-tests/src/test/resources/catalog.yamsql +++ b/yaml-tests/src/test/resources/catalog.yamsql @@ -58,7 +58,7 @@ test_block: - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas group by template_name, template_version having template_name = 't') as t; - explainContains: 'AISCAN(TEMPLATES_COUNT_INDEX' - # 4.1 Triage: failing when running with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Not failing in CK] failing when running with forced continuations (Received continuation shouldn't be at beginning) # - # - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas # group by template_name, template_version having template_name = 'TEST_TEMPLATE_1') as t; @@ -68,7 +68,7 @@ test_block: - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas group by template_name, template_version having template_name = 't' and template_version = 1) as t; - explainContains: 'AISCAN(TEMPLATES_COUNT_INDEX' - # 4.1 Triage: failing when running with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Not failing in CK] failing when running with forced continuations (Received continuation shouldn't be at beginning) # - # - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas # group by template_name, template_version having template_name = 'TEST_TEMPLATE_1' and template_version = 1) as t; diff --git a/yaml-tests/src/test/resources/create-drop.yamsql b/yaml-tests/src/test/resources/create-drop.yamsql index 2fcbad6032..5892c380e2 100644 --- a/yaml-tests/src/test/resources/create-drop.yamsql +++ b/yaml-tests/src/test/resources/create-drop.yamsql @@ -44,7 +44,7 @@ setup: - query: drop database if exists /frl/DB - query: create schema template temp1 create table T1(a1 bigint, primary key(a1)) -# 4.1 triage: Fails with force continuations for all versions with: +# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations for all versions with: # Received continuation shouldn't be at beginning #--- #test_block: @@ -59,9 +59,10 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop schema template temp1 -# 4.1 triage: Fails with force continuations (Does not fail with SNAPSHOT) +# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations (Does not fail with SNAPSHOT) # Embedded -> 4.0.559.6: # Received continuation shouldn't be at beginning +# 4.1 Triage: fails with force continuations (Does not fail with SNAPSHOT) # 4.0.559.6 -> Embedded: # expected: but was: # org.opentest4j.AssertionFailedError: expected: but was: @@ -80,7 +81,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create schema template temp2 create table T1(a1 bigint, primary key(a1)) -# 4.1 triage: Fails with force continuations for all versions (including SNAPSHOT): +# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations for all versions (including SNAPSHOT): # Received continuation shouldn't be at beginning #--- #test_block: @@ -95,7 +96,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create database /frl/db -# 4.1 triage: Fails with force continuations for all versions (including SNAPSHOT): +# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations for all versions (including SNAPSHOT): # Received continuation shouldn't be at beginning #--- #test_block: @@ -110,9 +111,10 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database /frl/db -# 4.1 triage: Fails with force continuations (but not for snapshot) +# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations (but not for snapshot) # Embedded -> 4.0.559.6: # Received continuation shouldn't be at beginning +# 4.1 triage: Fails with force continuations (but not for snapshot) # 4.0.559.6 -> Embedded: # expected: but was: # org.opentest4j.AssertionFailedError: expected: but was: @@ -131,7 +133,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create database /frl/db -# 4.1 triage: Fails with force continuations for all versions (including SNAPSHOT): +# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations for all versions (including SNAPSHOT): # Received continuation shouldn't be at beginning #--- #test_block: @@ -152,6 +154,7 @@ setup: # org.opentest4j.AssertionFailedError: expected: but was: # at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementWithForcedContinuations(QueryExecutor.java:258) # at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementAndCheckForceContinuations(QueryExecutor.java:219) +# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations (but not for snapshot) # 4.0.559.6 -> Embedded: # Received continuation shouldn't be at beginning #--- @@ -167,7 +170,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create database /frl/db -# 4.1 triage: Fails with force continuations for all versions (including SNAPSHOT): +# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations for all versions (including SNAPSHOT): # Received continuation shouldn't be at beginning #--- #test_block: @@ -182,7 +185,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create schema /frl/db/s1 with template temp2 -# 4.1 triage: Fails with force continuations for all versions (including SNAPSHOT): +# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations for all versions (including SNAPSHOT): # Received continuation shouldn't be at beginning #--- #test_block: @@ -197,9 +200,10 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database /frl/db -# 4.1 triage: Both queries fail with force continuations (but not for snapshot) +# 4.1 triage: [Deferred: Not failing in CK] Both queries fail with force continuations (but not for snapshot) # Embedded -> 4.0.559.6: # Received continuation shouldn't be at beginning +# 4.1 triage: Both queries fail with force continuations (but not for snapshot) # 4.0.559.6 -> Embedded: # expected: but was: # org.opentest4j.AssertionFailedError: expected: but was: @@ -224,7 +228,7 @@ setup: - query: create database /frl/db - query: create schema /frl/db/s1 with template temp2 - query: create schema /frl/db/s2 with template temp2 -# 4.1 triage: Both queries fail with force continuations for all versions (including SNAPSHOT): +# 4.1 triage: [Deferred: Not failing in CK] Both queries fail with force continuations for all versions (including SNAPSHOT): # Received continuation shouldn't be at beginning #--- #test_block: @@ -242,9 +246,10 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database /frl/db -# 4.1 triage: Both queries fail with force continuations (but not for snapshot) +# 4.1 triage: [Deferred: Not failing in CK] Both queries fail with force continuations (but not for snapshot) # Embedded -> 4.0.559.6: # Received continuation shouldn't be at beginning +# 4.1 triage: Both queries fail with force continuations (but not for snapshot) # 4.0.559.6 -> Embedded: # expected: but was: # org.opentest4j.AssertionFailedError: expected: but was: diff --git a/yaml-tests/src/test/resources/field-index-tests-proto.yamsql b/yaml-tests/src/test/resources/field-index-tests-proto.yamsql index ef74c66ed8..c65a29fc5c 100644 --- a/yaml-tests/src/test/resources/field-index-tests-proto.yamsql +++ b/yaml-tests/src/test/resources/field-index-tests-proto.yamsql @@ -56,21 +56,24 @@ test_block: - - query: select * from (select * from (select * from "MyTable") as x) as y where ID = 5; - result: [{ID: !l 5, COL1: !l 10, COL31: !l 5, COL32: !null _, COL2: !l 5}] - # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select count(*) from (select * from (select * from (select * from "MyTable" where ID = 5) as x) as y) as z; - # - result: [{!l 1}] + # 4.1 Triage: [Deferred: Not failing in CK] failed when running with forced continuations (Received continuation shouldn't be at beginning) + - + - query: select count(*) from (select * from (select * from (select * from "MyTable" where ID = 5) as x) as y) as z; + - maxRows: 0 + - result: [{!l 1}] - - query: select COL31, COL32 from (select * from (select * from "MyTable") as x) as y where ID = 5; - result: [{COL31: !l 5, COL32: !null _}] - # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select sum(COL1) from "MyTable"; - # - result: [{!l 210}] - # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select count(COL1) from "MyTable"; - # - result: [{!l 13}] + # 4.1 Triage: [Deferred: Not failing in CK] failed when running with forced continuations (Received continuation shouldn't be at beginning) + - + - query: select sum(COL1) from "MyTable"; + - maxRows: 0 + - result: [{!l 210}] + # 4.1 Triage: [Deferred: Not failing in CK] failed when running with forced continuations (Received continuation shouldn't be at beginning) + - + - query: select count(COL1) from "MyTable"; + - maxRows: 0 + - result: [{!l 13}] - - query: select * from (select * from (select * from (select * from "MyTable" where ID > 10) as x) as y) as z; - result: [{ID: !l 11, COL1: !l 20, COL31: !null _, COL32: !l 12, COL2: !l 11}, diff --git a/yaml-tests/src/test/resources/groupby-tests.yamsql b/yaml-tests/src/test/resources/groupby-tests.yamsql index 9bcb0198df..4c7d528195 100644 --- a/yaml-tests/src/test/resources/groupby-tests.yamsql +++ b/yaml-tests/src/test/resources/groupby-tests.yamsql @@ -161,22 +161,26 @@ test_block: - - query: select X.col2 from (select col1, col2 from t1) as x group by x.col1; - error: "42803" - # 4.1 Triage: Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select MAX(x.col2) from (select col1,col2 from t1) as x; - # - result: [{!l 13}] - # 4.1 Triage: Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select MIN(x.col2) from (select col1,col2 from t1) as x; - # - result: [{!l 1}] - # 4.1 Triage: Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select COUNT(x.col2) from (select col1,col2 from t1) as x; - # - result: [{!l 13}] - # 4.1 Triage: Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select AVG(x.col2) from (select col1,col2 from t1) as x; - # - result: [{7.0}] + # 4.1 Triage: [Deferred: Not failing in CK] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + - + - query: select MAX(x.col2) from (select col1,col2 from t1) as x; + - maxRows: 0 + - result: [{!l 13}] + # 4.1 Triage: [Deferred: Not failing in CK] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + - + - query: select MIN(x.col2) from (select col1,col2 from t1) as x; + - maxRows: 0 + - result: [{!l 1}] + # 4.1 Triage: [Deferred: Not failing in CK] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + - + - query: select COUNT(x.col2) from (select col1,col2 from t1) as x; + - maxRows: 0 + - result: [{!l 13}] + # 4.1 Triage: [Deferred: Not failing in CK] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + - + - query: select AVG(x.col2) from (select col1,col2 from t1) as x; + - maxRows: 0 + - result: [{7.0}] - - query: select x.col1 + 10 from (select col1 from t1) as x group by x.col1; - result: [{!l 20}, {!l 30}] @@ -194,14 +198,16 @@ test_block: # - # - query: select G + 4 from (select MIN(x.col2) as G from (select col1,col2 from t1) as x group by x.col1 as K) as Y where G > 5; # - result: [{!l 10}] - # 4.1 Triage: Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select COUNT(*) from T1; - # - result: [{!l 13}] - # 4.1 Triage: Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select COUNT(col1) from T1; - # - result: [{!l 13}] + # 4.1 Triage: [Deferred: Not failing in CK] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + - + - query: select COUNT(*) from T1; + - maxRows: 0 + - result: [{!l 13}] + # 4.1 Triage: [Deferred: Not failing in CK] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + - + - query: select COUNT(col1) from T1; + - maxRows: 0 + - result: [{!l 13}] - - query: select x from t1 group by col1 as x, col2 as x; - error: "42702" diff --git a/yaml-tests/src/test/resources/null-operator-tests.yamsql b/yaml-tests/src/test/resources/null-operator-tests.yamsql index 352837cc70..38153a4d13 100644 --- a/yaml-tests/src/test/resources/null-operator-tests.yamsql +++ b/yaml-tests/src/test/resources/null-operator-tests.yamsql @@ -45,10 +45,11 @@ test_block: - - query: select * from (select * from (select * from T1) as x where ID is null) as y; - result: [] - # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select count(*) from (select * from (select * from T1) as x where ID is not null) as y; - # - unorderedResult: [{13}] + # 4.1 Triage: [Deferred: Not failing in CK] failed when running with forced continuations (Received continuation shouldn't be at beginning) + - + - query: select count(*) from (select * from (select * from T1) as x where ID is not null) as y; + - maxRows: 0 + - unorderedResult: [{13}] # - # - query: select count(*) from (select * from (select * from T1) as x where ID != null) as y; # - unorderedResult: [{13}] diff --git a/yaml-tests/src/test/resources/primary-key-tests.yamsql b/yaml-tests/src/test/resources/primary-key-tests.yamsql index 186440e182..e0fe36a5c9 100644 --- a/yaml-tests/src/test/resources/primary-key-tests.yamsql +++ b/yaml-tests/src/test/resources/primary-key-tests.yamsql @@ -31,10 +31,11 @@ test_block: VALUES ((1, 2, 3, 4), 5), ((1, 2, 30, 40), 50) - error: "23505" - # 4.1 Triage: failed when running with forced continuations against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - - # - query: SELECT COUNT(*) FROM T1 - # - result: [{0}] + # 4.1 Triage: [Deferred: Not failing in CK] failed when running with forced continuations against 4.0.559.6 (Received continuation shouldn't be at beginning) + - + - query: SELECT COUNT(*) FROM T1 + - maxRows: 0 + - result: [{0}] - - query: INSERT INTO T1 VALUES ((1, 2, 3, 4), 5), diff --git a/yaml-tests/src/test/resources/standard-tests-metadata.yamsql b/yaml-tests/src/test/resources/standard-tests-metadata.yamsql index c618b5015a..07d14d8e93 100644 --- a/yaml-tests/src/test/resources/standard-tests-metadata.yamsql +++ b/yaml-tests/src/test/resources/standard-tests-metadata.yamsql @@ -56,10 +56,11 @@ test_block: - - query: select * from (select * from (select * from T1) as x) as y where ID = 5; - result: [{ID: !l 5, !l 10, !l 5}] - # 4.1 Triage: failed running with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; - # - result: [{!l 1}] + # 4.1 Triage: [Deferred: Not failing in CK] failed running with forced continuations (Received continuation shouldn't be at beginning) + - + - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; + - maxRows: 0 + - result: [{!l 1}] - - query: select * from (select * from (select * from (select * from T1 where ID > 10) as x) as y) as z; - result: [{ID: !l 11, !l 20, !l 11}, {ID: !l 12, !l 20, !l 12}, {ID: !l 13, !l 20, !l 13}] diff --git a/yaml-tests/src/test/resources/standard-tests-proto.yamsql b/yaml-tests/src/test/resources/standard-tests-proto.yamsql index c242d5f0d1..ae4064d148 100644 --- a/yaml-tests/src/test/resources/standard-tests-proto.yamsql +++ b/yaml-tests/src/test/resources/standard-tests-proto.yamsql @@ -55,10 +55,11 @@ test_block: - - query: select * from (select * from (select * from T1) as x) as y where ID = 5; - result: [{ID: !l 5, !l 10, !l 5}] - # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; - # - result: [{!l 1}] + # 4.1 Triage: [Deferred: Not failing in CK] failed when running with forced continuations (Received continuation shouldn't be at beginning) + - + - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; + - maxRows: 0 + - result: [{!l 1}] - - query: select * from (select * from (select * from (select * from T1 where ID > 10) as x) as y) as z; - result: [{ID: !l 11, !l 20, !l 11}, {ID: !l 12, !l 20, !l 12}, {ID: !l 13, !l 20, !l 13}] diff --git a/yaml-tests/src/test/resources/standard-tests.yamsql b/yaml-tests/src/test/resources/standard-tests.yamsql index 1784b5a046..fc91678c86 100644 --- a/yaml-tests/src/test/resources/standard-tests.yamsql +++ b/yaml-tests/src/test/resources/standard-tests.yamsql @@ -83,10 +83,11 @@ test_block: - - query: select * from (select * from (select * from T1) as x) as y where ID = 5; - result: [{ID: !l 5, !l 10, !l 5}] - # 4.1 Triage: Failed running with forced continuations: (Received continuation shouldn't be at beginning) - # - - # - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; - # - result: [{!l 1}] + # 4.1 Triage: [Deferred: Not failing in CK] Failed running with forced continuations: (Received continuation shouldn't be at beginning) + - + - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; + - maxRows: 0 + - result: [{!l 1}] - - query: select * from (select * from (select * from (select * from T1 where ID > 10) as x) as y) as z; - result: [{ID: !l 11, !l 20, !l 11}, {ID: !l 12, !l 20, !l 12}, {ID: !l 13, !l 20, !l 13}] From d0d9c566104c5d42c3f9ced9ffed06f9cd9c00a8 Mon Sep 17 00:00:00 2001 From: ohad Date: Wed, 26 Feb 2025 12:11:28 -0700 Subject: [PATCH 26/62] Change wording --- yaml-tests/src/test/resources/catalog.yamsql | 4 ++-- .../src/test/resources/create-drop.yamsql | 24 +++++++++---------- .../resources/field-index-tests-proto.yamsql | 6 ++--- .../src/test/resources/groupby-tests.yamsql | 12 +++++----- .../test/resources/null-operator-tests.yamsql | 2 +- .../test/resources/primary-key-tests.yamsql | 2 +- .../resources/standard-tests-metadata.yamsql | 2 +- .../resources/standard-tests-proto.yamsql | 2 +- .../src/test/resources/standard-tests.yamsql | 2 +- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/yaml-tests/src/test/resources/catalog.yamsql b/yaml-tests/src/test/resources/catalog.yamsql index 5d8d388aca..bc51ff2cbb 100644 --- a/yaml-tests/src/test/resources/catalog.yamsql +++ b/yaml-tests/src/test/resources/catalog.yamsql @@ -58,7 +58,7 @@ test_block: - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas group by template_name, template_version having template_name = 't') as t; - explainContains: 'AISCAN(TEMPLATES_COUNT_INDEX' - # 4.1 Triage: [Deferred: Not failing in CK] failing when running with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] failing when running with forced continuations (Received continuation shouldn't be at beginning) # - # - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas # group by template_name, template_version having template_name = 'TEST_TEMPLATE_1') as t; @@ -68,7 +68,7 @@ test_block: - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas group by template_name, template_version having template_name = 't' and template_version = 1) as t; - explainContains: 'AISCAN(TEMPLATES_COUNT_INDEX' - # 4.1 Triage: [Deferred: Not failing in CK] failing when running with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] failing when running with forced continuations (Received continuation shouldn't be at beginning) # - # - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas # group by template_name, template_version having template_name = 'TEST_TEMPLATE_1' and template_version = 1) as t; diff --git a/yaml-tests/src/test/resources/create-drop.yamsql b/yaml-tests/src/test/resources/create-drop.yamsql index 5892c380e2..9842607711 100644 --- a/yaml-tests/src/test/resources/create-drop.yamsql +++ b/yaml-tests/src/test/resources/create-drop.yamsql @@ -44,7 +44,7 @@ setup: - query: drop database if exists /frl/DB - query: create schema template temp1 create table T1(a1 bigint, primary key(a1)) -# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations for all versions with: +# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations for all versions with: # Received continuation shouldn't be at beginning #--- #test_block: @@ -59,7 +59,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop schema template temp1 -# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations (Does not fail with SNAPSHOT) +# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations (Does not fail with SNAPSHOT) # Embedded -> 4.0.559.6: # Received continuation shouldn't be at beginning # 4.1 Triage: fails with force continuations (Does not fail with SNAPSHOT) @@ -81,7 +81,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create schema template temp2 create table T1(a1 bigint, primary key(a1)) -# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations for all versions (including SNAPSHOT): +# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations for all versions (including SNAPSHOT): # Received continuation shouldn't be at beginning #--- #test_block: @@ -96,7 +96,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create database /frl/db -# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations for all versions (including SNAPSHOT): +# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations for all versions (including SNAPSHOT): # Received continuation shouldn't be at beginning #--- #test_block: @@ -111,7 +111,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database /frl/db -# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations (but not for snapshot) +# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations (but not for snapshot) # Embedded -> 4.0.559.6: # Received continuation shouldn't be at beginning # 4.1 triage: Fails with force continuations (but not for snapshot) @@ -133,7 +133,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create database /frl/db -# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations for all versions (including SNAPSHOT): +# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations for all versions (including SNAPSHOT): # Received continuation shouldn't be at beginning #--- #test_block: @@ -154,7 +154,7 @@ setup: # org.opentest4j.AssertionFailedError: expected: but was: # at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementWithForcedContinuations(QueryExecutor.java:258) # at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementAndCheckForceContinuations(QueryExecutor.java:219) -# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations (but not for snapshot) +# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations (but not for snapshot) # 4.0.559.6 -> Embedded: # Received continuation shouldn't be at beginning #--- @@ -170,7 +170,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create database /frl/db -# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations for all versions (including SNAPSHOT): +# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations for all versions (including SNAPSHOT): # Received continuation shouldn't be at beginning #--- #test_block: @@ -185,7 +185,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create schema /frl/db/s1 with template temp2 -# 4.1 triage: [Deferred: Not failing in CK] Fails with force continuations for all versions (including SNAPSHOT): +# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations for all versions (including SNAPSHOT): # Received continuation shouldn't be at beginning #--- #test_block: @@ -200,7 +200,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database /frl/db -# 4.1 triage: [Deferred: Not failing in CK] Both queries fail with force continuations (but not for snapshot) +# 4.1 triage: [Deferred: Client checks for End] Both queries fail with force continuations (but not for snapshot) # Embedded -> 4.0.559.6: # Received continuation shouldn't be at beginning # 4.1 triage: Both queries fail with force continuations (but not for snapshot) @@ -228,7 +228,7 @@ setup: - query: create database /frl/db - query: create schema /frl/db/s1 with template temp2 - query: create schema /frl/db/s2 with template temp2 -# 4.1 triage: [Deferred: Not failing in CK] Both queries fail with force continuations for all versions (including SNAPSHOT): +# 4.1 triage: [Deferred: Client checks for End] Both queries fail with force continuations for all versions (including SNAPSHOT): # Received continuation shouldn't be at beginning #--- #test_block: @@ -246,7 +246,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database /frl/db -# 4.1 triage: [Deferred: Not failing in CK] Both queries fail with force continuations (but not for snapshot) +# 4.1 triage: [Deferred: Client checks for End] Both queries fail with force continuations (but not for snapshot) # Embedded -> 4.0.559.6: # Received continuation shouldn't be at beginning # 4.1 triage: Both queries fail with force continuations (but not for snapshot) diff --git a/yaml-tests/src/test/resources/field-index-tests-proto.yamsql b/yaml-tests/src/test/resources/field-index-tests-proto.yamsql index c65a29fc5c..a42d715f72 100644 --- a/yaml-tests/src/test/resources/field-index-tests-proto.yamsql +++ b/yaml-tests/src/test/resources/field-index-tests-proto.yamsql @@ -56,7 +56,7 @@ test_block: - - query: select * from (select * from (select * from "MyTable") as x) as y where ID = 5; - result: [{ID: !l 5, COL1: !l 10, COL31: !l 5, COL32: !null _, COL2: !l 5}] - # 4.1 Triage: [Deferred: Not failing in CK] failed when running with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] failed when running with forced continuations (Received continuation shouldn't be at beginning) - - query: select count(*) from (select * from (select * from (select * from "MyTable" where ID = 5) as x) as y) as z; - maxRows: 0 @@ -64,12 +64,12 @@ test_block: - - query: select COL31, COL32 from (select * from (select * from "MyTable") as x) as y where ID = 5; - result: [{COL31: !l 5, COL32: !null _}] - # 4.1 Triage: [Deferred: Not failing in CK] failed when running with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] failed when running with forced continuations (Received continuation shouldn't be at beginning) - - query: select sum(COL1) from "MyTable"; - maxRows: 0 - result: [{!l 210}] - # 4.1 Triage: [Deferred: Not failing in CK] failed when running with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] failed when running with forced continuations (Received continuation shouldn't be at beginning) - - query: select count(COL1) from "MyTable"; - maxRows: 0 diff --git a/yaml-tests/src/test/resources/groupby-tests.yamsql b/yaml-tests/src/test/resources/groupby-tests.yamsql index 4c7d528195..94611bbd20 100644 --- a/yaml-tests/src/test/resources/groupby-tests.yamsql +++ b/yaml-tests/src/test/resources/groupby-tests.yamsql @@ -161,22 +161,22 @@ test_block: - - query: select X.col2 from (select col1, col2 from t1) as x group by x.col1; - error: "42803" - # 4.1 Triage: [Deferred: Not failing in CK] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - - query: select MAX(x.col2) from (select col1,col2 from t1) as x; - maxRows: 0 - result: [{!l 13}] - # 4.1 Triage: [Deferred: Not failing in CK] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - - query: select MIN(x.col2) from (select col1,col2 from t1) as x; - maxRows: 0 - result: [{!l 1}] - # 4.1 Triage: [Deferred: Not failing in CK] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - - query: select COUNT(x.col2) from (select col1,col2 from t1) as x; - maxRows: 0 - result: [{!l 13}] - # 4.1 Triage: [Deferred: Not failing in CK] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - - query: select AVG(x.col2) from (select col1,col2 from t1) as x; - maxRows: 0 @@ -198,12 +198,12 @@ test_block: # - # - query: select G + 4 from (select MIN(x.col2) as G from (select col1,col2 from t1) as x group by x.col1 as K) as Y where G > 5; # - result: [{!l 10}] - # 4.1 Triage: [Deferred: Not failing in CK] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - - query: select COUNT(*) from T1; - maxRows: 0 - result: [{!l 13}] - # 4.1 Triage: [Deferred: Not failing in CK] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - - query: select COUNT(col1) from T1; - maxRows: 0 diff --git a/yaml-tests/src/test/resources/null-operator-tests.yamsql b/yaml-tests/src/test/resources/null-operator-tests.yamsql index 38153a4d13..be346e02df 100644 --- a/yaml-tests/src/test/resources/null-operator-tests.yamsql +++ b/yaml-tests/src/test/resources/null-operator-tests.yamsql @@ -45,7 +45,7 @@ test_block: - - query: select * from (select * from (select * from T1) as x where ID is null) as y; - result: [] - # 4.1 Triage: [Deferred: Not failing in CK] failed when running with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] failed when running with forced continuations (Received continuation shouldn't be at beginning) - - query: select count(*) from (select * from (select * from T1) as x where ID is not null) as y; - maxRows: 0 diff --git a/yaml-tests/src/test/resources/primary-key-tests.yamsql b/yaml-tests/src/test/resources/primary-key-tests.yamsql index e0fe36a5c9..ebb101d7fb 100644 --- a/yaml-tests/src/test/resources/primary-key-tests.yamsql +++ b/yaml-tests/src/test/resources/primary-key-tests.yamsql @@ -31,7 +31,7 @@ test_block: VALUES ((1, 2, 3, 4), 5), ((1, 2, 30, 40), 50) - error: "23505" - # 4.1 Triage: [Deferred: Not failing in CK] failed when running with forced continuations against 4.0.559.6 (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] failed when running with forced continuations against 4.0.559.6 (Received continuation shouldn't be at beginning) - - query: SELECT COUNT(*) FROM T1 - maxRows: 0 diff --git a/yaml-tests/src/test/resources/standard-tests-metadata.yamsql b/yaml-tests/src/test/resources/standard-tests-metadata.yamsql index 07d14d8e93..765f8158da 100644 --- a/yaml-tests/src/test/resources/standard-tests-metadata.yamsql +++ b/yaml-tests/src/test/resources/standard-tests-metadata.yamsql @@ -56,7 +56,7 @@ test_block: - - query: select * from (select * from (select * from T1) as x) as y where ID = 5; - result: [{ID: !l 5, !l 10, !l 5}] - # 4.1 Triage: [Deferred: Not failing in CK] failed running with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] failed running with forced continuations (Received continuation shouldn't be at beginning) - - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; - maxRows: 0 diff --git a/yaml-tests/src/test/resources/standard-tests-proto.yamsql b/yaml-tests/src/test/resources/standard-tests-proto.yamsql index ae4064d148..e8c1c0ecac 100644 --- a/yaml-tests/src/test/resources/standard-tests-proto.yamsql +++ b/yaml-tests/src/test/resources/standard-tests-proto.yamsql @@ -55,7 +55,7 @@ test_block: - - query: select * from (select * from (select * from T1) as x) as y where ID = 5; - result: [{ID: !l 5, !l 10, !l 5}] - # 4.1 Triage: [Deferred: Not failing in CK] failed when running with forced continuations (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] failed when running with forced continuations (Received continuation shouldn't be at beginning) - - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; - maxRows: 0 diff --git a/yaml-tests/src/test/resources/standard-tests.yamsql b/yaml-tests/src/test/resources/standard-tests.yamsql index fc91678c86..9f61b78fbb 100644 --- a/yaml-tests/src/test/resources/standard-tests.yamsql +++ b/yaml-tests/src/test/resources/standard-tests.yamsql @@ -83,7 +83,7 @@ test_block: - - query: select * from (select * from (select * from T1) as x) as y where ID = 5; - result: [{ID: !l 5, !l 10, !l 5}] - # 4.1 Triage: [Deferred: Not failing in CK] Failed running with forced continuations: (Received continuation shouldn't be at beginning) + # 4.1 Triage: [Deferred: Client checks for End] Failed running with forced continuations: (Received continuation shouldn't be at beginning) - - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; - maxRows: 0 From 06f46065df69a40d2da5fe7f2c8bf8cfc82c8118 Mon Sep 17 00:00:00 2001 From: ohad Date: Wed, 26 Feb 2025 13:44:05 -0700 Subject: [PATCH 27/62] Triage rest of files, add to annotations --- .../src/test/resources/create-drop.yamsql | 17 +- yaml-tests/src/test/resources/enum.yamsql | 2 +- .../src/test/resources/functions.yamsql | 28 +-- .../src/test/resources/groupby-tests.yamsql | 20 +- .../src/test/resources/insert-enum.yamsql | 2 +- .../resources/inserts-updates-deletes.yamsql | 4 +- .../src/test/resources/join-tests.yamsql | 4 +- yaml-tests/src/test/resources/like.yamsql | 192 ++++++++++-------- .../src/test/resources/select-a-star.yamsql | 6 +- .../src/test/resources/subquery-tests.yamsql | 8 +- yaml-tests/src/test/resources/union.yamsql | 12 +- 11 files changed, 159 insertions(+), 136 deletions(-) diff --git a/yaml-tests/src/test/resources/create-drop.yamsql b/yaml-tests/src/test/resources/create-drop.yamsql index 9842607711..5602266553 100644 --- a/yaml-tests/src/test/resources/create-drop.yamsql +++ b/yaml-tests/src/test/resources/create-drop.yamsql @@ -148,7 +148,7 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database if exists /frl/db -# 4.1 triage: Fails with force continuations (but not for snapshot) +# 4.1 triage: [Initial version] Fails with force continuations (but not for snapshot) # Embedded -> 4.0.559.6: # expected: but was: # org.opentest4j.AssertionFailedError: expected: but was: @@ -158,13 +158,14 @@ setup: # 4.0.559.6 -> Embedded: # Received continuation shouldn't be at beginning #--- -#test_block: -# connect: "jdbc:embed:/__SYS?schema=CATALOG" -# preset: single_repetition_ordered -# tests: -# - -# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' -# - result: [{0}] +test_block: + connect: "jdbc:embed:/__SYS?schema=CATALOG" + preset: single_repetition_ordered + tests: + - + - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' + - maxRows: 0 + - result: [{0}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" diff --git a/yaml-tests/src/test/resources/enum.yamsql b/yaml-tests/src/test/resources/enum.yamsql index ac06880ef6..895907d89c 100644 --- a/yaml-tests/src/test/resources/enum.yamsql +++ b/yaml-tests/src/test/resources/enum.yamsql @@ -17,7 +17,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# 4.1-triage: enum support was not added to client until 4.1.6.0, none of these queries pass, all with: +# 4.1-triage: [Ignored: Enum] enum support was not added to client until 4.1.6.0, none of these queries pass, all with: # The comparand to a comparison expecting an argument of a primitive type, is invoked with an argument of a complex type, e.g. an array or a record. --- options: diff --git a/yaml-tests/src/test/resources/functions.yamsql b/yaml-tests/src/test/resources/functions.yamsql index 9b6e65b818..b5b8993ce6 100644 --- a/yaml-tests/src/test/resources/functions.yamsql +++ b/yaml-tests/src/test/resources/functions.yamsql @@ -92,11 +92,11 @@ test_block: - - query: select least(a1, a2, a8), least(1, 2, 3.0, 4, 5) from A - result: [{_0: 1.0, _1: 1.0}] - # 4.1 triage: Fails with force continuations for all versions with (including snapshot): - # cannot continue query due to mismatch between serialized and actual plan hash -# - -# - query: select coalesce(null, null, 5), coalesce(null, 1, null), coalesce(null, a1, a8) from A -# - result: [{_0: 5, _1: 1, _2: 1.0}] + # 4.1 triage: [Deferred: literal null issue] Fails with force continuations for all versions with (including snapshot): cannot continue query due to mismatch between serialized and actual plan hash + - + - query: select coalesce(null, null, 5), coalesce(null, 1, null), coalesce(null, a1, a8) from A + - maxRows: 0 + - result: [{_0: 5, _1: 1, _2: 1.0}] - - query: select b1, b2, coalesce(b1, b2, 42) from B - unorderedResult: [ @@ -125,15 +125,15 @@ test_block: {{ T1: 3, A: 'c', B: 3.0}}, {{ T1: 4, A: 'd', B: 4.0}}, {!null _}] - # 4.1 triage: Fails with force continuations for all versions with (including snapshot): - # cannot continue query due to mismatch between serialized and actual plan hash -# - -# - query: select coalesce(null, (1, 1.0, 'a', true)) from C -# - unorderedResult: [ -# {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, -# {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, -# {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, -# {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}] + # 4.1 triage: [Deferred: literal null issue] Fails with force continuations for all versions with (including snapshot): cannot continue query due to mismatch between serialized and actual plan hash + - + - query: select coalesce(null, (1, 1.0, 'a', true)) from C + - maxRows: 0 + - unorderedResult: [ + {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, + {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, + {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, + {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}] --- test_block: preset: single_repetition_ordered diff --git a/yaml-tests/src/test/resources/groupby-tests.yamsql b/yaml-tests/src/test/resources/groupby-tests.yamsql index 94611bbd20..049a759d36 100644 --- a/yaml-tests/src/test/resources/groupby-tests.yamsql +++ b/yaml-tests/src/test/resources/groupby-tests.yamsql @@ -142,19 +142,23 @@ test_block: # - # - query: select COUNT(x.col2) from (select col1,col2 from t1) as x group by x.col1; # - result: [{!l 5}, {!l 8}] - # 4.1 Triage: Test failed when run with forced continuations (Result mismatch) - # - - # - query: select AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; - # - result: [{3.0}, {9.5}] + # 4.1 Triage: [Investigate further] Test failed when run with forced continuations (Result mismatch) + # [4.0.559.6, !currentVersion] returned 10.0 instead of 9.5 + - + - query: select AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; + - maxRows: 0 + - result: [{3.0}, {9.5}] # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) # - # - query: select SUM(x.col2) from (select col1,col2 from t1) as x group by x.col1; # - result: [{!l 15}, {!l 76}] - # 4.1 Triage: Test failed when run with forced continuations (Result mismatch) - # - + # 4.1 Triage: [Investigate further] Test failed when run with forced continuations (Result mismatch) + # [4.0.559.6, !currentVersion] returned {10, 10.0} instead of {9, 9.5} + - # result is correct since we don't use (not support, yet) explicit casting. - # - query: select SUM(x.col2) / COUNT(x.col2), AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; - # - result: [{!l 3, 3.0}, {!l 9, 9.5}] + - query: select SUM(x.col2) / COUNT(x.col2), AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; + - maxRows: 0 + - result: [{!l 3, 3.0}, {!l 9, 9.5}] - - query: select MAX(x.col2) from (select col1 from t1) as x group by x.col1; - error: "42703" diff --git a/yaml-tests/src/test/resources/insert-enum.yamsql b/yaml-tests/src/test/resources/insert-enum.yamsql index b000ae8f16..ac61e5067d 100644 --- a/yaml-tests/src/test/resources/insert-enum.yamsql +++ b/yaml-tests/src/test/resources/insert-enum.yamsql @@ -16,7 +16,7 @@ # 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. -# 4.1-triage: Enum support wasn't added until 4.1.6.0 All tests fail to insert enums with: +# 4.1-triage: [Ignored: Enum] Enum support wasn't added until 4.1.6.0 All tests fail to insert enums with: # Caused by: java.sql.SQLException: java.sql.Type=1111 not supported --- options: diff --git a/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql b/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql index 12ff4733ed..48444b726d 100644 --- a/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql +++ b/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql @@ -105,12 +105,12 @@ test_block: - result: [{ B1: 10, B2: 22, B3: { 5, 41 } }, { B1: 20, B2: 22, B3: { 6, 51 } }, { B1: 30, B2: 22, B3: { 7, 61 } } ] - # 4.1 Triage: failed when running against 4.0.559.6 (expecting '42601' error code, got 'XXXXX' instead) + # 4.1 Triage: [Initial version] failed when running against 4.0.559.6 ("expecting '42601' error code, got 'XXXXX' instead" and "java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1") # - # Case where not all values are provided of A. Still works, since the columns for which no values are provided can be nullable. # - query: insert into A(A1, A2, A3) values (4); # - error: "42601" - # 4.1 Triage: Failed when initial version is 4.0.559.6 (expecting statement to throw an error, however it returned a count) + # 4.1 Triage: [Initial version] Failed when initial version is 4.0.559.6 (expecting statement to throw an error, however it returned a count) # - # Case when the number of values is more than the number of columns specified. # - query: insert into A(A1, A2, A3) values (5, 6, 7, 8, 9); diff --git a/yaml-tests/src/test/resources/join-tests.yamsql b/yaml-tests/src/test/resources/join-tests.yamsql index 5e6c9c0c25..d497c76851 100644 --- a/yaml-tests/src/test/resources/join-tests.yamsql +++ b/yaml-tests/src/test/resources/join-tests.yamsql @@ -67,7 +67,7 @@ test_block: - # Get names of people working on a project - query: select fname, lname from emp where exists (select * from project where emp_id = emp.id); - # 4.1 Triage: This runs into infinite loop + # 4.1 Triage: [Investigate further: Exists subquery] This runs into infinite loop - maxRows: 0 - unorderedResult: [{"Emily", "Martinez"}, {"Daniel", "Miller"}, @@ -78,7 +78,7 @@ test_block: (select fname, lname, dept_id from emp where exists (select * from project where emp_id = emp.id)) as sq, dept where sq.dept_id = dept.id and dept.name = 'Sales'; - # 4.1 Triage: This runs into infinite loop + # 4.1 Triage: [Investigate further: Exists subquery] This runs into infinite loop - maxRows: 0 - unorderedResult: [{"Daniel", "Miller"}] - diff --git a/yaml-tests/src/test/resources/like.yamsql b/yaml-tests/src/test/resources/like.yamsql index d01d1f4a05..bc23cdd1bf 100644 --- a/yaml-tests/src/test/resources/like.yamsql +++ b/yaml-tests/src/test/resources/like.yamsql @@ -17,7 +17,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# 4.1 triage: All queries that return any results, fail with force continuations, even against current version +# 4.1 triage: [Deferred: like continuations] All queries that return any results, fail with force continuations, even against current version # with: The like operator expects an escape character of length 1. --- schema_template: @@ -52,45 +52,51 @@ test_block: - - query: select * from A WHERE A1 LIKE '%abc' - result: [] -# - -# - query: select * from A WHERE A1 LIKE '%abc%' -# - unorderedResult: [ -# {'abcdefghijklmnopqrstuvwxyz'}, -# {'___abcdef'}, -# {'%%abcdef'}, -# {'*abcdef'}, -# {'(abcdefghijk)'}, -# {'[abcdefghijk]'}, -# {'{abcdefghijk}'}] -# - -# - query: select * from A WHERE A1 LIKE '_abc%' -# - unorderedResult: [ -# {'(abcdefghijk)'}, -# {'[abcdefghijk]'}, -# {'{abcdefghijk}'}, -# {'*abcdef'}] -# - -# # TODO (Investigate `Missing binding for __const_CONSTANT` error with queries when using plan from cache) -# - query: select * from A WHERE A1 LIKE '%ABC%' -# - unorderedResult: [{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}] -# - -# - query: select * from A WHERE A1 LIKE '%ABC%X_Z' -# - unorderedResult: [{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}] + - + - query: select * from A WHERE A1 LIKE '%abc%' + - maxRows: 0 + - unorderedResult: [ + {'abcdefghijklmnopqrstuvwxyz'}, + {'___abcdef'}, + {'%%abcdef'}, + {'*abcdef'}, + {'(abcdefghijk)'}, + {'[abcdefghijk]'}, + {'{abcdefghijk}'}] + - + - query: select * from A WHERE A1 LIKE '_abc%' + - maxRows: 0 + - unorderedResult: [ + {'(abcdefghijk)'}, + {'[abcdefghijk]'}, + {'{abcdefghijk}'}, + {'*abcdef'}] + - + # TODO (Investigate `Missing binding for __const_CONSTANT` error with queries when using plan from cache) + - query: select * from A WHERE A1 LIKE '%ABC%' + - maxRows: 0 + - unorderedResult: [{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}] + - + - query: select * from A WHERE A1 LIKE '%ABC%X_Z' + - maxRows: 0 + - unorderedResult: [{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}] - - query: select * from A WHERE A1 LIKE '%ABC%XY_Z' - unorderedResult: [] -# - -# - query: select * from A WHERE A1 LIKE '__' -# - unorderedResult: [ -# {'学校'}, -# {'^$'}] -# - -# - query: select * from A WHERE A1 LIKE '_____' -# - unorderedResult: [ -# {'école'}, -# {'ありがとう'}, -# {'مدرسة'}, -# {'\\||%'}] + - + - query: select * from A WHERE A1 LIKE '__' + - maxRows: 0 + - unorderedResult: [ + {'学校'}, + {'^$'}] + - + - query: select * from A WHERE A1 LIKE '_____' + - maxRows: 0 + - unorderedResult: [ + {'école'}, + {'ありがとう'}, + {'مدرسة'}, + {'\\||%'}] --- # TODO (Investigate `Missing binding for __const_CONSTANT` error with queries when using plan from cache) test_block: @@ -98,61 +104,71 @@ test_block: repetition: 1 check_cache: false tests: -# - -# - query: select * from A WHERE A1 LIKE '|_|_%' ESCAPE '|' -# - result: [{'___abcdef'}] -# - -# - query: select * from A WHERE A1 LIKE '\_%' ESCAPE '\' -# - result: [{'___abcdef'}] -# - -# - query: select * from A WHERE A1 LIKE '\_%' ESCAPE '|' -# - result: [{'\\||%'}] -# - -# - query: select * from A WHERE A1 LIKE '\_%' -# - result: [{'\\||%'}] -# - -# - query: select * from A WHERE A1 LIKE '\_\_\_abcdef' ESCAPE '\' -# - result: [{'___abcdef'}] -# - -# - query: select * from A WHERE A1 LIKE '\_\_\_______' ESCAPE '\' -# - result: [{'___abcdef'}] -# - -# - query: select * from A WHERE A1 LIKE '\__\_______' ESCAPE '\' -# - result: [{'___abcdef'}] + - + - query: select * from A WHERE A1 LIKE '|_|_%' ESCAPE '|' + - maxRows: 0 + - result: [{'___abcdef'}] + - + - query: select * from A WHERE A1 LIKE '\_%' ESCAPE '\' + - maxRows: 0 + - result: [{'___abcdef'}] + - + - query: select * from A WHERE A1 LIKE '\_%' ESCAPE '|' + - maxRows: 0 + - result: [{'\\||%'}] + - + - query: select * from A WHERE A1 LIKE '\_%' + - maxRows: 0 + - result: [{'\\||%'}] + - + - query: select * from A WHERE A1 LIKE '\_\_\_abcdef' ESCAPE '\' + - maxRows: 0 + - result: [{'___abcdef'}] + - + - query: select * from A WHERE A1 LIKE '\_\_\_______' ESCAPE '\' + - maxRows: 0 + - result: [{'___abcdef'}] + - + - query: select * from A WHERE A1 LIKE '\__\_______' ESCAPE '\' + - maxRows: 0 + - result: [{'___abcdef'}] - - query: select * from A WHERE A1 LIKE '\__\______\_' ESCAPE '\' - result: [] -# - -# - query: select * from A WHERE A1 LIKE '%\%' ESCAPE '\' -# - result: [{'\\||%'}] -# - -# - query: select * from A WHERE A1 NOT LIKE '|_|_%' ESCAPE '|' -# - unorderedResult: [ -# {'abcdefghijklmnopqrstuvwxyz'}, -# {'%%abcdef'}, -# {'*abcdef'}, -# {'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}, -# {'école'}, -# {'ありがとう'}, -# {'学校'}, -# {'مدرسة'}, -# {'(abcdefghijk)'}, -# {'[abcdefghijk]'}, -# {'{abcdefghijk}'}, -# {'^$'}, -# {'\\||%'} -# ] + - + - query: select * from A WHERE A1 LIKE '%\%' ESCAPE '\' + - maxRows: 0 + - result: [{'\\||%'}] + - + - query: select * from A WHERE A1 NOT LIKE '|_|_%' ESCAPE '|' + - maxRows: 0 + - unorderedResult: [ + {'abcdefghijklmnopqrstuvwxyz'}, + {'%%abcdef'}, + {'*abcdef'}, + {'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}, + {'école'}, + {'ありがとう'}, + {'学校'}, + {'مدرسة'}, + {'(abcdefghijk)'}, + {'[abcdefghijk]'}, + {'{abcdefghijk}'}, + {'^$'}, + {'\\||%'} + ] - - query: select * from A WHERE A1 NOT LIKE '%' - unorderedResult: [] -# - -# - query: select * from A WHERE A1 NOT LIKE '%abcde%' -# - unorderedResult: [ -# {'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}, -# {'école'}, -# {'ありがとう'}, -# {'学校'}, -# {'مدرسة'}, -# {'^$'}, -# {'\\||%'} ] + - + - query: select * from A WHERE A1 NOT LIKE '%abcde%' + - maxRows: 0 + - unorderedResult: [ + {'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}, + {'école'}, + {'ありがとう'}, + {'学校'}, + {'مدرسة'}, + {'^$'}, + {'\\||%'} ] ... diff --git a/yaml-tests/src/test/resources/select-a-star.yamsql b/yaml-tests/src/test/resources/select-a-star.yamsql index f94013f5f8..c677b6b075 100644 --- a/yaml-tests/src/test/resources/select-a-star.yamsql +++ b/yaml-tests/src/test/resources/select-a-star.yamsql @@ -40,7 +40,7 @@ test_block: tests: - - query: select B1 from B where exists (select A.*, B1 from A group by A1,A2,A3); - # 4.1 Triage: Infinite loop + # 4.1 Triage: [Investigate further: Exists subquery] Infinite loop - maxRows: 0 - result: [{1}, {2}, {3}] - @@ -80,12 +80,12 @@ test_block: - error: "42803" - - query: select B1 from B where exists (select A.*, B1 from A group by A1,A2,A3); - # 4.1 Triage: Infinite loop + # 4.1 Triage: [Investigate further: Exists subquery] Infinite loop - maxRows: 0 - result: [{1}, {2}, {3}] - - query: select B.* from B where exists (select A.*, B.* from A group by A1,A2,A3); - # 4.1 Triage: Infinite loop + # 4.1 Triage: [Investigate further: Exists subquery] Infinite loop - maxRows: 0 - result: [{1, 20, {4, 40}}, {2, 20, {5, 50}}, diff --git a/yaml-tests/src/test/resources/subquery-tests.yamsql b/yaml-tests/src/test/resources/subquery-tests.yamsql index d848e02ac0..2212ff6be0 100644 --- a/yaml-tests/src/test/resources/subquery-tests.yamsql +++ b/yaml-tests/src/test/resources/subquery-tests.yamsql @@ -62,25 +62,25 @@ test_block: - # correlations are allowed inside a nested subquery with group by - query: select x from a where exists (select a.x, max(idb) from b where q > a.x group by q) - # 4.1 Triage: Verify Exception for continuation + # 4.1 Triage: fail with forced continuations (Verify Exception for continuation, Type$Record.fromProto(Type.java:2095)) - maxRows: 0 - result: [{1}, {2}, {3}] - # correlations are allowed inside a nested subquery with group by, not necessarily qualified - query: select x from a where exists (select x, max(idb) from b where q > x group by q) - # 4.1 Triage: Contextual SQL Exception for continuation + # 4.1 Triage: fail with forced continuations (Verify Exception for continuation, Type$Record.fromProto(Type.java:2095)) - maxRows: 0 - result: [{1}, {2}, {3}] - # correlations inside aggregations are allowed inside a nested subquery with group by - query: select x from a where exists (select max(x), max(idb) from b where q > x group by q) - # 4.1 Triage: infinite loop for continuation + # 4.1 Triage: [Investigate further: exists subquery] infinite loop for continuation - maxRows: 0 - result: [{1}, {2}, {3}] - # correlations inside aggregations are allowed inside a nested subquery with group by - query: select x from a where exists (select max(a.x), max(idb) from b where q > x group by q) - # 4.1 Triage: infinite loop for continuation + # 4.1 Triage: [Investigate further: exists subquery] infinite loop for continuation - maxRows: 0 - result: [{1}, {2}, {3}] ... diff --git a/yaml-tests/src/test/resources/union.yamsql b/yaml-tests/src/test/resources/union.yamsql index 5e4ce0281b..e01512d8fe 100644 --- a/yaml-tests/src/test/resources/union.yamsql +++ b/yaml-tests/src/test/resources/union.yamsql @@ -58,7 +58,7 @@ test_block: tests: - - query: select sum(a) as a, sum(b) as b from (select sum(col1) as a, count(*) as b from t1 union all select sum(col1) as a, count(*) as b from t2) as x - # 4.1 Triage: infinite loop + # 4.1 Triage: [Investigate further: aggregates on subquery] infinite loop - maxRows: 0 - unorderedResult: [{A: 74 , B: 13}] - @@ -157,19 +157,20 @@ test_block: {A: 10.0, B: 20.0}] - - query: select sum(Y) as S from (select count(*) as Y from t3 where a < 10 group by a union all select count(*) from t4) as X - # 4.1 Triage: Infinite loop + # 4.1 Triage: [Investigate further: aggregates on subquery] Infinite loop - maxRows: 0 - explain: "AISCAN(MV10 [[LESS_THAN promote(@c22 AS DOUBLE)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS Y) | MAP (_.Y AS Y) ⊎ SCAN(<,>) | TFILTER T4 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)" - result: [{S: 2}] - - query: select sum(Y) as S from (select count(*) as Y from t3 union all select count(*) from t1) as X - explain: "SCAN(<,>) | TFILTER T3 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ ISCAN(VI1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)" - # 4.1 Triage: Infinite loop + # 4.1 Triage: [Investigate further: aggregates on subquery] Infinite loop - maxRows: 0 - result: [{S: 5}] - - query: select col2 from t1 where exists (select a from t3 where col2 <= id union all select b from t4 where col2 <= id) - # 4.1 Triage: Invalid continuation + # 4.1 Triage: [Investigate further] fails with forced continuations (Invalid continuation) + # Failed with both 559 and 4.1.8, RecordCoreException: invalid continuation - maxRows: 0 - result: [{1}, {2}, {6}, {7}] - @@ -184,6 +185,7 @@ test_block: - - query: select sum(Y) as S from (select count(*) as Y from t6 union all select count(*) from t7) as X - explain: "AISCAN(MV11 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ AISCAN(MV12 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)" - # 4.1 Triage: Wrong result with forced continuation (NULL vs 0) + # 4.1 Triage: [Initial version] Failing with 559: (Wrong result with forced continuation (NULL vs 0)) + # 4.1 Triage: [deferred: Client checks for END] Failing with forced continuations: (Received continuation shouldn't be at beginning) # - result: [{0}] ... From 11494c3c5c5b6dd89fc3f62a1946502f14ae4c5e Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Thu, 27 Feb 2025 14:17:26 +0000 Subject: [PATCH 28/62] Squashed commit of the following: commit 9a8192ca2fe876d795dea236151694b090cb56fb Author: Alec Grieser Date: Thu Feb 27 11:27:53 2025 +0000 update bitmap-aggregate-index.yamsql using new feature and enable force_continuations commit 169e5824debd7d0ad514947ef8c4ee2162726893 Author: Alec Grieser Date: Thu Feb 27 10:09:05 2025 +0000 fix up failing MultiServerConnectionFactoryTest to use SemanticVersions instead of Strings commit fe4602fa6647a2d0231244f597a70b56649f8bc3 Merge: 7d61714e5 8a3c17f81 Author: Alec Grieser Date: Wed Feb 26 18:56:11 2025 +0000 Merge remote-tracking branch 'upstream/main' into 03114-fine-grained-multi-version commit 7d61714e557455b0b56dc1714c42824aeb0838d8 Author: Alec Grieser Date: Wed Feb 26 18:52:10 2025 +0000 combine CodeVersion implementations into SemanticVersion commit 8a3c17f81a4a9f1423887212f72fdcb94793e2de Author: Alec Grieser Date: Wed Feb 26 18:31:21 2025 +0000 Run the PR label check whenever the HEAD commit changes to ensure it is applied to the final commit of each PR (#3195) This makes sure the PR label check is run every time the commit changes on a PR. Strictly speaking, this seems like it shouldn't be necessary, but if it isn't added, then the check may not be applied to the final commit in a PR, which in turn means that the check won't be there to block a PR missing an appropriate label. commit 993a9b42b8511ad3cc0cc31692f15fdeb7ea9a62 Author: Alec Grieser Date: Wed Feb 26 17:53:40 2025 +0000 Address comments from @sdugas: * Use CodeVersion class in more places * Add tests for !current_version in the initial-version yaml tests * Remove vestigial weirdness from previous iterations of this code * Update YAML-SQL.xml with the new syntax commit 25a0c2adebe53744876a085399453e2ca3cc0162 Author: Alec Grieser Date: Wed Feb 26 11:47:25 2025 +0000 update so that we parse CodeVersion sooner in more places commit 7a9f978855d06a08b0e7a1600d939c0200416e31 Merge: 5c5a9c5fe d736d89bb Author: Alec Grieser Date: Tue Feb 25 19:05:44 2025 +0000 Merge remote-tracking branch 'upstream/main' into 03114-fine-grained-multi-version commit 5c5a9c5fe76357011f91ba43ee601fc3f0032988 Author: Alec Grieser Date: Tue Feb 25 19:05:23 2025 +0000 move the concept of \"current_version\" out of `SemanticVersion` commit 376f08b6356c5cfef0615d33d38f3201321b4c51 Author: Alec Grieser Date: Mon Feb 24 19:49:32 2025 +0000 fix up failing tests commit 360e0060676c5c87a635925f3d94f4485d79b08c Author: Alec Grieser Date: Mon Feb 24 19:37:43 2025 +0000 mark SUPPORTED as final commit 131742d7ea619ad70be45366e106ac302b6512e7 Author: Alec Grieser Date: Mon Feb 24 19:29:22 2025 +0000 handle some merge skew commit 48bb24e7f98df75826b30720376fa42b83dea888 Author: Alec Grieser Date: Mon Feb 24 19:14:44 2025 +0000 remove weird contains in favor of equals commit 2345d3fa1363ba2703749d2da979118f14d7899a Author: Alec Grieser Date: Mon Feb 24 19:14:36 2025 +0000 make recursive cte supported_versions more precise commit 918afd9caea86ef7187d083e022dd8293b3c144e Author: Alec Grieser Date: Mon Feb 24 18:55:42 2025 +0000 * Add test casese for the initial version configurations to validate tests get run * Make sure that the versions specified are comprehensive commit 4f792a698ddc53359563f3d4fdccff77be94fee3 Author: Alec Grieser Date: Mon Feb 24 14:41:50 2025 +0000 restore requirement that supported_version is first non-query command commit ae86f93af3f470f4c9440f5c5955ec6ba248ee30 Author: Alec Grieser Date: Mon Feb 24 14:19:48 2025 +0000 base version config checking off of runtime determination commit 263d71fb8974a610745eefdd030b4a37a59a5109 Author: Alec Grieser Date: Mon Feb 24 11:24:21 2025 +0000 back out changes to have connection factory support initial version commit c3ff2582d5c755da254a2c2cd623c251ce7f3622 Author: Alec Grieser Date: Fri Feb 21 17:49:21 2025 +0000 update recursive cte supported version commit 228d6b524cfdfccdfe76ec932e0d71ffe65d1259 Author: Alec Grieser Date: Fri Feb 21 16:37:30 2025 +0000 revert yaml-tests.gradle to main commit fec41c9fef416bd0b3a25e3900fbb3b67bb3a9cd Author: Alec Grieser Date: Fri Feb 21 16:04:23 2025 +0000 fix up mixed mode tests in way that shows new configs commit 529ae6771addbdf38192a7a7fbe6dd5d7f3c2721 Author: Alec Grieser Date: Fri Feb 21 15:46:46 2025 +0000 update MultiServerConnectionFactory so it is reset for every query commit 869f6d40172e1e76cbba6d17408584985b0480c9 Author: Alec Grieser Date: Fri Feb 21 14:53:43 2025 +0000 add framework for choosing results by version commit 3a1fb3fd29602f809cbb5e1fe80566da573089cc Author: Alec Grieser Date: Thu Feb 20 18:15:33 2025 +0000 abandon plans to have multiple supported version options commit 6e8d089a8cc0841564df30a0758e4f149b735623 Author: Alec Grieser Date: Fri Feb 7 15:53:12 2025 +0000 * Add YamlExecutionContext state about the initial version chosen for each query * Modify the SupportedVersionCheck parsing so that it can accept multiple fields and doesn't need to be the first config --- .github/workflows/pr_labels.yml | 4 +- build.gradle | 1 + scripts/YAML-SQL.xml | 5 +- .../yamltests/CustomYamlConstructor.java | 2 + .../MultiServerConnectionFactory.java | 29 ++- .../yamltests/SimpleYamlConnection.java | 13 +- .../relational/yamltests/YamlConnection.java | 21 +- .../yamltests/YamlConnectionFactory.java | 3 +- .../yamltests/block/FileOptions.java | 17 +- .../relational/yamltests/block/TestBlock.java | 18 +- .../yamltests/command/QueryCommand.java | 24 ++- .../yamltests/command/QueryConfig.java | 195 ++++++++++++++---- .../yamltests/configs/EmbeddedConfig.java | 8 +- .../configs/JDBCInProcessConfig.java | 8 +- .../yamltests/configs/MultiServerConfig.java | 4 +- .../yamltests/server/CodeVersion.java | 27 +++ .../yamltests/server/ExternalServer.java | 13 +- .../yamltests/server/SemanticVersion.java | 189 +++++++++++++++-- .../server/SupportedVersionCheck.java | 52 +++-- .../src/test/java/InitialVersionTest.java | 161 +++++++++++++++ .../MultiServerConnectionFactoryTest.java | 81 ++++---- .../src/test/java/SupportedVersionTest.java | 5 +- .../yamltests/server/SemanticVersionTest.java | 102 ++++++++- .../resources/aggregate-empty-table.yamsql | 27 ++- .../aggregate-index-tests-count-empty.yamsql | 15 +- .../resources/aggregate-index-tests.yamsql | 8 +- .../resources/bitmap-aggregate-index.yamsql | 15 ++ .../at-least-current-version.yamsql | 51 +++++ .../at-least-version-tests.yamsql | 69 +++++++ .../do-not-allow-max-rows-in-at-least.yamsql | 34 +++ .../do-not-allow-max-rows-in-less-than.yamsql | 34 +++ .../explain-after-version.yamsql | 34 +++ .../less-than-version-tests.yamsql | 76 +++++++ .../initial-version/mid-query.yamsql | 40 ++++ .../non-exhaustive-current-version.yamsql | 32 +++ .../non-exhaustive-versions.yamsql | 32 +++ .../wrong-count-at-least.yamsql | 33 +++ .../wrong-count-less-than.yamsql | 33 +++ .../wrong-error-at-least.yamsql | 32 +++ .../wrong-error-less-than.yamsql | 32 +++ .../wrong-result-at-least.yamsql | 32 +++ .../wrong-result-less-than.yamsql | 32 +++ .../wrong-unordered-at-least.yamsql | 32 +++ .../wrong-unordered-less-than.yamsql | 32 +++ .../src/test/resources/recursive-cte.yamsql | 2 +- yaml-tests/src/test/resources/union.yamsql | 9 +- 46 files changed, 1516 insertions(+), 202 deletions(-) create mode 100644 yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/CodeVersion.java create mode 100644 yaml-tests/src/test/java/InitialVersionTest.java create mode 100644 yaml-tests/src/test/resources/initial-version/at-least-current-version.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/at-least-version-tests.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/do-not-allow-max-rows-in-at-least.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/do-not-allow-max-rows-in-less-than.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/explain-after-version.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/less-than-version-tests.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/mid-query.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/non-exhaustive-current-version.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/non-exhaustive-versions.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/wrong-count-at-least.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/wrong-count-less-than.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/wrong-error-at-least.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/wrong-error-less-than.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/wrong-result-at-least.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/wrong-result-less-than.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/wrong-unordered-at-least.yamsql create mode 100644 yaml-tests/src/test/resources/initial-version/wrong-unordered-less-than.yamsql diff --git a/.github/workflows/pr_labels.yml b/.github/workflows/pr_labels.yml index 90512d183a..a758b79f5e 100644 --- a/.github/workflows/pr_labels.yml +++ b/.github/workflows/pr_labels.yml @@ -2,7 +2,9 @@ name: Pull Request Labels on: pull_request: - types: [opened, labeled, unlabeled] + # Run whenever the labels change or the PR HEAD changes. In theory, the latter is a bit redundant, + # but it's necessary to make sure that the check is applied to the final commit for a PR + types: [opened, reopened, labeled, unlabeled, synchronize] jobs: labels: diff --git a/build.gradle b/build.gradle index 31ff712aee..52d902e310 100644 --- a/build.gradle +++ b/build.gradle @@ -279,6 +279,7 @@ subprojects { sourceSets["test"].resources.srcDirs.stream().flatMap( resourceDir -> fileTree(dir: resourceDir).matching { include '**/*.yamsql' + exclude '/initial-version/*' exclude '/supported-version/*' }.stream() ).forEach { yamsql -> diff --git a/scripts/YAML-SQL.xml b/scripts/YAML-SQL.xml index c9169742c9..dee2702b8f 100644 --- a/scripts/YAML-SQL.xml +++ b/scripts/YAML-SQL.xml @@ -51,8 +51,9 @@ - diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/CustomYamlConstructor.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/CustomYamlConstructor.java index 725942f275..1b3a801243 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/CustomYamlConstructor.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/CustomYamlConstructor.java @@ -75,6 +75,8 @@ public CustomYamlConstructor(LoaderOptions loaderOptions) { requireLineNumber.add(QueryConfig.QUERY_CONFIG_PLAN_HASH); requireLineNumber.add(QueryConfig.QUERY_CONFIG_MAX_ROWS); requireLineNumber.add(QueryConfig.QUERY_CONFIG_SUPPORTED_VERSION); + requireLineNumber.add(QueryConfig.QUERY_CONFIG_INITIAL_VERSION_LESS_THAN); + requireLineNumber.add(QueryConfig.QUERY_CONFIG_INITIAL_VERSION_AT_LEAST); } @Override diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/MultiServerConnectionFactory.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/MultiServerConnectionFactory.java index dfe5a0a1d9..75b2c1100d 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/MultiServerConnectionFactory.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/MultiServerConnectionFactory.java @@ -25,6 +25,7 @@ import com.apple.foundationdb.relational.api.metrics.MetricCollector; import com.apple.foundationdb.relational.recordlayer.EmbeddedRelationalConnection; import com.apple.foundationdb.relational.util.Assert; +import com.apple.foundationdb.relational.yamltests.server.SemanticVersion; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.junit.jupiter.api.Assertions; @@ -49,7 +50,7 @@ public class MultiServerConnectionFactory implements YamlConnectionFactory { // The fixed index of the default connection public static final int DEFAULT_CONNECTION = 0; - private final Set versionsUnderTest; + private final Set versionsUnderTest; /** * Server selection policy. @@ -96,7 +97,7 @@ public YamlConnection getNewConnection(@Nonnull URI connectPath) throws SQLExcep } @Override - public Set getVersionsUnderTest() { + public Set getVersionsUnderTest() { return versionsUnderTest; } @@ -148,7 +149,7 @@ public static class MultiServerConnection implements YamlConnection { @Nonnull private final List underlyingConnections; @Nonnull - private final List versions; + private final List versions; public MultiServerConnection(@Nonnull ConnectionSelectionPolicy connectionSelectionPolicy, final int initialConnecion, @@ -188,10 +189,16 @@ public EmbeddedRelationalConnection tryGetEmbedded() { @Nonnull @Override - public List getVersions() { + public List getVersions() { return this.versions; } + @Nonnull + @Override + public SemanticVersion getInitialVersion() { + return versions.get(0); + } + @Override public void close() throws SQLException { logger.info("Sending operation {} to all connections", "close"); @@ -228,16 +235,16 @@ private YamlConnection getCurrentConnection(boolean advance, String op) { throw new IllegalStateException("Unsupported selection policy " + connectionSelectionPolicy); } - private static List createVersionsList(final int initialConnecion, - final List relationalConnections) { - List versions = new ArrayList<>(); - for (int i = initialConnecion; i < relationalConnections.size(); i++) { - final List underlying = relationalConnections.get(i).getVersions(); + private static List createVersionsList(final int initialConnection, + final List relationalConnections) { + List versions = new ArrayList<>(); + for (int i = initialConnection; i < relationalConnections.size(); i++) { + final List underlying = relationalConnections.get(i).getVersions(); Assert.thatUnchecked(underlying.size() == 1, "Part of multi server config has more than one version"); versions.add(underlying.get(0)); } - for (int i = 0; i < initialConnecion; i++) { - final List underlying = relationalConnections.get(i).getVersions(); + for (int i = 0; i < initialConnection; i++) { + final List underlying = relationalConnections.get(i).getVersions(); Assert.thatUnchecked(underlying.size() == 1, "Part of multi server config has more than one version"); versions.add(underlying.get(0)); } diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/SimpleYamlConnection.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/SimpleYamlConnection.java index b8ed498b0f..6242272b4d 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/SimpleYamlConnection.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/SimpleYamlConnection.java @@ -25,6 +25,7 @@ import com.apple.foundationdb.relational.api.RelationalStatement; import com.apple.foundationdb.relational.api.metrics.MetricCollector; import com.apple.foundationdb.relational.recordlayer.EmbeddedRelationalConnection; +import com.apple.foundationdb.relational.yamltests.server.SemanticVersion; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -39,9 +40,9 @@ public class SimpleYamlConnection implements YamlConnection { @Nonnull private final RelationalConnection underlying; @Nonnull - private final List versions; + private final List versions; - public SimpleYamlConnection(@Nonnull Connection connection, @Nonnull String version) throws SQLException { + public SimpleYamlConnection(@Nonnull Connection connection, @Nonnull SemanticVersion version) throws SQLException { underlying = connection.unwrap(RelationalConnection.class); this.versions = List.of(version); } @@ -84,7 +85,13 @@ public EmbeddedRelationalConnection tryGetEmbedded() { @Nonnull @Override - public List getVersions() { + public List getVersions() { return versions; } + + @Nonnull + @Override + public SemanticVersion getInitialVersion() { + return versions.get(0); + } } diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlConnection.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlConnection.java index dd0b50f404..8e5033bf79 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlConnection.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlConnection.java @@ -25,6 +25,7 @@ import com.apple.foundationdb.relational.api.RelationalStatement; import com.apple.foundationdb.relational.api.metrics.MetricCollector; import com.apple.foundationdb.relational.recordlayer.EmbeddedRelationalConnection; +import com.apple.foundationdb.relational.yamltests.server.SemanticVersion; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -35,11 +36,6 @@ * A wrapper around {@link java.sql.Connection} to support yaml tests. */ public interface YamlConnection extends AutoCloseable { - /** - * String for representing the current version of the code. - */ - String CURRENT_VERSION = "!currentVersion"; - /** * Close this connection. * @throws SQLException if there was an issue closing the underlying connection(s). @@ -91,5 +87,18 @@ public interface YamlConnection extends AutoCloseable { * @return the ordered list of versions */ @Nonnull - List getVersions(); + List getVersions(); + + /** + * Return the initial version returned by this connection. If this connection + * wraps multiple versions, it may return different underlying connections + * with every call to {@link #createStatement()}. This returns the version + * associated with the first such call, which can impact the set of results + * that we expect to return as that is also the connection that should be + * used for query planning. + * + * @return the first version that an underlying connection will represent + */ + @Nonnull + SemanticVersion getInitialVersion(); } diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlConnectionFactory.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlConnectionFactory.java index db8610629a..ed368fe181 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlConnectionFactory.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlConnectionFactory.java @@ -21,6 +21,7 @@ package com.apple.foundationdb.relational.yamltests; import com.apple.foundationdb.relational.api.RelationalConnection; +import com.apple.foundationdb.relational.yamltests.server.SemanticVersion; import javax.annotation.Nonnull; import java.net.URI; @@ -53,7 +54,7 @@ public interface YamlConnectionFactory { * @return A set of versions that we are testing against, or an empty set if just testing against the current * version */ - Set getVersionsUnderTest(); + Set getVersionsUnderTest(); /** * Whether the connection supports multiple servers. diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/block/FileOptions.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/block/FileOptions.java index b1966ebb4b..662431fe8e 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/block/FileOptions.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/block/FileOptions.java @@ -23,6 +23,7 @@ import com.apple.foundationdb.relational.yamltests.CustomYamlConstructor; import com.apple.foundationdb.relational.yamltests.Matchers; import com.apple.foundationdb.relational.yamltests.YamlExecutionContext; +import com.apple.foundationdb.relational.yamltests.server.SemanticVersion; import com.apple.foundationdb.relational.yamltests.server.SupportedVersionCheck; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -55,8 +56,7 @@ public class FileOptions { public static Block parse(int lineNumber, Object document, YamlExecutionContext executionContext) { final Map options = CustomYamlConstructor.LinedObject.unlineKeys(Matchers.map(document, OPTIONS)); - Object rawVersion = options.get(SUPPORTED_VERSION_OPTION); - final SupportedVersionCheck check = SupportedVersionCheck.parse(rawVersion, executionContext); + final SupportedVersionCheck check = SupportedVersionCheck.parseOptions(options, executionContext); if (!check.isSupported()) { // IntelliJ, at least, doesn't display the reason, so log it if (logger.isInfoEnabled()) { @@ -67,15 +67,26 @@ public static Block parse(int lineNumber, Object document, YamlExecutionContext return new NoOpBlock(lineNumber); } + public static SemanticVersion parseVersion(Object rawVersion) { + if (rawVersion instanceof CurrentVersion) { + return SemanticVersion.current(); + } else if (rawVersion instanceof String) { + return SemanticVersion.parse((String) rawVersion); + } else { + throw new IllegalArgumentException("Unable to determine semantic version from object: " + rawVersion); + } + } + public static final class CurrentVersion { public static final CurrentVersion INSTANCE = new CurrentVersion(); + public static final String TEXT = SemanticVersion.SemanticVersionType.CURRENT.getText(); private CurrentVersion() { } @Override public String toString() { - return "!current_version"; + return TEXT; } } } diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/block/TestBlock.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/block/TestBlock.java index 40cd6dea3d..c3fe4d1c7c 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/block/TestBlock.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/block/TestBlock.java @@ -104,7 +104,6 @@ public final class TestBlock extends ConnectedBlock { static final String OPTION_STATEMENT_TYPE = "statement_type"; static final String OPTION_STATEMENT_TYPE_SIMPLE = "simple"; static final String OPTION_STATEMENT_TYPE_PREPARED = "prepared"; - static final String OPTION_SUPPORTED_VERSION = FileOptions.SUPPORTED_VERSION_OPTION; /** * Defines the way in which the tests are run. @@ -190,7 +189,7 @@ private static class TestBlockOptions { private boolean checkCache = true; private ConnectionLifecycle connectionLifecycle = ConnectionLifecycle.TEST; private StatementType statementType = StatementType.BOTH; - private Object rawSupportedVersion; + private SupportedVersionCheck supportedVersionCheck = SupportedVersionCheck.supported(); private void verifyPreset(@Nonnull String preset) { switch (preset) { @@ -224,7 +223,7 @@ private void setWithPreset(@Nonnull String preset) { } } - private void setWithOptionsMap(@Nonnull Map optionsMap) { + private void setWithOptionsMap(@Nonnull Map optionsMap, @Nonnull YamlExecutionContext executionContext) { setOptionExecutionModeAndRepetition(optionsMap); if (optionsMap.containsKey(OPTION_SEED)) { this.seed = Matchers.longValue(optionsMap.get(OPTION_SEED)); @@ -246,9 +245,7 @@ private void setWithOptionsMap(@Nonnull Map optionsMap) { break; } } - if (optionsMap.containsKey(OPTION_SUPPORTED_VERSION)) { - this.rawSupportedVersion = optionsMap.get(OPTION_SUPPORTED_VERSION); - } + supportedVersionCheck = SupportedVersionCheck.parseOptions(optionsMap, executionContext); setOptionConnectionLifecycle(optionsMap); } @@ -330,7 +327,7 @@ public static Block parse(int blockNumber, int lineNumber, @Nonnull Object docum } // higher priority than the preset is that of options map, set the options according to that, if any is present. if (testsMap.get(TEST_BLOCK_OPTIONS) != null) { - options.setWithOptionsMap(CustomYamlConstructor.LinedObject.unlineKeys(Matchers.map(testsMap.get(TEST_BLOCK_OPTIONS)))); + options.setWithOptionsMap(CustomYamlConstructor.LinedObject.unlineKeys(Matchers.map(testsMap.get(TEST_BLOCK_OPTIONS))), executionContext); } // execution context carries the highest priority, try setting options per that if it has some options to override. options.setWithExecutionContext(executionContext); @@ -338,11 +335,8 @@ public static Block parse(int blockNumber, int lineNumber, @Nonnull Object docum final String blockName = testsMap.containsKey(TEST_BLOCK_NAME) ? Matchers.string(testsMap.get(TEST_BLOCK_NAME)) : "unnamed-" + blockNumber; final var testsObject = Matchers.notNull(testsMap.get(TEST_BLOCK_TESTS), "‼️ tests not found at line " + lineNumber); - if (options.rawSupportedVersion != null) { - final SupportedVersionCheck check = SupportedVersionCheck.parse(options.rawSupportedVersion, executionContext); - if (!check.isSupported()) { - return new SkipBlock(lineNumber, check.getMessage()); - } + if (!options.supportedVersionCheck.isSupported()) { + return new SkipBlock(lineNumber, options.supportedVersionCheck.getMessage()); } var randomGenerator = new Random(options.seed); final var executables = new ArrayList>(); diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryCommand.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryCommand.java index 42e406e418..1a474aa6cf 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryCommand.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryCommand.java @@ -87,14 +87,10 @@ public static Command parse(@Nonnull final Object object, @Nonnull final String } final var queryString = Matchers.notNull(Matchers.string(queryCommand.getValue(), "query string"), "query string"); final var queryInterpreter = QueryInterpreter.withQueryString(lineNumber, queryString, executionContext); - final var queryConfigsWithValueList = Matchers.arrayList(object).stream().skip(1).collect(Collectors.toList()); + final List queryConfigsWithValueList = Matchers.arrayList(object).stream().skip(1).collect(Collectors.toList()); final var configs = queryConfigsWithValueList.isEmpty() ? List.of(QueryConfig.getNoCheckConfig(lineNumber, executionContext)) : - queryConfigsWithValueList.stream().map(l -> QueryConfig.parse(l, blockName, executionContext)).collect(Collectors.toList()); - - Assert.thatUnchecked(configs.stream().skip(1) - .noneMatch(config -> QueryConfig.QUERY_CONFIG_SUPPORTED_VERSION.equals(config.getConfigName())), - "supported_version must be the first config in a query (after the query itself)"); + QueryConfig.parseConfigs(blockName, lineNumber, queryConfigsWithValueList, executionContext); final List skipConfigs = configs.stream().filter(config -> config instanceof QueryConfig.SkipConfig) .collect(Collectors.toList()); @@ -156,13 +152,25 @@ void executeInternal(@Nonnull final YamlConnection connection) throws SQLExcepti private void executeInternal(@Nonnull final YamlConnection connection, boolean checkCache, @Nonnull QueryExecutor executor) throws SQLException, RelationalException { enableCascadesDebugger(); + boolean shouldExecute = true; boolean queryIsRunning = false; Continuation continuation = null; Integer maxRows = null; boolean exhausted = false; + boolean errored = false; var queryConfigsIterator = queryConfigs.listIterator(); while (queryConfigsIterator.hasNext()) { var queryConfig = queryConfigsIterator.next(); + if (queryConfig instanceof QueryConfig.InitialVersionCheckConfig) { + Assert.thatUnchecked(!queryIsRunning, "Initial version checks should not be executed while a query is running"); + shouldExecute = ((QueryConfig.InitialVersionCheckConfig)queryConfig).shouldExecute(connection); + continue; + } + if (!shouldExecute) { + continue; + } + + Assert.that(!errored, "ERROR config should be the last config specified."); if (QueryConfig.QUERY_CONFIG_MAX_ROWS.equals(queryConfig.getConfigName())) { maxRows = Integer.parseInt(queryConfig.getValueString()); } else if (QueryConfig.QUERY_CONFIG_PLAN_HASH.equals(queryConfig.getConfigName())) { @@ -173,7 +181,7 @@ private void executeInternal(@Nonnull final YamlConnection connection, boolean c Integer finalMaxRows = maxRows; runWithDebugger(() -> executor.execute(connection, null, queryConfig, checkCache, finalMaxRows)); } else if (QueryConfig.QUERY_CONFIG_EXPLAIN.equals(queryConfig.getConfigName()) || QueryConfig.QUERY_CONFIG_EXPLAIN_CONTAINS.equals(queryConfig.getConfigName())) { - Assert.thatUnchecked(!queryIsRunning, "Explain test should not be intermingled with query result tests"); + Assert.that(!queryIsRunning, "Explain test should not be intermingled with query result tests"); // ignore debugger configuration, always set the debugger for explain, so we can always get consistent // results Integer finalMaxRows1 = maxRows; @@ -183,7 +191,7 @@ private void executeInternal(@Nonnull final YamlConnection connection, boolean c continue; } else if (!QueryConfig.QUERY_CONFIG_SUPPORTED_VERSION.equals(queryConfig.getConfigName())) { if (QueryConfig.QUERY_CONFIG_ERROR.equals(queryConfig.getConfigName())) { - Assert.that(!queryConfigsIterator.hasNext(), "ERROR config should be the last config specified."); + errored = true; } if (exhausted && (QueryConfig.QUERY_CONFIG_RESULT.equals(queryConfig.getConfigName()) || QueryConfig.QUERY_CONFIG_UNORDERED_RESULT.equals(queryConfig.getConfigName()))) { diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryConfig.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryConfig.java index 5d6c458c55..3d70fa16f0 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryConfig.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryConfig.java @@ -30,12 +30,17 @@ import com.apple.foundationdb.relational.yamltests.YamlExecutionContext; import com.apple.foundationdb.relational.yamltests.block.FileOptions; import com.apple.foundationdb.relational.yamltests.generated.stats.PlannerMetricsProto; +import com.apple.foundationdb.relational.yamltests.server.SemanticVersion; import com.apple.foundationdb.relational.yamltests.server.SupportedVersionCheck; import com.apple.foundationdb.tuple.ByteArrayUtil2; import com.github.difflib.text.DiffRow; import com.github.difflib.text.DiffRowGenerator; import com.google.common.base.Verify; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Range; +import com.google.common.collect.RangeSet; +import com.google.common.collect.TreeRangeSet; import com.google.protobuf.Descriptors; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -45,10 +50,12 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.sql.SQLException; +import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Objects; import java.util.Locale; +import java.util.Objects; +import java.util.Set; import static com.apple.foundationdb.relational.yamltests.command.QueryCommand.reportTestFailure; @@ -75,8 +82,13 @@ public abstract class QueryConfig { public static final String QUERY_CONFIG_NO_CHECKS = "noChecks"; public static final String QUERY_CONFIG_MAX_ROWS = "maxRows"; public static final String QUERY_CONFIG_SUPPORTED_VERSION = FileOptions.SUPPORTED_VERSION_OPTION; + public static final String QUERY_CONFIG_INITIAL_VERSION_AT_LEAST = "initialVersionAtLeast"; + public static final String QUERY_CONFIG_INITIAL_VERSION_LESS_THAN = "initialVersionLessThan"; public static final String QUERY_CONFIG_NO_OP = "noOp"; + private static final Set RESULT_CONFIGS = ImmutableSet.of(QUERY_CONFIG_ERROR, QUERY_CONFIG_COUNT, QUERY_CONFIG_RESULT, QUERY_CONFIG_UNORDERED_RESULT); + private static final Set VERSION_DEPENDENT_RESULT_CONFIGS = ImmutableSet.of(QUERY_CONFIG_INITIAL_VERSION_AT_LEAST, QUERY_CONFIG_INITIAL_VERSION_LESS_THAN); + @Nullable private final Object value; private final int lineNumber; @Nonnull @@ -453,15 +465,15 @@ void checkResultInternal(@Nonnull String currentQuery, @Nonnull Object actual, @ }; } - private static QueryConfig getSupportedVersionConfig(final Object value, final int lineNumber, final YamlExecutionContext executionContext) { - final SupportedVersionCheck check = SupportedVersionCheck.parse(value, executionContext); + @Nonnull + public static QueryConfig getSupportedVersionConfig(Object rawVersion, final int lineNumber, final YamlExecutionContext executionContext) { + final SupportedVersionCheck check = SupportedVersionCheck.parse(rawVersion, executionContext); if (!check.isSupported()) { - return new SkipConfig(QUERY_CONFIG_SUPPORTED_VERSION, value, lineNumber, executionContext, check.getMessage()); + return new SkipConfig(QUERY_CONFIG_SUPPORTED_VERSION, rawVersion, lineNumber, executionContext, check.getMessage()); } - return new QueryConfig(QUERY_CONFIG_SUPPORTED_VERSION, value, lineNumber, executionContext) { + return new QueryConfig(QUERY_CONFIG_SUPPORTED_VERSION, rawVersion, lineNumber, executionContext) { @Override - void checkResultInternal(@Nonnull final String currentQuery, @Nonnull final Object actual, - @Nonnull final String queryDescription) throws SQLException { + void checkResultInternal(@Nonnull final String currentQuery, @Nonnull final Object actual, @Nonnull final String queryDescription) throws SQLException { // Nothing to do, this query is supported // SupportedVersion configs are not executed Assertions.fail("Supported version configs are not meant to be executed."); @@ -488,46 +500,111 @@ void checkResultInternal(@Nonnull String currentQuery, @Nonnull Object actual, @ }; } - public static QueryConfig parse(@Nonnull Object object, @Nonnull String blockName, @Nonnull YamlExecutionContext executionContext) { - final var configEntry = Matchers.notNull(Matchers.firstEntry(object, "query configuration"), "query configuration"); - final var linedObject = CustomYamlConstructor.LinedObject.cast(configEntry.getKey(), () -> "Invalid config key-value pair: " + configEntry); - final var lineNumber = linedObject.getLineNumber(); - try { - final var key = Matchers.notNull(Matchers.string(linedObject.getObject(), "query configuration"), "query configuration"); - final var value = Matchers.notNull(configEntry, "query configuration").getValue(); - if (QUERY_CONFIG_COUNT.equals(key)) { - return getCheckCountConfig(value, lineNumber, executionContext); - } else if (QUERY_CONFIG_ERROR.equals(key)) { - return getCheckErrorConfig(value, lineNumber, executionContext); - } else if (QUERY_CONFIG_EXPLAIN.equals(key)) { - if (shouldExecuteExplain(executionContext)) { - return getCheckExplainConfig(true, blockName, key, value, lineNumber, executionContext); - } else { - return getNoOpConfig(lineNumber, executionContext); - } - } else if (QUERY_CONFIG_EXPLAIN_CONTAINS.equals(key)) { - if (shouldExecuteExplain(executionContext)) { - return getCheckExplainConfig(false, blockName, key, value, lineNumber, executionContext); - } else { - return getNoOpConfig(lineNumber, executionContext); + @Nonnull + public static List parseConfigs(String blockName, int commandLineNumber, @Nonnull List objects, @Nonnull YamlExecutionContext executionContext) { + List configs = new ArrayList<>(); + // After the first result config, require all future results are also result configs. That is, we should + // not interleave explain, maxRows, etc., and result configurations, and the results should be the last + boolean requireResults = false; + + for (Object object : objects) { + final var configEntry = Matchers.notNull(Matchers.firstEntry(object, "query configuration"), "query configuration"); + final var linedObject = CustomYamlConstructor.LinedObject.cast(configEntry.getKey(), () -> "Invalid config key-value pair: " + configEntry); + final var lineNumber = linedObject.getLineNumber(); + try { + final var key = Matchers.notNull(Matchers.string(linedObject.getObject(), "query configuration"), "query configuration"); + final var value = Matchers.notNull(configEntry, "query configuration").getValue(); + boolean resultOrVersionConfig = RESULT_CONFIGS.contains(key) || VERSION_DEPENDENT_RESULT_CONFIGS.contains(key); + if (requireResults && !resultOrVersionConfig) { + throw new IllegalArgumentException("Only result configurations can follow first result or version specification config"); } - } else if (QUERY_CONFIG_PLAN_HASH.equals(key)) { - return getCheckPlanHashConfig(value, lineNumber, executionContext); - } else if (key.contains(QUERY_CONFIG_RESULT)) { - return getCheckResultConfig(true, key, value, lineNumber, executionContext); - } else if (QUERY_CONFIG_UNORDERED_RESULT.equals(key)) { - return getCheckResultConfig(false, key, value, lineNumber, executionContext); - } else if (QUERY_CONFIG_MAX_ROWS.equals(key)) { - return getMaxRowConfig(value, lineNumber, executionContext); - } else if (QUERY_CONFIG_SUPPORTED_VERSION.equals(key)) { - return getSupportedVersionConfig(value, lineNumber, executionContext); + requireResults |= resultOrVersionConfig; + configs.add(parseConfig(blockName, key, value, lineNumber, executionContext)); + } catch (Exception e) { + throw executionContext.wrapContext(e, () -> "‼️ Error parsing the query config at line " + lineNumber, "config", lineNumber); + } + } + + validateConfigs(configs, commandLineNumber, executionContext); + return configs; + } + + private static QueryConfig getInitialVersionCheckConfig(Object key, Object value, int lineNumber, YamlExecutionContext executionContext) { + try { + SemanticVersion versionArgument = FileOptions.parseVersion(value); + if (QUERY_CONFIG_INITIAL_VERSION_AT_LEAST.equals(key)) { + return new InitialVersionCheckConfig(QueryConfig.QUERY_CONFIG_INITIAL_VERSION_AT_LEAST, value, lineNumber, executionContext, + versionArgument, SemanticVersion.max()); + } else if (QUERY_CONFIG_INITIAL_VERSION_LESS_THAN.equals(key)) { + return new InitialVersionCheckConfig(QueryConfig.QUERY_CONFIG_INITIAL_VERSION_LESS_THAN, value, lineNumber, executionContext, + SemanticVersion.min(), versionArgument); } else { - Assert.failUnchecked("‼️ '%s' is not a valid configuration"); + throw new IllegalArgumentException("Unknown version constraint " + key); } - // should not happen - return null; } catch (Exception e) { - throw executionContext.wrapContext(e, () -> "‼️ Error parsing the query config at line " + lineNumber, "config", lineNumber); + throw executionContext.wrapContext(e, () -> "‼️ Unable to parse version constraint information at line " + lineNumber, "version constraint", lineNumber); + } + } + + private static QueryConfig parseConfig(String blockName, String key, Object value, int lineNumber, YamlExecutionContext executionContext) { + if (QUERY_CONFIG_SUPPORTED_VERSION.equals(key)) { + return getSupportedVersionConfig(value, lineNumber, executionContext); + } else if (VERSION_DEPENDENT_RESULT_CONFIGS.contains(key)) { + return getInitialVersionCheckConfig(key, value, lineNumber, executionContext); + } else if (QUERY_CONFIG_COUNT.equals(key)) { + return getCheckCountConfig(value, lineNumber, executionContext); + } else if (QUERY_CONFIG_ERROR.equals(key)) { + return getCheckErrorConfig(value, lineNumber, executionContext); + } else if (QUERY_CONFIG_EXPLAIN.equals(key)) { + if (shouldExecuteExplain(executionContext)) { + return getCheckExplainConfig(true, blockName, key, value, lineNumber, executionContext); + } else { + return getNoOpConfig(lineNumber, executionContext); + } + } else if (QUERY_CONFIG_EXPLAIN_CONTAINS.equals(key)) { + if (shouldExecuteExplain(executionContext)) { + return getCheckExplainConfig(false, blockName, key, value, lineNumber, executionContext); + } else { + return getNoOpConfig(lineNumber, executionContext); + } + } else if (QUERY_CONFIG_PLAN_HASH.equals(key)) { + if (shouldExecuteExplain(executionContext)) { + return getCheckPlanHashConfig(value, lineNumber, executionContext); + } else { + return getNoOpConfig(lineNumber, executionContext); + } + } else if (QUERY_CONFIG_RESULT.equals(key)) { + return getCheckResultConfig(true, key, value, lineNumber, executionContext); + } else if (QUERY_CONFIG_UNORDERED_RESULT.equals(key)) { + return getCheckResultConfig(false, key, value, lineNumber, executionContext); + } else if (QUERY_CONFIG_MAX_ROWS.equals(key)) { + return getMaxRowConfig(value, lineNumber, executionContext); + } else { + throw Assert.failUnchecked("‼️ '%s' is not a valid configuration"); + } + } + + private static void validateConfigs(List configs, int lineNumber, YamlExecutionContext executionContext) { + Assert.thatUnchecked(configs.stream().skip(1) + .noneMatch(config -> QueryConfig.QUERY_CONFIG_SUPPORTED_VERSION.equals(config.getConfigName())), + "supported_version must be the first config in a query (after the query itself)"); + + // Validate that the results check each version comprehensively by making sure the set of + // covered ranges spans the range [MIN_VERSION, MAX_VERSION) + if (configs.stream().anyMatch(config -> config instanceof QueryConfig.InitialVersionCheckConfig)) { + // Creating an interval set including each covered range + RangeSet rangeSet = TreeRangeSet.create(); + configs.stream().filter(config -> config instanceof QueryConfig.InitialVersionCheckConfig) + .map(config -> (QueryConfig.InitialVersionCheckConfig)config) + .forEach(config -> rangeSet.add(Range.closedOpen(config.getMinVersion(), config.getMaxVersion()))); + // Get the set of uncovered ranges that span over [MIN_VERSION, MAX_VERSION) + Set> uncovered = rangeSet.complement() + .subRangeSet(Range.closedOpen(SemanticVersion.min(), SemanticVersion.max())) + .asRanges(); + if (!uncovered.isEmpty()) { + IllegalArgumentException e = new IllegalArgumentException("Test case does not cover complete set of versions as it is missing: " + uncovered); + throw executionContext.wrapContext(e, () -> "‼️ Non-comprehensive test case found at line " + lineNumber, "config", lineNumber); + } } } @@ -550,6 +627,38 @@ public String getMessage() { } } + public static class InitialVersionCheckConfig extends QueryConfig { + private final SemanticVersion minVersion; + private final SemanticVersion maxVersion; + + public InitialVersionCheckConfig(final String configName, final Object value, final int lineNumber, final YamlExecutionContext executionContext, + SemanticVersion minVersion, SemanticVersion maxVersion) { + super(configName, value, lineNumber, executionContext); + this.minVersion = minVersion; + this.maxVersion = maxVersion; + } + + public boolean shouldExecute(YamlConnection connection) { + SemanticVersion initialVersion = connection.getInitialVersion(); + return initialVersion.compareTo(minVersion) >= 0 && initialVersion.compareTo(maxVersion) < 0; + } + + @Override + void checkResultInternal(@Nonnull final String currentQuery, @Nonnull final Object actual, @Nonnull final String queryDescription) throws SQLException { + Assertions.fail("Check version config should not be executed: Line: " + getLineNumber()); + } + + @Nonnull + public SemanticVersion getMinVersion() { + return minVersion; + } + + @Nonnull + public SemanticVersion getMaxVersion() { + return maxVersion; + } + } + private static boolean shouldExecuteExplain(final YamlExecutionContext executionContext) { return (! executionContext.getConnectionFactory().isMultiServer()); } diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/configs/EmbeddedConfig.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/configs/EmbeddedConfig.java index 3e6414e6a9..a18b7c6bfc 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/configs/EmbeddedConfig.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/configs/EmbeddedConfig.java @@ -26,6 +26,7 @@ import com.apple.foundationdb.relational.yamltests.YamlConnection; import com.apple.foundationdb.relational.yamltests.YamlConnectionFactory; import com.apple.foundationdb.relational.yamltests.YamlExecutionContext; +import com.apple.foundationdb.relational.yamltests.server.SemanticVersion; import javax.annotation.Nonnull; import java.net.URI; @@ -63,13 +64,14 @@ public YamlConnectionFactory createConnectionFactory() { return new YamlConnectionFactory() { @Override public YamlConnection getNewConnection(@Nonnull URI connectPath) throws SQLException { - return new SimpleYamlConnection(DriverManager.getConnection(connectPath.toString()), YamlConnection.CURRENT_VERSION); + return new SimpleYamlConnection(DriverManager.getConnection(connectPath.toString()), SemanticVersion.current()); } @Override - public Set getVersionsUnderTest() { - return Set.of(); + public Set getVersionsUnderTest() { + return Set.of(SemanticVersion.current()); } + }; } diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/configs/JDBCInProcessConfig.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/configs/JDBCInProcessConfig.java index 58fdcf8eef..f67b3ed6b7 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/configs/JDBCInProcessConfig.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/configs/JDBCInProcessConfig.java @@ -26,6 +26,7 @@ import com.apple.foundationdb.relational.yamltests.YamlConnection; import com.apple.foundationdb.relational.yamltests.YamlConnectionFactory; import com.apple.foundationdb.relational.yamltests.YamlExecutionContext; +import com.apple.foundationdb.relational.yamltests.server.SemanticVersion; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -71,13 +72,14 @@ public YamlConnection getNewConnection(@Nonnull URI connectPath) throws SQLExcep URI connectPathPlusServerName = JDBCURI.addQueryParameter(connectPath, JDBCURI.INPROCESS_URI_QUERY_SERVERNAME_KEY, server.getServerName()); String uriStr = connectPathPlusServerName.toString().replaceFirst("embed:", "relational://"); LOG.info("Rewrote {} as {}", connectPath, uriStr); - return new SimpleYamlConnection(DriverManager.getConnection(uriStr), YamlConnection.CURRENT_VERSION); + return new SimpleYamlConnection(DriverManager.getConnection(uriStr), SemanticVersion.current()); } @Override - public Set getVersionsUnderTest() { - return Set.of(); + public Set getVersionsUnderTest() { + return Set.of(SemanticVersion.current()); } + }; } diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/configs/MultiServerConfig.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/configs/MultiServerConfig.java index 9c707f234c..a04fade956 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/configs/MultiServerConfig.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/configs/MultiServerConfig.java @@ -25,6 +25,7 @@ import com.apple.foundationdb.relational.yamltests.YamlConnection; import com.apple.foundationdb.relational.yamltests.YamlConnectionFactory; import com.apple.foundationdb.relational.yamltests.server.ExternalServer; +import com.apple.foundationdb.relational.yamltests.server.SemanticVersion; import javax.annotation.Nonnull; import java.net.URI; @@ -70,9 +71,10 @@ public YamlConnection getNewConnection(@Nonnull URI connectPath) throws SQLExcep } @Override - public Set getVersionsUnderTest() { + public Set getVersionsUnderTest() { return Set.of(externalServer.getVersion()); } + }; } diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/CodeVersion.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/CodeVersion.java new file mode 100644 index 0000000000..08a4ba21bb --- /dev/null +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/CodeVersion.java @@ -0,0 +1,27 @@ +/* + * CodeVersion.java + * + * This source file is part of the FoundationDB open source project + * + * Copyright 2015-2025 Apple Inc. and the FoundationDB project authors + * + * Licensed 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. + */ + +package com.apple.foundationdb.relational.yamltests.server; + +/** + * Marker interface representing a code version. + */ +public interface CodeVersion extends Comparable { +} diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/ExternalServer.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/ExternalServer.java index e22ceebfde..a47de881e1 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/ExternalServer.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/ExternalServer.java @@ -20,6 +20,7 @@ package com.apple.foundationdb.relational.yamltests.server; +import com.apple.foundationdb.relational.util.BuildVersion; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.junit.jupiter.api.Assertions; @@ -45,7 +46,7 @@ public class ExternalServer { private final File serverJar; private final int grpcPort; private final int httpPort; - private String version; + private SemanticVersion version; private Process serverProcess; /** @@ -100,7 +101,7 @@ public int getPort() { * * @return the version of the server being run. */ - public String getVersion() { + public SemanticVersion getVersion() { return version; } @@ -147,13 +148,17 @@ public static List getAvailableServers() { return List.of(externalServers); } - private static String getVersion(File jar) throws IOException { + private static SemanticVersion getVersion(File jar) throws IOException { try (JarFile jarFile = new JarFile(jar)) { final Manifest manifest = jarFile.getManifest(); final Attributes mainAttributes = manifest.getMainAttributes(); String version = mainAttributes.getValue("Specification-Version"); if (version != null) { - return version; + if (version.equals(BuildVersion.getInstance().getVersion())) { + return SemanticVersion.current(); + } else { + return SemanticVersion.parse(version); + } } else { return Assertions.fail("Server does not specify a version in the manifest: " + jar.getAbsolutePath()); } diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/SemanticVersion.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/SemanticVersion.java index 3d50b86202..52831fabbe 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/SemanticVersion.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/SemanticVersion.java @@ -24,6 +24,8 @@ import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; +import java.util.EnumMap; import java.util.List; import java.util.Objects; import java.util.regex.Matcher; @@ -47,6 +49,30 @@ * at the end. Each version component is compared as integers, and versions with a different number of components * are not comparable. A version with {@code -SNAPSHOT} version added to a version the less than the same set of * numbers without {@code -SNAPSHOT} (e.g. {@code 3.4.5.1-SNAPSHOT < 3.4.5.1}). + *

+ * + *

+ * In addition, there are a set of "special" versions included that are not based on the version numbers. They + * stand in for special versions that are not encompassed by the normal version space. They are: + *

+ *
    + *
  • + * {@link #min()}: The minimum possible version. This is useful for specifying the endpoint of open version + * range. For example, set of all versions less than {@code 3.4.5.1} can be expressed as all versions between + * {@link #min()} and {@code 3.4.5.1}. + *
  • + *
  • + * {@link #current()}: The current version of the code. Before code is committed and released, it is useful to + * have a pointer to what will be the code's version even if it isn't known. For example, one might + * want to assert on what the behavior of any version older than the current version was. The {@link #current()} + * version provides that context, and it is assumed to be greater than all other versions (except the + * {@link #max()} version). + *
  • + *
  • + * {@link #max()}: The maximum possible version. Like {@link #min()}, this is also useful for specifying the + * endpoint of an open range. + *
  • + *
* @see Versioning */ public class SemanticVersion implements Comparable { @@ -57,6 +83,76 @@ public class SemanticVersion implements Comparable { "^(?" + NUMBER_PATTERN + "(?:\\." + NUMBER_PATTERN + ")*)" + "(?:-(?" + dotSeparated(PRE_RELEASE_PART) + "))?"); + /** + * Enum representing the type of this version. The {@link SemanticVersion} class is + * modeled like an algebraic data type that might look like, say: + * + *
{@code
+     * enum SemanticVersion {
+     *     case MIN
+     *     case NORMAL(versionNumbers: [Integer], preRelease: [String]),
+     *     case CURRENT
+     *     case MAX
+     * }
+     * }
+ * + *

+ * The {@code versionNumbers} and {@code preRelease} are only really relevant + * for the {@link #NORMAL} case. The other three cases are all singletons and do not + * contain any state themselves. + *

+ * + *

+ * The order here is important. Versions are ordered first by their type, and then + * by their other data (if appropriate). + *

+ */ + public enum SemanticVersionType { + MIN("!min_version", true), + NORMAL("", false), + CURRENT("!current_version", true), + MAX("!max_version", true), + ; + + @Nonnull + private final String text; + private final boolean singleton; + + SemanticVersionType(String text, boolean singleton) { + this.text = text; + this.singleton = singleton; + } + + @Nonnull + public String getText() { + return text; + } + + public boolean isSingleton() { + return singleton; + } + } + + @Nonnull + private static final EnumMap SINGLETONS = new EnumMap<>(SemanticVersionType.class); + + static { + Arrays.stream(SemanticVersionType.values()).forEach(type -> { + if (type.isSingleton()) { + SINGLETONS.put(type, new SemanticVersion(type, Collections.emptyList(), Collections.emptyList())); + } + }); + } + + /** + * The type of the semantic version. Determines whether this is a normal semantic version + * or one of the special stand-ins. See {@link SemanticVersionType} for more information. + * + * @see SemanticVersionType + */ + @Nonnull + private final SemanticVersionType type; + /** * The main version components. *

@@ -64,6 +160,7 @@ public class SemanticVersion implements Comparable { * class supports any number of version components. * When comparing, these are compared in order. */ + @Nonnull private final List versionNumbers; /** * The prerelease metadata, but only {@code SNAPSHOT} is supported. @@ -72,13 +169,46 @@ public class SemanticVersion implements Comparable { * and gradle and maven have complicated comparison that disagrees. A version that has the same value * {@link #versionNumbers} but an empty {@code prerelease} is greater than one with a non-empty {@code prerelease}. */ + @Nonnull private final List prerelease; - private SemanticVersion(@Nonnull List versionNumbers, @Nonnull List prerelease) { + private SemanticVersion(@Nonnull SemanticVersionType type, @Nonnull List versionNumbers, @Nonnull List prerelease) { + this.type = type; this.versionNumbers = versionNumbers; this.prerelease = prerelease; } + /** + * Get the special "point at negative infinity". Useful for range endpoints. + * + * @return a special version that is less than all other versions + */ + @Nonnull + public static SemanticVersion min() { + return SINGLETONS.get(SemanticVersionType.MIN); + } + + /** + * Get the special version indicating the current code version. Useful for asserting + * about behavior that differs between the current version and previous releases. + * + * @return a special version that represents the current (potentially unreleased) code version + */ + @Nonnull + public static SemanticVersion current() { + return SINGLETONS.get(SemanticVersionType.CURRENT); + } + + /** + * Get the special "point at positive infinity". Useful for range endpoints. + * + * @return a special version that is greater than all other versions + */ + @Nonnull + public static SemanticVersion max() { + return SINGLETONS.get(SemanticVersionType.MAX); + } + /** * Parse a version string (e.g. {@code 4.0.559.0} or {@code 4.0.560.0-SNAPSHOT}. * @param versionString a version in string form @@ -86,6 +216,12 @@ private SemanticVersion(@Nonnull List versionNumbers, @Nonnull List prerelease = prereleaseString == null ? List.of() : List.of(prereleaseString.split("\\.")); - return new SemanticVersion(versionNumbers, prerelease); + return new SemanticVersion(SemanticVersionType.NORMAL, versionNumbers, prerelease); + } + + /** + * Get the type of this version. See the {@link SemanticVersionType} enum for more details. + * + * @return the type of this version + * @see SemanticVersionType + */ + @Nonnull + public SemanticVersionType getType() { + return type; } @Nonnull @@ -108,6 +255,9 @@ private static String dotSeparated(@Nonnull String part) { @Override public String toString() { + if (type.isSingleton()) { + return type.getText(); + } String version = versionNumbers.stream().map(Object::toString).collect(Collectors.joining(".")); if (!prerelease.isEmpty()) { version = version + "-" + prerelease; @@ -124,17 +274,38 @@ public boolean equals(final Object o) { return false; } final SemanticVersion that = (SemanticVersion)o; - return Objects.equals(versionNumbers, that.versionNumbers) && Objects.equals(prerelease, that.prerelease); + return type.equals(that.type) + && Objects.equals(versionNumbers, that.versionNumbers) + && Objects.equals(prerelease, that.prerelease); } @Override public int hashCode() { - return Objects.hash(versionNumbers, prerelease); + return Objects.hash(type.name(), versionNumbers, prerelease); + } + + @Nonnull + public List lesserVersions(@Nonnull Collection rawVersions) { + return rawVersions.stream() + .filter(other -> other.compareTo(this) < 0) + .collect(Collectors.toList()); } @Override public int compareTo(@Nonnull SemanticVersion o) { - // negative if this is less than o + // First, compare by type using ordinal position. Values in the enum are sorted according + // to their expected precedence + int typeCompare = type.compareTo(o.type); + if (typeCompare != 0) { + return typeCompare; + } + + // For singleton values, type comparison is enough. + if (type.isSingleton()) { + return 0; + } + + // Otherwise, compare version numbers and pre-release information final int versionComparison = compareVersionNumbers(o); if (versionComparison != 0) { return versionComparison; @@ -142,14 +313,6 @@ public int compareTo(@Nonnull SemanticVersion o) { return comparePrerelease(o); } - @Nonnull - public List lesserVersions(@Nonnull Collection rawVersions) { - return rawVersions.stream() - .map(SemanticVersion::parse) - .filter(other -> other.compareTo(this) < 0) - .collect(Collectors.toList()); - } - private int compareVersionNumbers(@Nonnull SemanticVersion o) { // semver only allows 3, we only use 4. // gradle supports an arbitrary number, but it gets complicated if there is a pre-release or build info diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/SupportedVersionCheck.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/SupportedVersionCheck.java index a4cbf23859..a47d75dd80 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/SupportedVersionCheck.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/SupportedVersionCheck.java @@ -23,49 +23,49 @@ import com.apple.foundationdb.relational.yamltests.YamlExecutionContext; import com.apple.foundationdb.relational.yamltests.block.FileOptions; +import javax.annotation.Nonnull; import java.util.List; +import java.util.Map; import java.util.Set; /** * Class to support the various places in a yaml file where you can have supported_version. */ public class SupportedVersionCheck { + public static final String SUPPORTED_VERSION_OPTION = "supported_version"; + public static final SupportedVersionCheck SUPPORTED = new SupportedVersionCheck(true, ""); private final boolean isSupported; private final String message; - private SupportedVersionCheck() { - isSupported = true; - message = ""; + private SupportedVersionCheck(boolean isSupported, String message) { + this.isSupported = isSupported; + this.message = message; } - private SupportedVersionCheck(final String message) { - isSupported = false; - this.message = message; + public static SupportedVersionCheck parseOptions(Map options, YamlExecutionContext executionContext) { + if (options.containsKey(SUPPORTED_VERSION_OPTION)) { + return SupportedVersionCheck.parse(options.get(SUPPORTED_VERSION_OPTION), executionContext); + } else { + return SupportedVersionCheck.supported(); + } } public static SupportedVersionCheck parse(Object rawVersion, YamlExecutionContext executionContext) { - if (rawVersion instanceof FileOptions.CurrentVersion) { - final Set versionsUnderTest = executionContext.getConnectionFactory().getVersionsUnderTest(); - // IntelliJ, at least, doesn't display the reason, so log it - if (!versionsUnderTest.isEmpty()) { - return new SupportedVersionCheck( + SemanticVersion supportedVersion = FileOptions.parseVersion(rawVersion); + final Set versionsUnderTest = executionContext.getConnectionFactory().getVersionsUnderTest(); + final List unsupportedVersions = supportedVersion.lesserVersions(versionsUnderTest); + if (!unsupportedVersions.isEmpty()) { + if (SemanticVersion.current().equals(supportedVersion)) { + return SupportedVersionCheck.unsupported( "Skipping test that only works against the current version, when we're running with these versions: " + versionsUnderTest); - } - return new SupportedVersionCheck(); - } else if (rawVersion instanceof String) { - final SemanticVersion supported = SemanticVersion.parse((String)rawVersion); - final List unsupportedVersions = supported.lesserVersions( - executionContext.getConnectionFactory().getVersionsUnderTest()); - if (!unsupportedVersions.isEmpty()) { - return new SupportedVersionCheck("Skipping test that only works against " + supported + + } else { + return SupportedVersionCheck.unsupported("Skipping test that only works against " + supportedVersion + " and later, but we are running with these older versions: " + unsupportedVersions); } - return new SupportedVersionCheck(); - } else { - throw new RuntimeException("Unsupported supported_version: " + rawVersion); } + return supported(); } public boolean isSupported() { @@ -75,4 +75,12 @@ public boolean isSupported() { public String getMessage() { return message; } + + public static SupportedVersionCheck supported() { + return SUPPORTED; + } + + public static SupportedVersionCheck unsupported(@Nonnull String message) { + return new SupportedVersionCheck(false, message); + } } diff --git a/yaml-tests/src/test/java/InitialVersionTest.java b/yaml-tests/src/test/java/InitialVersionTest.java new file mode 100644 index 0000000000..af247c76aa --- /dev/null +++ b/yaml-tests/src/test/java/InitialVersionTest.java @@ -0,0 +1,161 @@ +/* + * InitialVersionTest.java + * + * This source file is part of the FoundationDB open source project + * + * Copyright 2015-2025 Apple Inc. and the FoundationDB project authors + * + * Licensed 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. + */ + +import com.apple.foundationdb.relational.yamltests.SimpleYamlConnection; +import com.apple.foundationdb.relational.yamltests.YamlConnection; +import com.apple.foundationdb.relational.yamltests.YamlConnectionFactory; +import com.apple.foundationdb.relational.yamltests.YamlExecutionContext; +import com.apple.foundationdb.relational.yamltests.YamlRunner; +import com.apple.foundationdb.relational.yamltests.configs.EmbeddedConfig; +import com.apple.foundationdb.relational.yamltests.server.SemanticVersion; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import javax.annotation.Nonnull; +import java.net.URI; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Set; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +/** + * Tests that tests based on the initial version flags skip what they should and nothing else. + */ +public class InitialVersionTest { + private static final SemanticVersion VERSION = SemanticVersion.parse("3.0.18.0"); + private static final EmbeddedConfig config = new EmbeddedConfig(); + + @BeforeAll + static void beforeAll() throws Exception { + config.beforeAll(); + } + + @AfterAll + static void afterAll() throws Exception { + config.afterAll(); + } + + private void doRunFixedVersion(String testName) throws Exception { + doRun(testName, createConnectionFactory()); + } + + private void doRunCurrentVersion(String testName) throws Exception { + doRun(testName, config.createConnectionFactory()); + } + + private void doRun(String testName, YamlConnectionFactory connectionFactory) throws Exception { + new YamlRunner("initial-version/" + testName + ".yamsql", connectionFactory, YamlExecutionContext.ContextOptions.EMPTY_OPTIONS).run(); + } + + YamlConnectionFactory createConnectionFactory() { + return new YamlConnectionFactory() { + @Override + public YamlConnection getNewConnection(@Nonnull URI connectPath) throws SQLException { + return new SimpleYamlConnection(DriverManager.getConnection(connectPath.toString()), VERSION); + } + + @Override + public Set getVersionsUnderTest() { + return Set.of(VERSION); + } + + }; + } + + static Stream shouldFail() { + return Stream.of( + "do-not-allow-max-rows-in-at-least", + "do-not-allow-max-rows-in-less-than", + "explain-after-version", + "mid-query", + "non-exhaustive-versions", + "non-exhaustive-current-version", + "wrong-result-at-least", + "wrong-result-less-than", + "wrong-count-at-least", + "wrong-count-less-than", + "wrong-unordered-at-least", + "wrong-unordered-less-than", + "wrong-error-at-least", + "wrong-error-less-than" + ); + } + + @ParameterizedTest + @MethodSource + void shouldFail(String testName) { + assertThrows(YamlExecutionContext.YamlExecutionError.class, () -> + doRunFixedVersion(testName)); + } + + + static Stream shouldPass() { + return Stream.of( + "less-than-version-tests", + "at-least-version-tests" + ); + } + + @ParameterizedTest + @MethodSource + void shouldPass(String testName) throws Exception { + doRunFixedVersion(testName); + } + + static Stream shouldFailOnCurrent() { + return Stream.of( + "mid-query", + "non-exhaustive-versions", + "non-exhaustive-current-version", + "wrong-result-at-least", + "wrong-count-at-least", + "wrong-unordered-at-least", + "wrong-error-at-least" + ); + } + + @ParameterizedTest + @MethodSource + void shouldFailOnCurrent(String testName) { + assertThrows(YamlExecutionContext.YamlExecutionError.class, () -> + doRunCurrentVersion(testName)); + } + + static Stream shouldPassOnCurrent() { + return Stream.of( + "at-least-current-version", + "at-least-version-tests", + "wrong-result-less-than", + "wrong-count-less-than", + "wrong-unordered-less-than", + "wrong-error-less-than" + ); + } + + @ParameterizedTest + @MethodSource + void shouldPassOnCurrent(String testName) throws Exception { + doRunCurrentVersion(testName); + } +} diff --git a/yaml-tests/src/test/java/MultiServerConnectionFactoryTest.java b/yaml-tests/src/test/java/MultiServerConnectionFactoryTest.java index 80c80dd1d4..acc1f6e0e6 100644 --- a/yaml-tests/src/test/java/MultiServerConnectionFactoryTest.java +++ b/yaml-tests/src/test/java/MultiServerConnectionFactoryTest.java @@ -24,6 +24,7 @@ import com.apple.foundationdb.relational.yamltests.SimpleYamlConnection; import com.apple.foundationdb.relational.yamltests.YamlConnection; import com.apple.foundationdb.relational.yamltests.YamlConnectionFactory; +import com.apple.foundationdb.relational.yamltests.server.SemanticVersion; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; @@ -39,88 +40,91 @@ import static org.junit.jupiter.api.Assertions.assertThrows; public class MultiServerConnectionFactoryTest { + private static final SemanticVersion PRIMARY_VERSION = SemanticVersion.parse("2.2.2.0"); + private static final SemanticVersion ALTERNATE_VERSION = SemanticVersion.parse("1.1.1.0"); + @ParameterizedTest @CsvSource({"0", "1"}) void testDefaultPolicy(int initialConnection) throws SQLException { MultiServerConnectionFactory classUnderTest = new MultiServerConnectionFactory( MultiServerConnectionFactory.ConnectionSelectionPolicy.DEFAULT, initialConnection, - dummyConnectionFactory("Primary"), - List.of(dummyConnectionFactory("Alternate"))); + dummyConnectionFactory(PRIMARY_VERSION), + List.of(dummyConnectionFactory(ALTERNATE_VERSION))); // It might make sense to just remove ConnectionSelectionPolicy.DEFAULT since it never uses any of the other // connections, you don't need the MultiServerConnectionFactory, or it might make sense to have it return // just the default for the set of versions - assertEquals(Set.of("Primary", "Alternate"), classUnderTest.getVersionsUnderTest()); + assertEquals(Set.of(PRIMARY_VERSION, ALTERNATE_VERSION), classUnderTest.getVersionsUnderTest()); var connection = classUnderTest.getNewConnection(URI.create("Blah")); - assertConnection(connection, List.of("Primary")); - assertStatement(connection.prepareStatement("SQL"), "Primary"); - assertStatement(connection.prepareStatement("SQL"), "Primary"); + assertConnection(connection, PRIMARY_VERSION, List.of(PRIMARY_VERSION)); + assertStatement(connection.prepareStatement("SQL"), PRIMARY_VERSION); + assertStatement(connection.prepareStatement("SQL"), PRIMARY_VERSION); connection = classUnderTest.getNewConnection(URI.create("Blah")); - assertConnection(connection, List.of("Primary")); - assertStatement(connection.prepareStatement("SQL"), "Primary"); - assertStatement(connection.prepareStatement("SQL"), "Primary"); + assertConnection(connection, PRIMARY_VERSION, List.of(PRIMARY_VERSION)); + assertStatement(connection.prepareStatement("SQL"), PRIMARY_VERSION); + assertStatement(connection.prepareStatement("SQL"), PRIMARY_VERSION); connection = classUnderTest.getNewConnection(URI.create("Blah")); - assertConnection(connection, List.of("Primary")); - assertStatement(connection.prepareStatement("SQL"), "Primary"); - assertStatement(connection.prepareStatement("SQL"), "Primary"); + assertConnection(connection, PRIMARY_VERSION, List.of(PRIMARY_VERSION)); + assertStatement(connection.prepareStatement("SQL"), PRIMARY_VERSION); + assertStatement(connection.prepareStatement("SQL"), PRIMARY_VERSION); } @ParameterizedTest @CsvSource({"0", "1"}) void testAlternatePolicy(int initialConnection) throws SQLException { - final String[] path = new String[] { "Primary", "Alternate" }; - final String initialConnectionName = path[initialConnection]; - final String otherConnectionName = path[(initialConnection + 1) % 2]; + final SemanticVersion[] versions = new SemanticVersion[] { PRIMARY_VERSION, ALTERNATE_VERSION }; + final SemanticVersion initialConnectionVersion = versions[initialConnection]; + final SemanticVersion otherConnectionVersion = versions[(initialConnection + 1) % 2]; MultiServerConnectionFactory classUnderTest = new MultiServerConnectionFactory( MultiServerConnectionFactory.ConnectionSelectionPolicy.ALTERNATE, initialConnection, - dummyConnectionFactory("Primary"), - List.of(dummyConnectionFactory("Alternate"))); + dummyConnectionFactory(PRIMARY_VERSION), + List.of(dummyConnectionFactory(ALTERNATE_VERSION))); // First run: // - Factory current connection: initial connection // - connection current connection: initial connection // - statement: initial connection (2 statements) var connection = classUnderTest.getNewConnection(URI.create("Blah")); - assertConnection(connection, List.of(initialConnectionName, otherConnectionName)); - assertStatement(connection.prepareStatement("SQL"), initialConnectionName); + assertConnection(connection, initialConnectionVersion, List.of(initialConnectionVersion, otherConnectionVersion)); + assertStatement(connection.prepareStatement("SQL"), initialConnectionVersion); // next statement - assertStatement(connection.prepareStatement("SQL"), otherConnectionName); + assertStatement(connection.prepareStatement("SQL"), otherConnectionVersion); // Second run: // - Factory current connection: alternate connection // - connection current connection: alternate connection // - statement: alternate connection (2 statements) connection = classUnderTest.getNewConnection(URI.create("Blah")); - assertConnection(connection, List.of(otherConnectionName, initialConnectionName)); - assertStatement(connection.prepareStatement("SQL"), otherConnectionName); + assertConnection(connection, otherConnectionVersion, List.of(otherConnectionVersion, initialConnectionVersion)); + assertStatement(connection.prepareStatement("SQL"), otherConnectionVersion); // next statement - assertStatement(connection.prepareStatement("SQL"), initialConnectionName); + assertStatement(connection.prepareStatement("SQL"), initialConnectionVersion); // Third run: // - Factory current connection: initial connection // - connection current connection: initial connection // - statement: initial connection (1 statement) connection = classUnderTest.getNewConnection(URI.create("Blah")); - assertConnection(connection, List.of(initialConnectionName, otherConnectionName)); + assertConnection(connection, initialConnectionVersion, List.of(initialConnectionVersion, otherConnectionVersion)); // just one statement for this connection - assertStatement(connection.prepareStatement("SQL"), initialConnectionName); + assertStatement(connection.prepareStatement("SQL"), initialConnectionVersion); // Fourth run: // - Factory current connection: alternate connection // - connection current connection: alternate connection // - statement: alternate connection (3 statements) connection = classUnderTest.getNewConnection(URI.create("Blah")); - assertConnection(connection, List.of(otherConnectionName, initialConnectionName)); - assertStatement(connection.prepareStatement("SQL"), otherConnectionName); + assertConnection(connection, otherConnectionVersion, List.of(otherConnectionVersion, initialConnectionVersion)); + assertStatement(connection.prepareStatement("SQL"), otherConnectionVersion); // next statements - assertStatement(connection.prepareStatement("SQL"), initialConnectionName); - assertStatement(connection.prepareStatement("SQL"), otherConnectionName); + assertStatement(connection.prepareStatement("SQL"), initialConnectionVersion); + assertStatement(connection.prepareStatement("SQL"), otherConnectionVersion); } @Test @@ -128,24 +132,25 @@ void testIllegalInitialConnection() { assertThrows(AssertionError.class, () -> new MultiServerConnectionFactory( MultiServerConnectionFactory.ConnectionSelectionPolicy.ALTERNATE, -1, - dummyConnectionFactory("A"), - List.of(dummyConnectionFactory("B")))); + dummyConnectionFactory(PRIMARY_VERSION), + List.of(dummyConnectionFactory(ALTERNATE_VERSION)))); assertThrows(AssertionError.class, () -> new MultiServerConnectionFactory( MultiServerConnectionFactory.ConnectionSelectionPolicy.ALTERNATE, 7, - dummyConnectionFactory("A"), - List.of(dummyConnectionFactory("B")))); + dummyConnectionFactory(PRIMARY_VERSION), + List.of(dummyConnectionFactory(ALTERNATE_VERSION)))); } - private void assertStatement(final RelationalPreparedStatement statement, final String query) throws SQLException { - assertEquals("version=" + query, ((RelationalConnection)statement.getConnection()).getPath().getQuery()); + private void assertStatement(final RelationalPreparedStatement statement, final SemanticVersion version) throws SQLException { + assertEquals("version=" + version, ((RelationalConnection)statement.getConnection()).getPath().getQuery()); } - private static void assertConnection(final YamlConnection connection, final List expectedVersions) { + private static void assertConnection(final YamlConnection connection, final SemanticVersion initialVersion, final List expectedVersions) { + assertEquals(initialVersion, connection.getInitialVersion()); assertEquals(expectedVersions, connection.getVersions()); } - YamlConnectionFactory dummyConnectionFactory(@Nonnull String version) { + YamlConnectionFactory dummyConnectionFactory(@Nonnull SemanticVersion version) { return new YamlConnectionFactory() { @Override public YamlConnection getNewConnection(@Nonnull URI connectPath) throws SQLException { @@ -155,7 +160,7 @@ public YamlConnection getNewConnection(@Nonnull URI connectPath) throws SQLExcep } @Override - public Set getVersionsUnderTest() { + public Set getVersionsUnderTest() { return Set.of(version); } }; diff --git a/yaml-tests/src/test/java/SupportedVersionTest.java b/yaml-tests/src/test/java/SupportedVersionTest.java index 3cc21a5e92..b1739f1b12 100644 --- a/yaml-tests/src/test/java/SupportedVersionTest.java +++ b/yaml-tests/src/test/java/SupportedVersionTest.java @@ -24,6 +24,7 @@ import com.apple.foundationdb.relational.yamltests.YamlExecutionContext; import com.apple.foundationdb.relational.yamltests.YamlRunner; import com.apple.foundationdb.relational.yamltests.configs.EmbeddedConfig; +import com.apple.foundationdb.relational.yamltests.server.SemanticVersion; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; @@ -43,7 +44,7 @@ */ public class SupportedVersionTest { - private static final String VERSION = "3.0.18.0"; + private static final SemanticVersion VERSION = SemanticVersion.parse("3.0.18.0"); private static final EmbeddedConfig config = new EmbeddedConfig(); @BeforeAll @@ -68,7 +69,7 @@ public YamlConnection getNewConnection(@Nonnull URI connectPath) throws SQLExcep } @Override - public Set getVersionsUnderTest() { + public Set getVersionsUnderTest() { return Set.of(VERSION); } }; diff --git a/yaml-tests/src/test/java/com/apple/foundationdb/relational/yamltests/server/SemanticVersionTest.java b/yaml-tests/src/test/java/com/apple/foundationdb/relational/yamltests/server/SemanticVersionTest.java index 3780912c7b..79012675b3 100644 --- a/yaml-tests/src/test/java/com/apple/foundationdb/relational/yamltests/server/SemanticVersionTest.java +++ b/yaml-tests/src/test/java/com/apple/foundationdb/relational/yamltests/server/SemanticVersionTest.java @@ -23,15 +23,23 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.CsvSource; +import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.ValueSource; +import javax.annotation.Nonnull; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Comparator; import java.util.List; +import java.util.Random; import java.util.stream.Collectors; +import java.util.stream.IntStream; import java.util.stream.Stream; import static com.apple.foundationdb.record.TestHelpers.assertThrows; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; class SemanticVersionTest { @@ -43,7 +51,10 @@ class SemanticVersionTest { "4.2, 4.2", "5.8.9, 5.8.9", "9.7.4.3.0, 9.7.4.3.0", - "5.4.3-SNAPSHOT, 5.4.3-SNAPSHOT" + "5.4.3-SNAPSHOT, 5.4.3-SNAPSHOT", + "!current_version, !current_version", + "!min_version, !min_version", + "!max_version, !max_version", }) void equal(String rawVersionA, String rawVersionB) { final SemanticVersion versionA = SemanticVersion.parse(rawVersionA); @@ -65,13 +76,23 @@ void equal(String rawVersionA, String rawVersionB) { "3.5.55.0, 3.5.55.1", "3.5.55.1, 3.5.56.0", "3.5.55.0, 3.55.5.0", + "3.5.55.0, !current_version", + "3.5.55.0-SNAPSHOT, !current_version", + "!current_version, !max_version", + "3.5.55.0, !max_version", + "3.5.55.0-SNAPSHOT, !max_version", + "!min_version, 3.5.55.0", + "!min_version, 3.5.55.0-SNAPSHOT", + "3.1-SNAPSHOT, !current_version", + "3.1-SNAPSHOT, !max_version", + "!min_version, 3.1-SNAPSHOT", }) void notEqual(String rawLowerVersion, String rawHigherVersion) { final SemanticVersion lowerVersion = SemanticVersion.parse(rawLowerVersion); final SemanticVersion higherVersion = SemanticVersion.parse(rawHigherVersion); Assertions.assertAll( - () -> assertEquals(-1, lowerVersion.compareTo(higherVersion)), - () -> assertEquals(1, higherVersion.compareTo(lowerVersion))); + () -> assertThat(lowerVersion.compareTo(higherVersion)).isLessThan(0), + () -> assertThat(higherVersion.compareTo(lowerVersion)).isGreaterThan(0)); } @ParameterizedTest @@ -97,7 +118,7 @@ void alignsWithComparator(int versionA, int versionB) { "3.2-SNAPSHOT, 3.2.0", "3.2-SNAPSHOT, 3.2.1" }) - void incomparible(String rawVersionA, String rawVersionB) { + void incomparable(String rawVersionA, String rawVersionB) { final SemanticVersion versionA = SemanticVersion.parse(rawVersionA); final SemanticVersion versionB = SemanticVersion.parse(rawVersionB); Assertions.assertAll( @@ -146,10 +167,83 @@ void lesserVersions() { final List greaterVersions = List.of("4.4.3.1", "3.6.3.1", "3.5.5.1", "3.5.4.3", "3.5.4.3-SNAPSHOT"); final List actualLesserVersions = SemanticVersion.parse(versionString).lesserVersions( Stream.concat(lesserVersions.stream(), Stream.concat(Stream.of(versionString), greaterVersions.stream())) + .map(SemanticVersion::parse) .collect(Collectors.toSet())); actualLesserVersions.sort(Comparator.naturalOrder()); final List expectedLesserVersions = lesserVersions.stream() .map(SemanticVersion::parse).sorted().collect(Collectors.toList()); assertEquals(expectedLesserVersions, actualLesserVersions); } + + @Nonnull + private static String randomVersionString(Random r) { + if (r.nextBoolean()) { + List singletons = Arrays.stream(SemanticVersion.SemanticVersionType.values()) + .filter(SemanticVersion.SemanticVersionType::isSingleton) + .collect(Collectors.toList()); + int choice = r.nextInt(singletons.size()); + return singletons.get(choice).getText(); + } else { + String version = IntStream.generate(() -> r.nextInt(1000)) + .limit(4) + .mapToObj(Integer::toString) + .collect(Collectors.joining(".")); + if (r.nextBoolean()) { + version = version + "-SNAPSHOT"; + } + return version; + } + } + + private static List randomVersionStrings(Random r, int length) { + return Stream.generate(() -> randomVersionString(r)) + .limit(length) + .collect(Collectors.toList()); + } + + private void assertSorted(List versions) { + int pos = 0; + // First, all the min versions + while (pos < versions.size() && SemanticVersion.min().equals(versions.get(pos))) { + pos++; + } + // Then all the semantic versions, in order + SemanticVersion last = null; + while (pos < versions.size() && SemanticVersion.SemanticVersionType.NORMAL.equals(versions.get(pos).getType())) { + SemanticVersion current = versions.get(pos); + if (last != null) { + assertThat(current) + .as("current version %s is out of order in %s", current, versions) + .isGreaterThanOrEqualTo(last); + } + last = current; + pos++; + } + // Then all the current + while (pos < versions.size() && SemanticVersion.current().equals(versions.get(pos))) { + pos++; + } + // Then all the max + while (pos < versions.size() && SemanticVersion.max().equals(versions.get(pos))) { + pos++; + } + assertThat(pos) + .as("versions %s are out of order starting at position %d", versions, pos) + .isEqualTo(versions.size()); + } + + static Stream sortRandomVersions() { + final Random r = new Random(0x5ca1ab13L); + return Stream.generate(() -> randomVersionStrings(r, 10)) + .limit(100) + .map(Arguments::of); + } + + @ParameterizedTest(name = "sortRandomVersions[versions={0}]") + @MethodSource + void sortRandomVersions(List versionStrings) { + List versions = new ArrayList<>(versionStrings.stream().map(SemanticVersion::parse).collect(Collectors.toList())); + versions.sort(Comparator.naturalOrder()); + assertSorted(versions); + } } diff --git a/yaml-tests/src/test/resources/aggregate-empty-table.yamsql b/yaml-tests/src/test/resources/aggregate-empty-table.yamsql index 4b882ec30f..d040c1e07a 100644 --- a/yaml-tests/src/test/resources/aggregate-empty-table.yamsql +++ b/yaml-tests/src/test/resources/aggregate-empty-table.yamsql @@ -68,11 +68,14 @@ test_block: - - query: select count(*) from T1 where col1 > 0 group by col1; - error: "0AF00" - # 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (result does not contain all expected rows! expected 1 rows, got 0) - # - - # - query: select count(*) from T2; - # - explain: "AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # - result: [{0}] + - + # DONE: 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (result does not contain all expected rows! expected 1 rows, got 0) + - query: select count(*) from T2; + - explain: "AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - initialVersionLessThan: 4.0.561.0 + - result: [] + - initialVersionAtLeast: 4.0.561.0 + - result: [{0}] - - query: select count(*) from T2 where col1 = 0; - explain: "AISCAN(T2_I2 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" @@ -153,10 +156,13 @@ test_block: - query: select count(col2) from T1 where col1 > 0 group by col1; - error: "0AF00" - + # DONE: 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (result does not contain all expected rows! expected 1 rows, got 0) - query: select count(col2) from T2; - explain: "AISCAN(T2_I3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (result does not contain all expected rows! expected 1 rows, got 0) - # - result: [{0}] + - initialVersionLessThan: 4.0.561.0 + - result: [] + - initialVersionAtLeast: 4.0.561.0 + - result: [{0}] - - query: select count(col2) from T2 where col1 = 0; - explain: "AISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" @@ -234,10 +240,13 @@ test_block: # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) # - result: [{!null _}] - + # DONE: 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (result does not contain all expected rows! expected 1 rows, got 0) - query: select sum(col1) from T2; - explain: "AISCAN(T2_I5 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (result does not contain all expected rows! expected 1 rows, got 0) - # - result: [{!null _}] + - initialVersionLessThan: 4.0.561.0 + - result: [] + - initialVersionAtLeast: 4.0.561.0 + - result: [{!null _}] - - query: select sum(col1) from T2 where col1 = 0; - explain: "SCAN(<,>) | TFILTER T2 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" diff --git a/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql b/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql index 95379e4492..5b22e3d21d 100644 --- a/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql +++ b/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql @@ -31,20 +31,25 @@ test_block: name: agg-index-tests-count-empty tests: - + # DONE: 4.1 Triage: [No Fix Necessary] failing when running against 4.0.559.6 (result mismatch) - query: select count(*) from t1 - explain: "AISCAN(MV1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: [No Fix Necessary] failing when running against 4.0.559.6 (result mismatch) - # Triage Note: 4.2.9.0 to 4.0.559.6 works correctly, need to write a test to verify - # - result: [{0}] + - initialVersionLessThan: 4.0.561.0 + - result: [] + - initialVersionAtLeast: 4.0.561.0 + - result: [{0}] - - query: select count(*) from t1 group by col2 - explain: "AISCAN(MV2 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" - result: [] - + # DONE: 4.1 Triage: failing when running against 4.0.559.6 (result mismatch) - query: select count(col1) from t1 - explain: "AISCAN(MV3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: failing when running against 4.0.559.6 (result mismatch) - # - result: [{0}] + - initialVersionLessThan: 4.0.561.0 + - result: [] + - initialVersionAtLeast: 4.0.561.0 + - result: [{0}] - - query: select count(col1) from t1 group by col2 - explain: "AISCAN(MV4 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" diff --git a/yaml-tests/src/test/resources/aggregate-index-tests.yamsql b/yaml-tests/src/test/resources/aggregate-index-tests.yamsql index a5a4c3dd7a..24c1a079e7 100644 --- a/yaml-tests/src/test/resources/aggregate-index-tests.yamsql +++ b/yaml-tests/src/test/resources/aggregate-index-tests.yamsql @@ -242,22 +242,22 @@ test_block: - explain: "AISCAN(MV7 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - - query: select col1, max_ever(col2) from T1 group by col1; - - result: [{!l 10, !l 5}, {!l 20, !l 13}] - explain: "AISCAN(MV6 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._0 AS COL1, _._1 AS _1)" + - result: [{!l 10, !l 5}, {!l 20, !l 13}] - - query: select col1, min_ever(col2) from T1 group by col1; - - result: [{!l 10, !l 1}, {!l 20, !l 6}] - explain: "AISCAN(MV12 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._0 AS COL1, _._1 AS _1)" + - result: [{!l 10, !l 1}, {!l 20, !l 6}] - # TODO, check how this aligns with COLLATION support - query: select col2, max_ever(col1) from T4 group by col2; - - result: [{!l 10, 'value4'}, {!l 20, 'valueZ'}] - explain: "AISCAN(MV15 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._0 AS COL2, _._1 AS _1)" + - result: [{!l 10, 'value4'}, {!l 20, 'valueZ'}] - # TODO, check how this aligns with COLLATION support - query: select col2, min_ever(col1) from T4 group by col2; - - result: [{!l 10, 'value1'}, {!l 20, 'valueA'}] - explain: "AISCAN(MV14 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._0 AS COL2, _._1 AS _1)" + - result: [{!l 10, 'value1'}, {!l 20, 'valueA'}] - - query: select col1, sum(col2) from T1 where col1 > 15 group by col1; - explain: "AISCAN(MV1 [[GREATER_THAN promote(@c13 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._0 AS COL1, _._1 AS _1)" diff --git a/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql b/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql index 787122d10f..a97d4b1f16 100644 --- a/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql +++ b/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql @@ -69,11 +69,26 @@ test_block: {BITMAP: xStartsWith_1250'0400008', 'CATEGORY': 'world', 'OFFSET':0}] - - query: SELECT bitmap_construct_agg(bitmap_bit_position(id)) as bitmap, bitmap_bucket_offset(id) as offset FROM T2 GROUP BY bitmap_bucket_offset(id) + - supported_version: !current_version - explain: "ISCAN(AGG_INDEX_1 <,>) | MAP (_ AS _0) | AGG (bitmap_construct_agg_l((_._0.ID) bitmap_bit_position 10000) AS _0) GROUP BY ((_._0.ID) bitmap_bucket_offset 10000 AS _0) | MAP (_._1._0 AS BITMAP, _._0._0 AS OFFSET)" # 4.1 Triage: [Initial version] this fails with continuation tests against 4.0.559.6. Wrong results # - unorderedResult: [{BITMAP: xStartsWith_1250'060000c', 'OFFSET':0}, {BITMAP: xStartsWith_1250'02', 'OFFSET':10000}] + - + - query: SELECT bitmap_construct_agg(bitmap_bit_position(id)) as bitmap, bitmap_bucket_offset(id) as offset FROM T2 GROUP BY bitmap_bucket_offset(id) + - maxRows: 1 + # Older versions used to skip over a result here due to an off-by-one error (see: https://github.com/foundationdb/fdb-record-layer/pull/3112) + # Retain this test of older behavior to allow for continuation testing with older versions + # This test can be removed when we no longer care about testing compatibility with older versions + - initialVersionLessThan: !current_version + - result: [{BITMAP: xStartsWith_1250'060000c', 'OFFSET':0}] + - result: [] + - initialVersionAtLeast: !current_version + - result: [{BITMAP: xStartsWith_1250'060000c', 'OFFSET':0}] + - result: [{BITMAP: xStartsWith_1250'02', 'OFFSET':10000}] + - result: [] - - query: SELECT bitmap_construct_agg(bitmap_bit_position(id)) as bitmap, category, bitmap_bucket_offset(id) as offset FROM T2 GROUP BY category, bitmap_bucket_offset(id) + - supported_version: !current_version - explain: "ISCAN(AGG_INDEX_2 <,>) | MAP (_ AS _0) | AGG (bitmap_construct_agg_l((_._0.ID) bitmap_bit_position 10000) AS _0) GROUP BY (_._0.CATEGORY AS _0, (_._0.ID) bitmap_bucket_offset 10000 AS _1) | MAP (_._1._0 AS BITMAP, _._0._0 AS CATEGORY, _._0._1 AS OFFSET)" # 4.1 Triage: [Initial version] this fails with continuation tests against 4.0.559.6. Wrong results # - unorderedResult: [{BITMAP: xStartsWith_1250'0200004', 'CATEGORY': 'hello', 'OFFSET':0}, diff --git a/yaml-tests/src/test/resources/initial-version/at-least-current-version.yamsql b/yaml-tests/src/test/resources/initial-version/at-least-current-version.yamsql new file mode 100644 index 0000000000..16ce109e2d --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/at-least-current-version.yamsql @@ -0,0 +1,51 @@ +# +# at-least-current-version.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should pass when run on !current_version +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + preset: single_repetition_ordered + tests: + - + - query: select * from t1; + - initialVersionLessThan: !current_version + - result: [{"foo"}] + - initialVersionAtLeast: !current_version + - result: [] + - + - query: insert into t1(id, col1) values (1, 2), (2, 3); + - initialVersionLessThan: !current_version + - count: 0 + - initialVersionAtLeast: !current_version + - count: 2 + - + - query: select * from t1; + - initialVersionLessThan: !current_version + - unorderedResult: [] + - initialVersionAtLeast: !current_version + - unorderedResult: [{id: 1, col1: 2}, {id: 2, col1: 3}] + - + - query: SHOULD ERROR; + - initialVersionLessThan: !current_version + - result: [] + - initialVersionAtLeast: !current_version + - error: '42601' diff --git a/yaml-tests/src/test/resources/initial-version/at-least-version-tests.yamsql b/yaml-tests/src/test/resources/initial-version/at-least-version-tests.yamsql new file mode 100644 index 0000000000..3bcc26e8d0 --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/at-least-version-tests.yamsql @@ -0,0 +1,69 @@ +# +# at-least-version-tests.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should pass when run on version 3.0.18.0 +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + preset: single_repetition_ordered + tests: + - + - query: select * from t1; + - initialVersionLessThan: 3.0.18.0 + - result: [{"foo"}] + - initialVersionAtLeast: 3.0.18.0 + - result: [] + - + - query: select * from t1; + - initialVersionLessThan: 3.0.17.0 + - result: [{"foo"}] + - initialVersionAtLeast: 3.0.17.0 + - result: [] + - + - query: insert into t1(id, col1) values (1, 2), (2, 3); + - initialVersionLessThan: 3.0.18.0 + - count: 0 + - initialVersionAtLeast: 3.0.18.0 + - count: 2 + - + - query: insert into t1(id, col1) values (3, 4), (4, 5); + - initialVersionLessThan: 3.0.17.0 + - count: 0 + - initialVersionAtLeast: 3.0.17.0 + - count: 2 + - + - query: select * from t1; + - initialVersionLessThan: 3.0.18.0 + - unorderedResult: [] + - initialVersionAtLeast: 3.0.18.0 + - unorderedResult: [{id: 1, col1: 2}, {id: 2, col1: 3}, {id: 3, col1: 4}, {id: 4, col1: 5}] + - + - query: select * from t1; + - initialVersionLessThan: 3.0.17.0 + - unorderedResult: [] + - initialVersionAtLeast: 3.0.17.0 + - unorderedResult: [{id: 1, col1: 2}, {id: 2, col1: 3}, {id: 3, col1: 4}, {id: 4, col1: 5}] + - + - query: SHOULD ERROR; + - initialVersionLessThan: 3.0.17.0 + - result: [] + - initialVersionAtLeast: 3.0.17.0 + - error: '42601' diff --git a/yaml-tests/src/test/resources/initial-version/do-not-allow-max-rows-in-at-least.yamsql b/yaml-tests/src/test/resources/initial-version/do-not-allow-max-rows-in-at-least.yamsql new file mode 100644 index 0000000000..7d75cabfa5 --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/do-not-allow-max-rows-in-at-least.yamsql @@ -0,0 +1,34 @@ +# +# do-not-allow-max-rows-in-at-least.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should fail when run on any version +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + preset: single_repetition_ordered + tests: + - + - query: select * from t1; + - initialVersionLessThan: 3.0.18.0 + - result: [] + - initialVersionAtLeast: 3.0.18.0 + - maxRows: 2 + - result: [] diff --git a/yaml-tests/src/test/resources/initial-version/do-not-allow-max-rows-in-less-than.yamsql b/yaml-tests/src/test/resources/initial-version/do-not-allow-max-rows-in-less-than.yamsql new file mode 100644 index 0000000000..53b94b6c80 --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/do-not-allow-max-rows-in-less-than.yamsql @@ -0,0 +1,34 @@ +# +# do-not-allow-max-rows-in-less-than.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should fail when run on any version +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + preset: single_repetition_ordered + tests: + - + - query: select * from t1; + - initialVersionLessThan: 3.0.18.0 + - maxRows: 2 + - result: [] + - initialVersionAtLeast: 3.0.18.0 + - result: [] diff --git a/yaml-tests/src/test/resources/initial-version/explain-after-version.yamsql b/yaml-tests/src/test/resources/initial-version/explain-after-version.yamsql new file mode 100644 index 0000000000..fb53e3d37e --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/explain-after-version.yamsql @@ -0,0 +1,34 @@ +# +# explain-after-version.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should fail (with any version) +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + name: less_than_tests + tests: + - + - query: select * from t1; + - initialVersionLessThan: 3.0.18.0 + - result: [] + - initialVersionAtLeast: 3.0.18.0 + - result: [] + - explain: 'fake explain' diff --git a/yaml-tests/src/test/resources/initial-version/less-than-version-tests.yamsql b/yaml-tests/src/test/resources/initial-version/less-than-version-tests.yamsql new file mode 100644 index 0000000000..4d73a08101 --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/less-than-version-tests.yamsql @@ -0,0 +1,76 @@ +# +# less-than-version-tests.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should pass when run on version 3.0.18.0 +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + preset: single_repetition_ordered + tests: + - + - query: select * from t1; + - initialVersionLessThan: 3.0.19.0 + - result: [] + - initialVersionAtLeast: 3.0.19.0 + - result: [{"foo"}] + - + - query: select * from t1; + - initialVersionLessThan: 3.0.20.0 + - result: [] + - initialVersionAtLeast: 3.0.20.0 + - result: [{"foo"}] + - + - query: select * from t1; + - initialVersionLessThan: !current_version + - result: [] + - initialVersionAtLeast: !current_version + - result: [{"foo"}] + - + - query: insert into t1(id, col1) values (1, 2), (2, 3); + - initialVersionLessThan: 3.0.19.0 + - count: 2 + - initialVersionAtLeast: 3.0.19.0 + - count: 0 + - + - query: insert into t1(id, col1) values (3, 4), (4, 5); + - initialVersionLessThan: !current_version + - count: 2 + - initialVersionAtLeast: !current_version + - count: 0 + - + - query: select * from t1; + - initialVersionLessThan: 3.0.19.0 + - unorderedResult: [{id: 1, col1: 2}, {id: 2, col1: 3}, {id: 3, col1: 4}, {id: 4, col1: 5}] + - initialVersionAtLeast: 3.0.19.0 + - unorderedResult: [] + - + - query: select * from t1; + - initialVersionLessThan: !current_version + - unorderedResult: [{id: 1, col1: 2}, {id: 2, col1: 3}, {id: 3, col1: 4}, {id: 4, col1: 5}] + - initialVersionAtLeast: !current_version + - result: [{"foo"}] + - + - query: SHOULD ERROR; + - initialVersionLessThan: 3.0.19.0 + - error: '42601' + - initialVersionAtLeast: 3.0.19.0 + - unorderedResult: [] + diff --git a/yaml-tests/src/test/resources/initial-version/mid-query.yamsql b/yaml-tests/src/test/resources/initial-version/mid-query.yamsql new file mode 100644 index 0000000000..7ff71376a1 --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/mid-query.yamsql @@ -0,0 +1,40 @@ +# +# mid-query.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should fail when run on any version +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +setup: + steps: + - query: INSERT INTO T1 + VALUES (1, 2), + (2, 3) +--- +test_block: + tests: + - + - query: select * from t1; + - maxRows: 1 + - result: [{id: 1, col1: 2}] + - initialVersionLessThan: 3.0.19.0 + - result: [{id: 1, col1: 2}] + - initialVersionAtLeast: 3.0.19.0 + - result: [{id: 1, col1: 2}] diff --git a/yaml-tests/src/test/resources/initial-version/non-exhaustive-current-version.yamsql b/yaml-tests/src/test/resources/initial-version/non-exhaustive-current-version.yamsql new file mode 100644 index 0000000000..82b8230050 --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/non-exhaustive-current-version.yamsql @@ -0,0 +1,32 @@ +# +# non-exhaustive-current-version.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should pass when run on any version +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + tests: + - + - query: select * from t1; + - initialVersionLessThan: 3.0.18.0 + - result: [] + - initialVersionAtLeast: !current_version + - result: [] diff --git a/yaml-tests/src/test/resources/initial-version/non-exhaustive-versions.yamsql b/yaml-tests/src/test/resources/initial-version/non-exhaustive-versions.yamsql new file mode 100644 index 0000000000..cb1434b92e --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/non-exhaustive-versions.yamsql @@ -0,0 +1,32 @@ +# +# non-exhaustive-versions.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should fail when run on any version +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + tests: + - + - query: select * from t1; + - initialVersionLessThan: 3.0.18.0 + - result: [] + - initialVersionAtLeast: 3.0.19.0 + - result: [] diff --git a/yaml-tests/src/test/resources/initial-version/wrong-count-at-least.yamsql b/yaml-tests/src/test/resources/initial-version/wrong-count-at-least.yamsql new file mode 100644 index 0000000000..a4abec7c9a --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/wrong-count-at-least.yamsql @@ -0,0 +1,33 @@ +# +# wrong-count-at-least.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should fail when run on version 3.0.18.0 +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + preset: single_repetition_ordered + tests: + - + - query: insert into t1(id, col1) values (1, 2); + - initialVersionLessThan: 3.0.18.0 + - count: 1 + - initialVersionAtLeast: 3.0.18.0 + - count: 2 diff --git a/yaml-tests/src/test/resources/initial-version/wrong-count-less-than.yamsql b/yaml-tests/src/test/resources/initial-version/wrong-count-less-than.yamsql new file mode 100644 index 0000000000..fbaeffbb81 --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/wrong-count-less-than.yamsql @@ -0,0 +1,33 @@ +# +# wrong-count-less-than.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should fail when run on version 3.0.18.0 +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + preset: single_repetition_ordered + tests: + - + - query: insert into t1(id, col1) values (1, 2); + - initialVersionLessThan: 3.0.19.0 + - count: 2 + - initialVersionAtLeast: 3.0.19.0 + - count: 1 diff --git a/yaml-tests/src/test/resources/initial-version/wrong-error-at-least.yamsql b/yaml-tests/src/test/resources/initial-version/wrong-error-at-least.yamsql new file mode 100644 index 0000000000..a02459d82e --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/wrong-error-at-least.yamsql @@ -0,0 +1,32 @@ +# +# wrong-error-at-least.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should fail when run on version 3.0.18.0 +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + tests: + - + - query: select * from t1; + - initialVersionLessThan: 3.0.18.0 + - result: [] + - initialVersionAtLeast: 3.0.18.0 + - error: 'X0000' diff --git a/yaml-tests/src/test/resources/initial-version/wrong-error-less-than.yamsql b/yaml-tests/src/test/resources/initial-version/wrong-error-less-than.yamsql new file mode 100644 index 0000000000..7d4609a350 --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/wrong-error-less-than.yamsql @@ -0,0 +1,32 @@ +# +# wrong-error-at-least.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should fail when run on version 3.0.18.0 +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + tests: + - + - query: select * from t1; + - initialVersionLessThan: 3.0.19.0 + - error: 'X0000' + - initialVersionAtLeast: 3.0.19.0 + - result: [] diff --git a/yaml-tests/src/test/resources/initial-version/wrong-result-at-least.yamsql b/yaml-tests/src/test/resources/initial-version/wrong-result-at-least.yamsql new file mode 100644 index 0000000000..c66ec5b9a5 --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/wrong-result-at-least.yamsql @@ -0,0 +1,32 @@ +# +# wrong-result-at-least.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should fail when run on version 3.0.18.0 +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + tests: + - + - query: select * from t1; + - initialVersionLessThan: 3.0.18.0 + - result: [] + - initialVersionAtLeast: 3.0.18.0 + - result: [{"foo"}] diff --git a/yaml-tests/src/test/resources/initial-version/wrong-result-less-than.yamsql b/yaml-tests/src/test/resources/initial-version/wrong-result-less-than.yamsql new file mode 100644 index 0000000000..8295383a7e --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/wrong-result-less-than.yamsql @@ -0,0 +1,32 @@ +# +# wrong-result-less-than.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should fail when run on version 3.0.18.0 +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + tests: + - + - query: select * from t1; + - initialVersionLessThan: 3.0.19.0 + - result: [{"foo"}] + - initialVersionAtLeast: 3.0.19.0 + - result: [] diff --git a/yaml-tests/src/test/resources/initial-version/wrong-unordered-at-least.yamsql b/yaml-tests/src/test/resources/initial-version/wrong-unordered-at-least.yamsql new file mode 100644 index 0000000000..92635c5602 --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/wrong-unordered-at-least.yamsql @@ -0,0 +1,32 @@ +# +# wrong-unordered-less-than.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should fail when run on version 3.0.18.0 +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + tests: + - + - query: select * from t1; + - initialVersionLessThan: 3.0.18.0 + - unorderedResult: [] + - initialVersionAtLeast: 3.0.18.0 + - unorderedResult: [{"foo"}] diff --git a/yaml-tests/src/test/resources/initial-version/wrong-unordered-less-than.yamsql b/yaml-tests/src/test/resources/initial-version/wrong-unordered-less-than.yamsql new file mode 100644 index 0000000000..21c63fcd0e --- /dev/null +++ b/yaml-tests/src/test/resources/initial-version/wrong-unordered-less-than.yamsql @@ -0,0 +1,32 @@ +# +# wrong-unordered-less-than.yamsql +# +# This source file is part of the FoundationDB open source project +# +# Copyright 2021-2025 Apple Inc. and the FoundationDB project authors +# +# Licensed 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. + +# This test should fail when run on version 3.0.18.0 +--- +schema_template: + create table t1(id bigint, col1 bigint, primary key(id)) +--- +test_block: + tests: + - + - query: select * from t1; + - initialVersionLessThan: 3.0.19.0 + - unorderedResult: [{"foo"}] + - initialVersionAtLeast: 3.0.19.0 + - unorderedResult: [] diff --git a/yaml-tests/src/test/resources/recursive-cte.yamsql b/yaml-tests/src/test/resources/recursive-cte.yamsql index df3d2fd6bc..0a8ed60bb7 100644 --- a/yaml-tests/src/test/resources/recursive-cte.yamsql +++ b/yaml-tests/src/test/resources/recursive-cte.yamsql @@ -1,6 +1,6 @@ --- options: - supported_version: 4.1.6.0 + supported_version: 4.0.561.0 --- schema_template: create table t1(id bigint, parent bigint, primary key(id)) diff --git a/yaml-tests/src/test/resources/union.yamsql b/yaml-tests/src/test/resources/union.yamsql index e01512d8fe..aa36293532 100644 --- a/yaml-tests/src/test/resources/union.yamsql +++ b/yaml-tests/src/test/resources/union.yamsql @@ -183,9 +183,12 @@ test_block: - query: select col1, col2 from t1 union all select a, b from t5 - error: "42F65" - - - query: select sum(Y) as S from (select count(*) as Y from t6 union all select count(*) from t7) as X - - explain: "AISCAN(MV11 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ AISCAN(MV12 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)" # 4.1 Triage: [Initial version] Failing with 559: (Wrong result with forced continuation (NULL vs 0)) # 4.1 Triage: [deferred: Client checks for END] Failing with forced continuations: (Received continuation shouldn't be at beginning) - # - result: [{0}] + - query: select sum(Y) as S from (select count(*) as Y from t6 union all select count(*) from t7) as X + - explain: "AISCAN(MV11 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ AISCAN(MV12 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)" + - initialVersionLessThan: 4.0.561.0 + - result: [{!null _ }] + - initialVersionAtLeast: 4.0.561.0 + - result: [{0}] ... From f2fbc50fe270f81bff1bf33f95a22e09480f65ef Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Thu, 27 Feb 2025 18:02:46 +0000 Subject: [PATCH 29/62] fix up aggregate-index-tests-count-empty.yamsql to work better in mixed-mode tests --- .../yamltests/command/QueryExecutor.java | 19 +++++++++++++++---- .../aggregate-index-tests-count-empty.yamsql | 10 ++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java index d0e05a2e8e..82fdeb9798 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java @@ -26,9 +26,11 @@ import com.apple.foundationdb.relational.api.RelationalResultSetMetaData; import com.apple.foundationdb.relational.api.exceptions.RelationalException; import com.apple.foundationdb.relational.api.metrics.RelationalMetric; +import com.apple.foundationdb.relational.recordlayer.ContinuationImpl; import com.apple.foundationdb.relational.yamltests.AggregateResultSet; import com.apple.foundationdb.relational.yamltests.YamlConnection; import com.apple.foundationdb.relational.yamltests.command.parameterinjection.Parameter; +import com.apple.foundationdb.relational.yamltests.server.SemanticVersion; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.junit.jupiter.api.Assertions; @@ -52,6 +54,7 @@ public class QueryExecutor { private static final Logger logger = LogManager.getLogger(QueryExecutor.class); private static final int FORCED_MAX_ROWS = 1; // The maxRows number to use when we are forcing it on the test private static final int MAX_CONTINUATIONS_ALLOWED = 100; + private static final SemanticVersion STRICT_ASSERTIONS_CUTOFF = SemanticVersion.parse("4.1.4.0"); @Nonnull private final String query; @@ -106,8 +109,10 @@ public Continuation execute(@Nonnull YamlConnection connection, @Nullable Contin return executeQuery(connection, config, currentQuery, checkCache, maxRows); } else if (continuation.atBeginning()) { // Continuation cannot be at beginning if it was returned from a query - reportTestFailure("Received continuation shouldn't be at beginning"); - return null; + if (STRICT_ASSERTIONS_CUTOFF.lesserVersions(connection.getVersions()).isEmpty()) { + reportTestFailure("Received continuation shouldn't be at beginning"); + } + return ContinuationImpl.END; } else { // Have a continuation - continue return executeContinuation(connection, continuation, config, maxRows); @@ -246,7 +251,11 @@ private Object executeStatementWithForcedContinuations(final @Nonnull Statement int count = 0; while (!continuation.atEnd()) { if (continuation.atBeginning()) { - reportTestFailure("Received continuation shouldn't be at beginning"); + if (STRICT_ASSERTIONS_CUTOFF.lesserVersions(connection.getVersions()).isEmpty()) { + reportTestFailure("Received continuation shouldn't be at beginning"); + } + continuation = ContinuationImpl.END; + break; } try (var s2 = prepareContinuationStatement(connection, continuation, FORCED_MAX_ROWS)) { resultSet = (RelationalResultSet)executeStatement(s2, null); @@ -256,7 +265,9 @@ private Object executeStatementWithForcedContinuations(final @Nonnull Statement results.add(resultSet); } else { // We assume that the last result is empty because of the maxRows:1 - Assertions.assertFalse(hasNext); + if (STRICT_ASSERTIONS_CUTOFF.lesserVersions(connection.getVersions()).isEmpty()) { + Assertions.assertFalse(hasNext, "End result should not have any associated value when maxRows is 1"); + } } } count += 1; // PMD failure for ++ diff --git a/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql b/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql index 5b22e3d21d..83f845c2cf 100644 --- a/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql +++ b/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql @@ -31,7 +31,6 @@ test_block: name: agg-index-tests-count-empty tests: - - # DONE: 4.1 Triage: [No Fix Necessary] failing when running against 4.0.559.6 (result mismatch) - query: select count(*) from t1 - explain: "AISCAN(MV1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - initialVersionLessThan: 4.0.561.0 @@ -43,8 +42,9 @@ test_block: - explain: "AISCAN(MV2 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" - result: [] - - # DONE: 4.1 Triage: failing when running against 4.0.559.6 (result mismatch) - query: select count(col1) from t1 + # FORCE_CONTINUATIONS does not work with versions before 4.1.4.0 due to limits not enforced "ON EMPTY" prior to https://github.com/FoundationDB/fdb-record-layer/pull/3092 + # Can remove once we no longer want to test versions prior to 4.1.4.0 - explain: "AISCAN(MV3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - initialVersionLessThan: 4.0.561.0 - result: [] @@ -60,8 +60,7 @@ test_block: - - query: select count(*) from t2 - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: failing when running against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{0}] + - result: [{0}] - - query: select count(*) from t2 group by col2 - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)" @@ -69,8 +68,7 @@ test_block: - - query: select count(col1) from t2 - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: failing when running against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{0}] + - result: [{0}] - - query: select count(col1) from t2 group by col2 - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)" From 3b3f341032faedb91405469458a4ae97af3eaf46 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Fri, 28 Feb 2025 10:11:07 +0000 Subject: [PATCH 30/62] update aggregate-empty-table.yamql to handle 4.1 changes --- .../aggregate-empty-table.metrics.binpb | 275 ++++++++----- .../aggregate-empty-table.metrics.yaml | 279 +++++++------ .../resources/aggregate-empty-table.yamsql | 385 ++++++++---------- 3 files changed, 520 insertions(+), 419 deletions(-) diff --git a/yaml-tests/src/test/resources/aggregate-empty-table.metrics.binpb b/yaml-tests/src/test/resources/aggregate-empty-table.metrics.binpb index e30012173e..599fc2adbf 100644 --- a/yaml-tests/src/test/resources/aggregate-empty-table.metrics.binpb +++ b/yaml-tests/src/test/resources/aggregate-empty-table.metrics.binpb @@ -1,7 +1,7 @@ - + 9 -agg-empty-table-tests EXPLAIN select count(*) from T1; -W f(08@SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests EXPLAIN select count(*) from T1; +۸W Г(0,8@SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -21,7 +21,7 @@ } H agg-empty-table-tests/EXPLAIN select count(*) from T1 where col1 = 0; -j V(0ύ8@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +j ~(08@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -43,7 +43,7 @@ H } H agg-empty-table-tests/EXPLAIN select count(*) from T1 where col1 > 0; -ȱj (0ӎ8@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +j ϵ(0-8@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -65,7 +65,7 @@ H } 9 agg-empty-table-tests EXPLAIN select count(*) from T2; - 씍(20;8+@AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +  ν(20߷W8+@AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -81,7 +81,7 @@ H } H agg-empty-table-tests/EXPLAIN select count(*) from T2 where col1 = 0; - ڒ(<0i81@AISCAN(T2_I2 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + (<0ޥt81@AISCAN(T2_I2 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -97,7 +97,7 @@ H } H agg-empty-table-tests/EXPLAIN select count(*) from T2 where col1 > 0; -Ԣ (.08@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +  (.098@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -119,7 +119,7 @@ H } G agg-empty-table-tests.EXPLAIN select count(*) from T2 group by col1; -ޜa ۮ(*08 @MAISCAN(T2_I2 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) +a (*0ɾ8 @MAISCAN(T2_I2 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -132,7 +132,8 @@ digraph G { } V agg-empty-table-tests=EXPLAIN select count(*) from T2 where col1 = 0 group by col1; -Эa ͮ(*08 @hAISCAN(T2_I2 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) +倱a 曫 +(*08 @hAISCAN(T2_I2 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -145,7 +146,7 @@ digraph G { } V agg-empty-table-tests=EXPLAIN select count(*) from T2 where col1 > 0 group by col1; -a (*08 @pAISCAN(T2_I2 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) +a (*08 @pAISCAN(T2_I2 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -155,10 +156,10 @@ digraph G { 3 [ label=<
Index
T2_I2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} 9 -agg-empty-table-tests EXPLAIN select count(*) from T3; - (,0*8K@ISCAN(T3_I2 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests EXPLAIN select count(*) from T3; +D ((,0ۻ8K@ISCAN(T3_I2 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -173,10 +174,10 @@ digraph G { 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} H -agg-empty-table-tests/EXPLAIN select count(*) from T3 where col1 = 0; - Ϊ(2088g@ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests/EXPLAIN select count(*) from T3 where col1 = 0; + (208g@ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -191,11 +192,10 @@ H 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} H -agg-empty-table-tests/EXPLAIN select count(*) from T3 where col1 > 0; -ຜ - (50H8l@ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests/EXPLAIN select count(*) from T3 where col1 > 0; +߀  (508l@ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -213,7 +213,7 @@ H } G agg-empty-table-tests.EXPLAIN select count(*) from T3 group by col1; -H (0 8@mISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { +蚌H ʼ(08@mISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -229,7 +229,7 @@ G } V agg-empty-table-tests=EXPLAIN select count(*) from T3 where col1 = 0 group by col1; -Ԝa (08 @ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { +a (0Q8 @ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -242,11 +242,10 @@ V 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} V -agg-empty-table-tests=EXPLAIN select count(*) from T3 where col1 > 0 group by col1; -a r(0 -8 @ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { +agg-empty-table-tests=EXPLAIN select count(*) from T3 where col1 > 0 group by col1; +>a '(08 @ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -259,10 +258,10 @@ V 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} < -agg-empty-table-tests#EXPLAIN select count(col2) from T1; -W P(08@SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests#EXPLAIN select count(col2) from T1; +̦;W Ӯ%(0و8@SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -279,10 +278,10 @@ V 6 -> 5 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} K -agg-empty-table-tests2EXPLAIN select count(col2) from T1 where col1 = 0; -j ׀E(0١8@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests2EXPLAIN select count(col2) from T1 where col1 = 0; +ؕj (0Ԁ%8@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -301,10 +300,10 @@ K 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} K -agg-empty-table-tests2EXPLAIN select count(col2) from T1 where col1 > 0; -j |(0ţ8@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests2EXPLAIN select count(col2) from T1 where col1 > 0; +j (018@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -323,10 +322,10 @@ K 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} < -agg-empty-table-tests#EXPLAIN select count(col2) from T2; -Ƅ ǰ(20-8+@AISCAN(T2_I3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests#EXPLAIN select count(col2) from T2; + (208+@AISCAN(T2_I3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -339,10 +338,10 @@ K 4 -> 3 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} K -agg-empty-table-tests2EXPLAIN select count(col2) from T2 where col1 = 0; - (<0.81@AISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests2EXPLAIN select count(col2) from T2 where col1 = 0; + ъ(<0㧄81@AISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -358,7 +357,7 @@ K } K agg-empty-table-tests2EXPLAIN select count(col2) from T2 where col1 > 0; -  ۊ(.08@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +ⶖ ս(.08@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -380,8 +379,7 @@ K } J agg-empty-table-tests1EXPLAIN select count(col2) from T2 group by col1; - -a (*0 8 @MAISCAN(T2_I4 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) +6a '(*0/8 @MAISCAN(T2_I4 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -394,7 +392,7 @@ digraph G { } Y agg-empty-table-tests@EXPLAIN select count(col2) from T2 where col1 = 0 group by col1; -a Ū(*08 @hAISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) +ιa (*0 8 @hAISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -407,7 +405,7 @@ digraph G { } Y agg-empty-table-tests@EXPLAIN select count(col2) from T2 where col1 > 0 group by col1; -a (*0 8 @pAISCAN(T2_I4 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) +ެa (*08 @pAISCAN(T2_I4 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -420,7 +418,7 @@ digraph G { } < agg-empty-table-tests#EXPLAIN select count(col2) from T3; - (,0G8K@ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + ²(,0N8K@ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -435,10 +433,10 @@ digraph G { 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} K -agg-empty-table-tests2EXPLAIN select count(col2) from T3 where col1 = 0; -  (20N8g@ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests2EXPLAIN select count(col2) from T3 where col1 = 0; + (208g@ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -453,11 +451,10 @@ K 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} K -agg-empty-table-tests2EXPLAIN select count(col2) from T3 where col1 > 0; -Ҏ - (50V8l@ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests2EXPLAIN select count(col2) from T3 where col1 > 0; +  ǽ(508l@ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -475,7 +472,7 @@ K } J agg-empty-table-tests1EXPLAIN select count(col2) from T3 group by col1; -H (0 8@pISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { +ۅH Ͷ(08@pISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -491,7 +488,7 @@ J } Y agg-empty-table-tests@EXPLAIN select count(col2) from T3 where col1 = 0 group by col1; -a (0۪ 8 @ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { +a (0Ο8 @ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -507,7 +504,8 @@ Y } Y agg-empty-table-tests@EXPLAIN select count(col2) from T3 where col1 > 0 group by col1; -a (08 @ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { +Ԅ +a (0P8 @ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -520,10 +518,10 @@ Y 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} : -agg-empty-table-tests!EXPLAIN select sum(col1) from T1; -W [(08@kSCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +agg-empty-table-tests!EXPLAIN select sum(col1) from T1; +W ߨ(0:8@kSCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -543,7 +541,7 @@ Y } I agg-empty-table-tests0EXPLAIN select sum(col1) from T1 where col1 = 0; -߿ j ﯰ(08@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +j ԋ(08@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -565,7 +563,7 @@ I } I agg-empty-table-tests0EXPLAIN select sum(col1) from T1 where col2 = 0; -j (08@SCAN(<,>) | TFILTER T1 | FILTER _.COL2 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +Ζj 楃(098@SCAN(<,>) | TFILTER T1 | FILTER _.COL2 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -584,10 +582,10 @@ I 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} I -agg-empty-table-tests0EXPLAIN select sum(col1) from T1 where col1 > 0; -j j(08@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +agg-empty-table-tests0EXPLAIN select sum(col1) from T1 where col1 > 0; +ʉj (028@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -606,10 +604,10 @@ I 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} I -agg-empty-table-tests0EXPLAIN select sum(col1) from T1 where col2 > 0; -j k(08@SCAN(<,>) | TFILTER T1 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +agg-empty-table-tests0EXPLAIN select sum(col1) from T1 where col2 > 0; +j ˚(0?8@SCAN(<,>) | TFILTER T1 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -631,7 +629,7 @@ I } : agg-empty-table-tests!EXPLAIN select sum(col1) from T2; - (20,8+@cAISCAN(T2_I5 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +ʐ (2098+@cAISCAN(T2_I5 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -647,7 +645,7 @@ I } I agg-empty-table-tests0EXPLAIN select sum(col1) from T2 where col1 = 0; - ۋ(.0Л8@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + ѵ(.0A8@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -669,7 +667,7 @@ I } I agg-empty-table-tests0EXPLAIN select sum(col1) from T2 where col2 = 0; -  Ց(<0>81@AISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + (<0V81@AISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -685,8 +683,7 @@ I } I agg-empty-table-tests0EXPLAIN select sum(col1) from T2 where col1 > 0; - - (.0מ8@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +߭ (.098@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -708,7 +705,8 @@ I } I agg-empty-table-tests0EXPLAIN select sum(col1) from T2 where col2 > 0; - Դ(.08@SCAN(<,>) | TFILTER T2 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + + (.0+8@SCAN(<,>) | TFILTER T2 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -730,7 +728,7 @@ I } W agg-empty-table-tests>EXPLAIN select sum(col1) from T2 where col2 = 0 group by col2; -a (*08 @hAISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) +a (*08 @hAISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -743,7 +741,7 @@ digraph G { } W agg-empty-table-tests>EXPLAIN select sum(col1) from T2 where col2 > 0 group by col2; -a (*08 @pAISCAN(T2_I6 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) +Ãa (*0 8 @pAISCAN(T2_I6 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -753,10 +751,10 @@ digraph G { 3 [ label=<
Index
T2_I6
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} : -agg-empty-table-tests!EXPLAIN select sum(col1) from T3; - ֵ(,0L8K@eISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +agg-empty-table-tests!EXPLAIN select sum(col1) from T3; +  (,08K@eISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -774,8 +772,7 @@ digraph G { } I agg-empty-table-tests0EXPLAIN select sum(col1) from T3 where col1 = 0; - - (20ʍK8g@ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + (20^8g@ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -790,10 +787,10 @@ I 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} I -agg-empty-table-tests0EXPLAIN select sum(col1) from T3 where col2 = 0; -˻  (20=8g@ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +agg-empty-table-tests0EXPLAIN select sum(col1) from T3 where col2 = 0; +خ (208g@ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -808,10 +805,10 @@ I 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} I -agg-empty-table-tests0EXPLAIN select sum(col1) from T3 where col1 > 0; -㺐 (50;8l@ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +agg-empty-table-tests0EXPLAIN select sum(col1) from T3 where col1 > 0; +  (508l@ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -826,10 +823,10 @@ I 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} I -agg-empty-table-tests0EXPLAIN select sum(col1) from T3 where col2 > 0; - Ӳ(5078l@ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +agg-empty-table-tests0EXPLAIN select sum(col1) from T3 where col2 > 0; +E )(508l@ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -844,10 +841,10 @@ I 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} W -agg-empty-table-tests>EXPLAIN select sum(col1) from T3 where col1 = 0 group by col2; -_ (0 8@ISCAN(T3_I2 <,>) | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { +agg-empty-table-tests>EXPLAIN select sum(col1) from T3 where col1 = 0 group by col2; +?_ )(0䱧8@ISCAN(T3_I2 <,>) | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -865,7 +862,7 @@ W } W agg-empty-table-tests>EXPLAIN select sum(col1) from T3 where col2 = 0 group by col2; -a (08 @ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { +a (08 @ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -878,10 +875,10 @@ W 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} W -agg-empty-table-tests>EXPLAIN select sum(col1) from T3 where col1 > 0 group by col2; -_ ˋ(0Ͱ8@ISCAN(T3_I2 <,>) | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { +agg-empty-table-tests>EXPLAIN select sum(col1) from T3 where col1 > 0 group by col2; +>_ )(0ɪ8@ISCAN(T3_I2 <,>) | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -899,7 +896,7 @@ W } W agg-empty-table-tests>EXPLAIN select sum(col1) from T3 where col2 > 0 group by col2; -a (0 8 @ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { + a (0:8 @ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -912,4 +909,84 @@ W 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +M +)agg-empty-table-tests-after-modifications EXPLAIN select count(*) from T1; +۸W Г(0,8@SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count_star(*) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 7 [ label=<
Primary Storage
record types: [T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q27> label="q27" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +\ +)agg-empty-table-tests-after-modifications/EXPLAIN select count(*) from T1 where col1 = 0; +j ~(08@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count_star(*) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q23 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Predicate Filter
WHERE q2.COL1 EQUALS promote(@c11 AS LONG)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Primary Storage
record types: [T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q32> label="q32" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +\ +)agg-empty-table-tests-after-modifications/EXPLAIN select count(*) from T1 where col1 > 0; +j ϵ(0-8@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count_star(*) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q23 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Predicate Filter
WHERE q2.COL1 GREATER_THAN promote(@c11 AS LONG)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Primary Storage
record types: [T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q32> label="q32" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +M +)agg-empty-table-tests-after-modifications EXPLAIN select count(*) from T2; +  ν(20߷W8+@AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Value Computation
MAP (q4 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Index Scan
scan type: BY_GROUP
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 5 [ label=<
Index
T2_I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; } \ No newline at end of file diff --git a/yaml-tests/src/test/resources/aggregate-empty-table.metrics.yaml b/yaml-tests/src/test/resources/aggregate-empty-table.metrics.yaml index 8b4a810f0a..606e9c3ad5 100644 --- a/yaml-tests/src/test/resources/aggregate-empty-table.metrics.yaml +++ b/yaml-tests/src/test/resources/aggregate-empty-table.metrics.yaml @@ -3,9 +3,9 @@ agg-empty-table-tests: explain: SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 263 - task_total_time_ms: 7 + task_total_time_ms: 8 transform_count: 87 - transform_time_ms: 1 + transform_time_ms: 2 transform_yield_count: 15 insert_time_ms: 0 insert_new_count: 22 @@ -15,9 +15,9 @@ agg-empty-table-tests: MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 335 - task_total_time_ms: 4 + task_total_time_ms: 6 transform_count: 106 - transform_time_ms: 1 + transform_time_ms: 2 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -27,9 +27,9 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 335 - task_total_time_ms: 9 + task_total_time_ms: 11 transform_count: 106 - transform_time_ms: 2 + transform_time_ms: 5 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -38,11 +38,11 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)' task_count: 450 - task_total_time_ms: 17 + task_total_time_ms: 24 transform_count: 158 - transform_time_ms: 10 + transform_time_ms: 15 transform_yield_count: 50 - insert_time_ms: 0 + insert_time_ms: 1 insert_new_count: 43 insert_reused_count: 4 - query: EXPLAIN select count(*) from T2 where col1 = 0; @@ -50,9 +50,9 @@ agg-empty-table-tests: _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)' task_count: 538 - task_total_time_ms: 57 + task_total_time_ms: 37 transform_count: 182 - transform_time_ms: 31 + transform_time_ms: 25 transform_yield_count: 60 insert_time_ms: 1 insert_new_count: 49 @@ -62,9 +62,9 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 393 - task_total_time_ms: 15 + task_total_time_ms: 25 transform_count: 135 - transform_time_ms: 10 + transform_time_ms: 18 transform_yield_count: 46 insert_time_ms: 0 insert_new_count: 28 @@ -73,9 +73,9 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I2 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 6 + task_total_time_ms: 10 transform_count: 97 - transform_time_ms: 4 + transform_time_ms: 7 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -84,9 +84,9 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I2 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 15 + task_total_time_ms: 30 transform_count: 97 - transform_time_ms: 10 + transform_time_ms: 21 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -95,9 +95,9 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I2 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 15 + task_total_time_ms: 9 transform_count: 97 - transform_time_ms: 10 + transform_time_ms: 6 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -106,11 +106,11 @@ agg-empty-table-tests: explain: ISCAN(T3_I2 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 509 - task_total_time_ms: 8 + task_total_time_ms: 143 transform_count: 151 - transform_time_ms: 3 + transform_time_ms: 85 transform_yield_count: 44 - insert_time_ms: 0 + insert_time_ms: 9 insert_new_count: 75 insert_reused_count: 6 - query: EXPLAIN select count(*) from T3 where col1 = 0; @@ -118,11 +118,11 @@ agg-empty-table-tests: AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 730 - task_total_time_ms: 14 + task_total_time_ms: 29 transform_count: 215 - transform_time_ms: 4 + transform_time_ms: 10 transform_yield_count: 50 - insert_time_ms: 0 + insert_time_ms: 2 insert_new_count: 103 insert_reused_count: 5 - query: EXPLAIN select count(*) from T3 where col1 > 0; @@ -130,20 +130,20 @@ agg-empty-table-tests: AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 757 - task_total_time_ms: 21 + task_total_time_ms: 27 transform_count: 218 - transform_time_ms: 6 + transform_time_ms: 7 transform_yield_count: 53 - insert_time_ms: 1 + insert_time_ms: 2 insert_new_count: 108 insert_reused_count: 5 - query: EXPLAIN select count(*) from T3 group by col1; explain: ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0) task_count: 220 - task_total_time_ms: 5 + task_total_time_ms: 6 transform_count: 72 - transform_time_ms: 2 + transform_time_ms: 3 transform_yield_count: 26 insert_time_ms: 0 insert_new_count: 18 @@ -152,33 +152,33 @@ agg-empty-table-tests: explain: ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0) task_count: 317 - task_total_time_ms: 15 + task_total_time_ms: 33 transform_count: 97 - transform_time_ms: 10 + transform_time_ms: 13 transform_yield_count: 30 - insert_time_ms: 0 + insert_time_ms: 1 insert_new_count: 32 insert_reused_count: 1 - query: EXPLAIN select count(*) from T3 where col1 > 0 group by col1; explain: ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0) task_count: 317 - task_total_time_ms: 6 + task_total_time_ms: 131 transform_count: 97 - transform_time_ms: 1 + transform_time_ms: 83 transform_yield_count: 30 - insert_time_ms: 0 + insert_time_ms: 2 insert_new_count: 32 insert_reused_count: 1 - query: EXPLAIN select count(col2) from T1; explain: SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 263 - task_total_time_ms: 5 + task_total_time_ms: 124 transform_count: 87 - transform_time_ms: 1 + transform_time_ms: 78 transform_yield_count: 15 - insert_time_ms: 0 + insert_time_ms: 6 insert_new_count: 22 insert_reused_count: 2 - query: EXPLAIN select count(col2) from T1 where col1 = 0; @@ -186,9 +186,9 @@ agg-empty-table-tests: MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 335 - task_total_time_ms: 3 + task_total_time_ms: 8 transform_count: 106 - transform_time_ms: 1 + transform_time_ms: 2 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -198,9 +198,9 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 335 - task_total_time_ms: 7 + task_total_time_ms: 10 transform_count: 106 - transform_time_ms: 2 + transform_time_ms: 3 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -209,11 +209,11 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)' task_count: 450 - task_total_time_ms: 16 + task_total_time_ms: 18 transform_count: 158 - transform_time_ms: 10 + transform_time_ms: 9 transform_yield_count: 50 - insert_time_ms: 0 + insert_time_ms: 2 insert_new_count: 43 insert_reused_count: 4 - query: EXPLAIN select count(col2) from T2 where col1 = 0; @@ -221,11 +221,11 @@ agg-empty-table-tests: _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)' task_count: 538 - task_total_time_ms: 17 + task_total_time_ms: 49 transform_count: 182 - transform_time_ms: 11 + transform_time_ms: 31 transform_yield_count: 60 - insert_time_ms: 0 + insert_time_ms: 6 insert_new_count: 49 insert_reused_count: 4 - query: EXPLAIN select count(col2) from T2 where col1 > 0; @@ -233,9 +233,9 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 393 - task_total_time_ms: 20 + task_total_time_ms: 12 transform_count: 135 - transform_time_ms: 14 + transform_time_ms: 9 transform_yield_count: 46 insert_time_ms: 0 insert_new_count: 28 @@ -244,9 +244,9 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I4 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 22 + task_total_time_ms: 114 transform_count: 97 - transform_time_ms: 16 + transform_time_ms: 83 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -255,9 +255,9 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 17 + task_total_time_ms: 13 transform_count: 97 - transform_time_ms: 11 + transform_time_ms: 8 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -266,9 +266,9 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I4 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 15 + task_total_time_ms: 17 transform_count: 97 - transform_time_ms: 10 + transform_time_ms: 11 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -277,7 +277,7 @@ agg-empty-table-tests: explain: ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 509 - task_total_time_ms: 16 + task_total_time_ms: 14 transform_count: 151 transform_time_ms: 5 transform_yield_count: 44 @@ -289,11 +289,11 @@ agg-empty-table-tests: AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 730 - task_total_time_ms: 27 + task_total_time_ms: 40 transform_count: 215 - transform_time_ms: 7 + transform_time_ms: 13 transform_yield_count: 50 - insert_time_ms: 1 + insert_time_ms: 3 insert_new_count: 103 insert_reused_count: 5 - query: EXPLAIN select count(col2) from T3 where col1 > 0; @@ -301,20 +301,20 @@ agg-empty-table-tests: AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 757 - task_total_time_ms: 22 + task_total_time_ms: 24 transform_count: 218 - transform_time_ms: 5 + transform_time_ms: 7 transform_yield_count: 53 - insert_time_ms: 1 + insert_time_ms: 2 insert_new_count: 108 insert_reused_count: 5 - query: EXPLAIN select count(col2) from T3 group by col1; explain: ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0) task_count: 220 - task_total_time_ms: 4 + task_total_time_ms: 12 transform_count: 72 - transform_time_ms: 2 + transform_time_ms: 3 transform_yield_count: 26 insert_time_ms: 0 insert_new_count: 18 @@ -323,7 +323,7 @@ agg-empty-table-tests: explain: ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0) task_count: 317 - task_total_time_ms: 11 + task_total_time_ms: 7 transform_count: 97 transform_time_ms: 3 transform_yield_count: 30 @@ -335,11 +335,11 @@ agg-empty-table-tests: AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0) task_count: 317 - task_total_time_ms: 11 + task_total_time_ms: 21 transform_count: 97 - transform_time_ms: 3 + transform_time_ms: 7 transform_yield_count: 30 - insert_time_ms: 0 + insert_time_ms: 1 insert_new_count: 32 insert_reused_count: 1 - query: EXPLAIN select sum(col1) from T1; @@ -348,7 +348,7 @@ agg-empty-table-tests: task_count: 263 task_total_time_ms: 7 transform_count: 87 - transform_time_ms: 1 + transform_time_ms: 2 transform_yield_count: 15 insert_time_ms: 0 insert_new_count: 22 @@ -358,7 +358,7 @@ agg-empty-table-tests: MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 335 - task_total_time_ms: 24 + task_total_time_ms: 6 transform_count: 106 transform_time_ms: 2 transform_yield_count: 17 @@ -370,9 +370,9 @@ agg-empty-table-tests: MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 335 - task_total_time_ms: 8 + task_total_time_ms: 12 transform_count: 106 - transform_time_ms: 2 + transform_time_ms: 4 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -382,9 +382,9 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 335 - task_total_time_ms: 7 + task_total_time_ms: 10 transform_count: 106 - transform_time_ms: 1 + transform_time_ms: 3 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -394,18 +394,18 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 335 - task_total_time_ms: 7 + task_total_time_ms: 14 transform_count: 106 - transform_time_ms: 1 + transform_time_ms: 6 transform_yield_count: 17 - insert_time_ms: 0 + insert_time_ms: 1 insert_new_count: 28 insert_reused_count: 2 - query: EXPLAIN select sum(col1) from T2; explain: 'AISCAN(T2_I5 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)' task_count: 450 - task_total_time_ms: 18 + task_total_time_ms: 17 transform_count: 158 transform_time_ms: 10 transform_yield_count: 50 @@ -417,11 +417,11 @@ agg-empty-table-tests: MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 393 - task_total_time_ms: 14 + task_total_time_ms: 39 transform_count: 135 - transform_time_ms: 10 + transform_time_ms: 30 transform_yield_count: 46 - insert_time_ms: 0 + insert_time_ms: 1 insert_new_count: 28 insert_reused_count: 2 - query: EXPLAIN select sum(col1) from T2 where col2 = 0; @@ -429,9 +429,9 @@ agg-empty-table-tests: _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)' task_count: 538 - task_total_time_ms: 25 + task_total_time_ms: 34 transform_count: 182 - transform_time_ms: 17 + transform_time_ms: 23 transform_yield_count: 60 insert_time_ms: 1 insert_new_count: 49 @@ -441,9 +441,9 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 393 - task_total_time_ms: 22 + task_total_time_ms: 17 transform_count: 135 - transform_time_ms: 16 + transform_time_ms: 11 transform_yield_count: 46 insert_time_ms: 0 insert_new_count: 28 @@ -453,9 +453,9 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 393 - task_total_time_ms: 18 + task_total_time_ms: 21 transform_count: 135 - transform_time_ms: 13 + transform_time_ms: 15 transform_yield_count: 46 insert_time_ms: 0 insert_new_count: 28 @@ -464,9 +464,9 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 12 + task_total_time_ms: 17 transform_count: 97 - transform_time_ms: 6 + transform_time_ms: 12 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -475,9 +475,9 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I6 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 8 + task_total_time_ms: 15 transform_count: 97 - transform_time_ms: 6 + transform_time_ms: 9 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -486,20 +486,20 @@ agg-empty-table-tests: explain: ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 509 - task_total_time_ms: 16 + task_total_time_ms: 26 transform_count: 151 - transform_time_ms: 5 + transform_time_ms: 10 transform_yield_count: 44 - insert_time_ms: 1 + insert_time_ms: 3 insert_new_count: 75 insert_reused_count: 6 - query: EXPLAIN select sum(col1) from T3 where col1 = 0; explain: ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 730 - task_total_time_ms: 22 + task_total_time_ms: 18 transform_count: 215 - transform_time_ms: 4 + transform_time_ms: 6 transform_yield_count: 50 insert_time_ms: 1 insert_new_count: 103 @@ -508,33 +508,33 @@ agg-empty-table-tests: explain: ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 730 - task_total_time_ms: 19 + task_total_time_ms: 40 transform_count: 215 - transform_time_ms: 3 + transform_time_ms: 14 transform_yield_count: 50 - insert_time_ms: 1 + insert_time_ms: 3 insert_new_count: 103 insert_reused_count: 5 - query: EXPLAIN select sum(col1) from T3 where col1 > 0; explain: ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 757 - task_total_time_ms: 12 + task_total_time_ms: 28 transform_count: 218 - transform_time_ms: 3 + transform_time_ms: 7 transform_yield_count: 53 - insert_time_ms: 0 + insert_time_ms: 2 insert_new_count: 108 insert_reused_count: 5 - query: EXPLAIN select sum(col1) from T3 where col2 > 0; explain: ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 757 - task_total_time_ms: 12 + task_total_time_ms: 145 transform_count: 218 - transform_time_ms: 3 + transform_time_ms: 86 transform_yield_count: 53 - insert_time_ms: 0 + insert_time_ms: 8 insert_new_count: 108 insert_reused_count: 5 - query: EXPLAIN select sum(col1) from T3 where col1 = 0 group by col2; @@ -542,11 +542,11 @@ agg-empty-table-tests: AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0) task_count: 299 - task_total_time_ms: 7 + task_total_time_ms: 133 transform_count: 95 - transform_time_ms: 3 + transform_time_ms: 86 transform_yield_count: 29 - insert_time_ms: 0 + insert_time_ms: 2 insert_new_count: 28 insert_reused_count: 2 - query: EXPLAIN select sum(col1) from T3 where col2 = 0 group by col2; @@ -555,7 +555,7 @@ agg-empty-table-tests: task_count: 317 task_total_time_ms: 14 transform_count: 97 - transform_time_ms: 4 + transform_time_ms: 5 transform_yield_count: 30 insert_time_ms: 0 insert_new_count: 32 @@ -565,11 +565,11 @@ agg-empty-table-tests: MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0) task_count: 299 - task_total_time_ms: 15 + task_total_time_ms: 131 transform_count: 95 - transform_time_ms: 4 + transform_time_ms: 87 transform_yield_count: 29 - insert_time_ms: 0 + insert_time_ms: 2 insert_new_count: 28 insert_reused_count: 2 - query: EXPLAIN select sum(col1) from T3 where col2 > 0 group by col2; @@ -577,10 +577,57 @@ agg-empty-table-tests: AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0) task_count: 317 - task_total_time_ms: 7 + task_total_time_ms: 19 transform_count: 97 - transform_time_ms: 2 + transform_time_ms: 6 transform_yield_count: 30 insert_time_ms: 0 insert_new_count: 32 insert_reused_count: 1 +agg-empty-table-tests-after-modifications: +- query: EXPLAIN select count(*) from T1; + explain: SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | + ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) + task_count: 263 + task_total_time_ms: 8 + transform_count: 87 + transform_time_ms: 2 + transform_yield_count: 15 + insert_time_ms: 0 + insert_new_count: 22 + insert_reused_count: 2 +- query: EXPLAIN select count(*) from T1 where col1 = 0; + explain: SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | + MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, + promote(0l AS LONG)) AS _0) + task_count: 335 + task_total_time_ms: 6 + transform_count: 106 + transform_time_ms: 2 + transform_yield_count: 17 + insert_time_ms: 0 + insert_new_count: 28 + insert_reused_count: 2 +- query: EXPLAIN select count(*) from T1 where col1 > 0; + explain: SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) + | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, + promote(0l AS LONG)) AS _0) + task_count: 335 + task_total_time_ms: 11 + transform_count: 106 + transform_time_ms: 5 + transform_yield_count: 17 + insert_time_ms: 0 + insert_new_count: 28 + insert_reused_count: 2 +- query: EXPLAIN select count(*) from T2; + explain: 'AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY + NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)' + task_count: 450 + task_total_time_ms: 24 + transform_count: 158 + transform_time_ms: 15 + transform_yield_count: 50 + insert_time_ms: 1 + insert_new_count: 43 + insert_reused_count: 4 diff --git a/yaml-tests/src/test/resources/aggregate-empty-table.yamsql b/yaml-tests/src/test/resources/aggregate-empty-table.yamsql index d040c1e07a..7f320a4925 100644 --- a/yaml-tests/src/test/resources/aggregate-empty-table.yamsql +++ b/yaml-tests/src/test/resources/aggregate-empty-table.yamsql @@ -34,24 +34,17 @@ schema_template: test_block: name: agg-empty-table-tests tests: - # 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - - # - query: select count(*) from T1; - # - explain: "SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # - maxRows: 1 - # - result: [{0}] - # - result: [] + - + - query: select count(*) from T1; + - explain: "SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - result: [{0}] - - query: select count(*) from T1 where col1 = 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - - maxRows: 0 - result: [{0}] - - query: select count(*) from T1 where col1 > 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - - maxRows: 0 - result: [{0}] - - query: select count(*) from T1 where col1 = 0 group by col1; @@ -69,7 +62,6 @@ test_block: - query: select count(*) from T1 where col1 > 0 group by col1; - error: "0AF00" - - # DONE: 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (result does not contain all expected rows! expected 1 rows, got 0) - query: select count(*) from T2; - explain: "AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - initialVersionLessThan: 4.0.561.0 @@ -79,13 +71,11 @@ test_block: - - query: select count(*) from T2 where col1 = 0; - explain: "AISCAN(T2_I2 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - result: [{0}] + - result: [{0}] - - query: select count(*) from T2 where col1 > 0; - explain: "SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - result: [{0}] + - result: [{0}] - - query: select count(*) from T2 group by col1; - explain: "AISCAN(T2_I2 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" @@ -101,18 +91,15 @@ test_block: - - query: select count(*) from T3; - explain: "ISCAN(T3_I2 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - result: [{0}] + - result: [{0}] - - query: select count(*) from T3 where col1 = 0; - explain: "ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{0}] + - result: [{0}] - - query: select count(*) from T3 where col1 > 0; - explain: "ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - result: [{0}] + - result: [{0}] - - query: select count(*) from T3 group by col1; - explain: "ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)" @@ -128,18 +115,15 @@ test_block: - - query: select count(col2) from T1; - explain: "SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{0}] + - result: [{0}] - - query: select count(col2) from T1 where col1 = 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{0}] + - result: [{0}] - - query: select count(col2) from T1 where col1 > 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{0}] + - result: [{0}] - - query: select count(col2) from T1 where col1 = 0 group by col1; - error: "0AF00" @@ -156,7 +140,6 @@ test_block: - query: select count(col2) from T1 where col1 > 0 group by col1; - error: "0AF00" - - # DONE: 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (result does not contain all expected rows! expected 1 rows, got 0) - query: select count(col2) from T2; - explain: "AISCAN(T2_I3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - initialVersionLessThan: 4.0.561.0 @@ -166,13 +149,11 @@ test_block: - - query: select count(col2) from T2 where col1 = 0; - explain: "AISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{0}] + - result: [{0}] - - query: select count(col2) from T2 where col1 > 0; - explain: "SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - result: [{0}] + - result: [{0}] - - query: select count(col2) from T2 group by col1; - explain: "AISCAN(T2_I4 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" @@ -188,18 +169,15 @@ test_block: - - query: select count(col2) from T3; - explain: "ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - result: [{0}] + - result: [{0}] - - query: select count(col2) from T3 where col1 = 0; - explain: "ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{0}] + - result: [{0}] - - query: select count(col2) from T3 where col1 > 0; - explain: "ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - result: [{0}] + - result: [{0}] - - query: select count(col2) from T3 group by col1; - explain: "ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)" @@ -215,32 +193,24 @@ test_block: - - query: select sum(col1) from T1; - explain: "SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (too many rows in actual result set! expected 0 rows, got 1) - # - maxRows: 1 - # - result: [{!null _}] - # - result: [] + - result: [{!null _}] - - query: select sum(col1) from T1 where col1 = 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - result: [{!null _}] + - result: [{!null _}] - - query: select sum(col1) from T1 where col2 = 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL2 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{!null _}] + - result: [{!null _}] - - query: select sum(col1) from T1 where col1 > 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{!null _}] + - result: [{!null _}] - - query: select sum(col1) from T1 where col2 > 0; - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - result: [{!null _}] + - result: [{!null _}] - - # DONE: 4.1 Triage: This test fails when running in multi-server mode against 4.0.559.6 (result does not contain all expected rows! expected 1 rows, got 0) - query: select sum(col1) from T2; - explain: "AISCAN(T2_I5 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - initialVersionLessThan: 4.0.561.0 @@ -250,23 +220,19 @@ test_block: - - query: select sum(col1) from T2 where col1 = 0; - explain: "SCAN(<,>) | TFILTER T2 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{!null _}] + - result: [{!null _}] - - query: select sum(col1) from T2 where col2 = 0; - explain: "AISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{!null _}] + - result: [{!null _}] - - query: select sum(col1) from T2 where col1 > 0; - explain: "SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{!null _}] + - result: [{!null _}] - - query: select sum(col1) from T2 where col2 > 0; - explain: "SCAN(<,>) | TFILTER T2 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - result: [{!null _}] + - result: [{!null _}] - - query: select sum(col1) from T2 where col1 = 0 group by col2; - error: "0AF00" @@ -280,33 +246,27 @@ test_block: - - query: select sum(col1) from T2 where col2 > 0 group by col2; - explain: "AISCAN(T2_I6 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [] + - result: [] - - query: select sum(col1) from T3; - explain: "ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{!null _}] + - result: [{!null _}] - - query: select sum(col1) from T3 where col1 = 0; - explain: "ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{!null _}] + - result: [{!null _}] - - query: select sum(col1) from T3 where col2 = 0; - explain: "ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - result: [{!null _}] + - result: [{!null _}] - - query: select sum(col1) from T3 where col1 > 0; - explain: "ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - result: [{!null _}] + - result: [{!null _}] - - query: select sum(col1) from T3 where col2 > 0; - explain: "ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - result: [{!null _}] + - result: [{!null _}] - - query: select sum(col1) from T3 where col1 = 0 group by col2; - explain: "ISCAN(T3_I2 <,>) | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)" @@ -348,19 +308,20 @@ test_block: --- test_block: name: agg-empty-table-tests-after-modifications + preset: single_repetition_ordered tests: - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - - # - query: select count(*) from T1; - # - result: [{0}] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - - # - query: select count(*) from T1 where col1 = 0; - # - result: [{0}] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - - # - query: select count(*) from T1 where col1 > 0; - # - result: [{0}] + - + - query: select count(*) from T1; + - explain: "SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - result: [{0}] + - + - query: select count(*) from T1 where col1 = 0; + - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - result: [{0}] + - + - query: select count(*) from T1 where col1 > 0; + - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - result: [{0}] - - query: select count(*) from T1 where col1 = 0 group by col1; - error: "0AF00" @@ -376,18 +337,19 @@ test_block: - - query: select count(*) from T1 where col1 > 0 group by col1; - error: "0AF00" - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - - # - query: select count(*) from T2; - # - result: [{0}] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - - # - query: select count(*) from T2 where col1 = 0; - # - result: [{0}] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - - # - query: select count(*) from T2 where col1 > 0; - # - result: [{0}] + - + - query: select count(*) from T2; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - explain: "AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - result: [{0}] + - + - query: select count(*) from T2 where col1 = 0; + - result: [{0}] + - + - query: select count(*) from T2 where col1 > 0; + - result: [{0}] # - # # TODO ([POST] count index returns 0 instead of nothing when running on a table that was cleared) # - query: select count(*) from T2 group by col1; @@ -399,18 +361,15 @@ test_block: # # TODO ([POST] count index returns 0 instead of nothing when running on a table that was cleared) # - query: select count(*) from T2 where col1 > 0 group by col1; # - result: [] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - - # - query: select count(*) from T3; - # - result: [{0}] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - - # - query: select count(*) from T3 where col1 = 0; - # - result: [{0}] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - - # - query: select count(*) from T3 where col1 > 0; - # - result: [{0}] + - + - query: select count(*) from T3; + - result: [{0}] + - + - query: select count(*) from T3 where col1 = 0; + - result: [{0}] + - + - query: select count(*) from T3 where col1 > 0; + - result: [{0}] - - query: select count(*) from T3 group by col1; - result: [] @@ -420,18 +379,15 @@ test_block: - - query: select count(*) from T3 where col1 > 0 group by col1; - result: [] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - - # - query: select count(col2) from T1; - # - result: [{0}] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - - # - query: select count(col2) from T1 where col1 = 0; - # - result: [{0}] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (Received continuation shouldn't be at beginning) - # - - # - query: select count(col2) from T1 where col1 > 0; - # - result: [{0}] + - + - query: select count(col2) from T1; + - result: [{0}] + - + - query: select count(col2) from T1 where col1 = 0; + - result: [{0}] + - + - query: select count(col2) from T1 where col1 > 0; + - result: [{0}] - - query: select count(col2) from T1 where col1 = 0 group by col1; - error: "0AF00" @@ -447,18 +403,21 @@ test_block: - - query: select count(col2) from T1 where col1 > 0 group by col1; - error: "0AF00" - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - - # - query: select count(col2) from T2; - # - result: [{0}] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - - # - query: select count(col2) from T2 where col1 = 0; - # - result: [{0}] - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - - # - query: select count(col2) from T2 where col1 > 0; - # - result: [{0}] + - + - query: select count(col2) from T2; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{0}] + - + - query: select count(col2) from T2 where col1 = 0; + - result: [{0}] + - + - query: select count(col2) from T2 where col1 > 0; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{0}] # - # # TODO ([POST] count index returns 0 instead of nothing when running on a table that was cleared) # - query: select count(col2) from T2 group by col1; @@ -470,18 +429,15 @@ test_block: # # TODO ([POST] count index returns 0 instead of nothing when running on a table that was cleared) # - query: select count(col2) from T2 where col1 > 0 group by col1; # - result: [] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - - # - query: select count(col2) from T3; - # - result: [{0}] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - - # - query: select count(col2) from T3 where col1 = 0; - # - result: [{0}] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - - # - query: select count(col2) from T3 where col1 > 0; - # - result: [{0}] + - + - query: select count(col2) from T3; + - result: [{0}] + - + - query: select count(col2) from T3 where col1 = 0; + - result: [{0}] + - + - query: select count(col2) from T3 where col1 > 0; + - result: [{0}] - - query: select count(col2) from T3 group by col1; - result: [] @@ -491,51 +447,65 @@ test_block: - - query: select count(col2) from T3 where col1 > 0 group by col1; - result: [] - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - - # - query: select sum(col1) from T1; - # - result: [{!null _}] - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - - # - query: select sum(col1) from T1 where col1 = 0; - # - result: [{!null _}] - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - - # - query: select sum(col1) from T1 where col2 = 0; - # - result: [{!null _}] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - - # - query: select sum(col1) from T1 where col1 > 0; - # - result: [{!null _}] - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - - # - query: select sum(col1) from T1 where col2 > 0; - # - result: [{!null _}] - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - + - + - query: select sum(col1) from T1; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{!null _}] + - + - query: select sum(col1) from T1 where col1 = 0; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{!null _}] + - + - query: select sum(col1) from T1 where col2 = 0; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{!null _}] + - + - query: select sum(col1) from T1 where col1 > 0; + - result: [{!null _}] + - + - query: select sum(col1) from T1 where col2 > 0; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{!null _}] + - # TODO (enhance SUM aggregate index to disambiguate null results and 0 results) # This query is using the index T2_I5, the reason we're returning 0 here comes from the SUM index maintainer that # is configured by default to: # - subtract the indexed value when the corresponding tuple is removed from the base table. # - if the sum reaches zero, it keeps it in the sum index and does not remove the entry from there. - # - query: select sum(col1) from T2; - # - result: [{0}] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - - # - query: select sum(col1) from T2 where col1 = 0; - # - result: [{!null _}] - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - - # - query: select sum(col1) from T2 where col2 = 0; - # - result: [{!null _}] - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - - # - query: select sum(col1) from T2 where col1 > 0; - # - result: [{!null _}] - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - - # - query: select sum(col1) from T2 where col2 > 0; - # - result: [{!null _}] + - query: select sum(col1) from T2; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{0}] + - + - query: select sum(col1) from T2 where col1 = 0; + - result: [{!null _}] + - + - query: select sum(col1) from T2 where col2 = 0; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{!null _}] + - + - query: select sum(col1) from T2 where col1 > 0; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{!null _}] + - + - query: select sum(col1) from T2 where col2 > 0; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{!null _}] - - query: select sum(col1) from T2 where col1 = 0 group by col2; - error: "0AF00" @@ -549,26 +519,33 @@ test_block: # # TODO ([POST] Enhance SUM aggregate index to disambiguate null results and 0 results) # - query: select sum(col1) from T2 where col2 > 0 group by col2; # - result: [] - # 4.1 Triage: This test fails when running in forced-continuations mode against 4.0.559.6 (result has more than maxRows rows) - # - - # - query: select sum(col1) from T3; - # - result: [{!null _}] - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - - # - query: select sum(col1) from T3 where col1 = 0; - # - result: [{!null _}] - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - - # - query: select sum(col1) from T3 where col2 = 0; - # - result: [{!null _}] - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - - # - query: select sum(col1) from T3 where col1 > 0; - # - result: [{!null _}] - # 4.1 Triage: this test fails when running with forced continuations current version on two JVMs (Received continuation shouldn't be at beginning) - # - - # - query: select sum(col1) from T3 where col2 > 0; - # - result: [{!null _}] + - + - query: select sum(col1) from T3; + - result: [{!null _}] + - + - query: select sum(col1) from T3 where col1 = 0; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{!null _}] + - + - query: select sum(col1) from T3 where col2 = 0; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{!null _}] + - + - query: select sum(col1) from T3 where col1 > 0; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{!null _}] + - + - query: select sum(col1) from T3 where col2 > 0; + # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{!null _}] - - query: select sum(col1) from T3 where col1 = 0 group by col2; - result: [] From 12693c0808727733526890419e452671759635d8 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Fri, 28 Feb 2025 12:45:44 +0000 Subject: [PATCH 31/62] Fixes #3096: Infinite continuations: sum(*) returns alternating rows forever --- .../RecordQueryStreamingAggregationPlan.java | 3 +- .../resources/aggregate-index-tests.yamsql | 83 +++++++++++++++---- 2 files changed, 71 insertions(+), 15 deletions(-) diff --git a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryStreamingAggregationPlan.java b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryStreamingAggregationPlan.java index 4342b4b65d..109b7380de 100644 --- a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryStreamingAggregationPlan.java +++ b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryStreamingAggregationPlan.java @@ -370,7 +370,8 @@ public PRecordQueryStreamingAggregationPlan toProto(@Nonnull final PlanSerializa } builder.setGroupingKeyAlias(groupingKeyAlias.getId()) .setAggregateAlias(aggregateAlias.getId()) - .setCompleteResultValue(completeResultValue.toValueProto(serializationContext)); + .setCompleteResultValue(completeResultValue.toValueProto(serializationContext)) + .setIsCreateDefaultOnEmpty(isCreateDefaultOnEmpty); return builder.build(); } diff --git a/yaml-tests/src/test/resources/aggregate-index-tests.yamsql b/yaml-tests/src/test/resources/aggregate-index-tests.yamsql index 24c1a079e7..812fd0dd45 100644 --- a/yaml-tests/src/test/resources/aggregate-index-tests.yamsql +++ b/yaml-tests/src/test/resources/aggregate-index-tests.yamsql @@ -132,9 +132,22 @@ test_block: # At some point, should be able to roll up values from the aggregate index. However, even # controlling for that, it can still use the index - query: select max(col2) from T1 use index (mv8); + - supported_version: !current_version - explain: "ISCAN(MV8 <,>) | MAP (_ AS _0) | AGG (max_l(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) - # - result: [{!l 13}] + - result: [{!l 13}] + - + - query: select max(col2) from T1 use index (mv8); + - maxRows: 1 + # Cannot use FORCE_CONTINUATIONS with older versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + # (Extra values being produced after exhausting source of an aggregate cursor) + # Can remove once we do not care about backwards compatibility before !current_version + - initialVersionLessThan: !current_version + - result: [{!l 13}] + - result: [{!null _}] + - result: [{!l 13}] # Repeats ad infinitum + - initialVersionAtLeast: !current_version + - result: [{!l 13}] + - result: [] - # Min/max indexes need keep what amounts to a standard value index on their keys (in order to properly look up # the min/max). That index should be usable for normal queries just like a value index. Note that the scan is @@ -148,16 +161,42 @@ test_block: - result: [{!l 5}, {!l 4}, {!l 3}, {!l 2}, {!l 1}] - - query: select min(col3) from T2 group by col1, col2; + - supported_version: !current_version - explain: "ISCAN(MV2 <,>) | MAP (_ AS _0) | AGG (min_l(_._0.COL3) AS _0) GROUP BY (_._0.COL1 AS _0, _._0.COL2 AS _1) | MAP (_._1._0 AS _0)" - # 4.1 Triage: failed when running with forced continuations (result mismatch) - # - result: [{!l 1}, {!l 2}, {!l 3}] + - result: [{!l 1}, {!l 2}, {!l 3}] + - + - query: select min(col3) from T2 group by col1, col2; + # Cannot use FORCE_CONTINUATIONS with older versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + # (Extra values being produced after exhausting source of an aggregate cursor) + # Can remove once we do not care about backwards compatibility before !current_version + - maxRows: 1 + - initialVersionLessThan: !current_version + - initialVersionAtLeast: !current_version + - result: [{!l 1}] + - result: [{!l 2}] + - result: [{!l 3}] + - result: [] - # this should use the aggregate index in the future, for now, it is using streaming aggregate # over base table scan. - query: select max(col2) from t2; + - supported_version: !current_version - explain: "ISCAN(MV3 <,>) | MAP (_ AS _0) | AGG (max_l(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - # 4.1 Triage: failed when running with forced continuations (result mismatch) - # - result: [{!l 2}] + - result: [{!l 2}] + - + - query: select max(col2) from t2; + # Cannot use FORCE_CONTINUATIONS with older versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + # (Extra values being produced after exhausting source of an aggregate cursor) + # Can remove once we do not care about backwards compatibility before !current_version + - supported_version: !current_version + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 2}] + - result: [{!null _}] + - result: [{!l 2}] # ad infinitum + - initialVersionAtLeast: !current_version + - result: [{!l 2}] + - result: [] - - query: select col1, sum(col2) from T1 USE INDEX (vi1) group by col1; - explain: "ISCAN(VI1 <,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._0._0 AS COL1, _._1._0 AS _1)" @@ -211,14 +250,28 @@ test_block: - # Permuted max index can also be used to evaluate other aggregate functions via aggregation and roll-up - query: select col3, sum(col2) as s from t2 use index (mv9) where col1 = 1 group by col1, col3 order by col3 asc; + - supported_version: !current_version - explain: "ISCAN(MV9 [EQUALS promote(@c20 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0, _._0.COL3 AS _1) | MAP (_._0._1 AS COL3, _._1._0 AS S)" - # 4.1 Triage: failed when running with forced continuations (result mismatch) - # - result: [{COL3: 1, S: 1}, {COL3: 2, S: 2}, {COL3: 100, S: 1}, {COL3: 200, S: 2}] + - result: [{COL3: 1, S: 1}, {COL3: 2, S: 2}, {COL3: 100, S: 1}, {COL3: 200, S: 2}] + - + - query: select col3, sum(col2) as s from t2 use index (mv9) where col1 = 1 group by col1, col3 order by col3 asc; + # Cannot use FORCE_CONTINUATIONS with older versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + # (Extra values being produced after exhausting source of an aggregate cursor) + # Can remove once we do not care about backwards compatibility before !current_version + - maxRows: 0 + - result: [{COL3: 1, S: 1}, {COL3: 2, S: 2}, {COL3: 100, S: 1}, {COL3: 200, S: 2}] - - query: select col3, sum(col2) as s from t2 use index (mv9) where col1 = 1 group by col1, col3 order by col3 desc; + - supported_version: !current_version - explain: "ISCAN(MV9 [EQUALS promote(@c20 AS LONG)] REVERSE) | MAP (_ AS _0) | AGG (sum_l(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0, _._0.COL3 AS _1) | MAP (_._0._1 AS COL3, _._1._0 AS S)" - # 4.1 Triage: failed when running with forced continuations (result mismatch) - # - result: [{COL3: 200, S: 2}, {COL3: 100, S: 1}, {COL3: 2, S: 2}, {COL3: 1, S: 1}] + - result: [{COL3: 200, S: 2}, {COL3: 100, S: 1}, {COL3: 2, S: 2}, {COL3: 1, S: 1}] + - + - query: select col3, sum(col2) as s from t2 use index (mv9) where col1 = 1 group by col1, col3 order by col3 desc; + # Cannot use FORCE_CONTINUATIONS with older versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + # (Extra values being produced after exhausting source of an aggregate cursor) + # Can remove once we do not care about backwards compatibility before !current_version + - maxRows: 0 + - result: [{COL3: 200, S: 2}, {COL3: 100, S: 1}, {COL3: 2, S: 2}, {COL3: 1, S: 1}] # - # # grouping by constant is not yet supported. # - query: select sum(col2) from t1 group by 3,2,1; @@ -233,10 +286,12 @@ test_block: - - query: select max_ever(col3) from T2 group by col1, col2; - result: [{!l 100}, {!l 200}, {!l 400}] - # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select min_ever(col3) from t2 - # - result: [{!l 1}] + - + - query: select min_ever(col3) from t2 + # Cannot enable FORCE_CONTINUATIONS with ungrouped aggregate scan because of: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - explain: "AISCAN(MV7 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" + - result: [{!l 1}] - - query: select min_ever(col3) from t2 - explain: "AISCAN(MV7 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" From d84afe16e882c4b08974c1c38969c7e7db4f0e4b Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Fri, 28 Feb 2025 16:29:28 +0000 Subject: [PATCH 32/62] Fix continuation deserialization errors by deserializing streaming aggregate plans in the correct order The error we were seeing was that for certain plans, we were getting errors trying to deserialize the elements of a `FDBStreamingAggregatePlan` continuation. In particular, we were seeing the type's reference before the type's definition. This was because the serialization and deserialization of the plan happened in different orders, which meant that at deserialization time, we were no longer guaranteed to come across the definition first. I've kept the order of serialization the same, and then updated the deserialization code path to align it with existing continuations that are out in the wild. This fixes #3214. I've enabled FORCE_CONTINUATIONS mode on that test, though it mostly just works on the embedded vs. current configuration (which is enough to surface the bug). More test coverage is added by having the `StreamingAggregate` plans in one of the Record Layer tests all go through `verifySerialization`, which previously wasn't being done on those plans. --- .../RecordQueryStreamingAggregationPlan.java | 23 ++++---- .../query/FDBStreamAggregationTest.java | 3 +- .../yamltests/YamlTestExtension.java | 2 +- .../aggregate-index-tests-count.yamsql | 52 ++++++++++++++----- 4 files changed, 56 insertions(+), 24 deletions(-) diff --git a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryStreamingAggregationPlan.java b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryStreamingAggregationPlan.java index 109b7380de..17772363f0 100644 --- a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryStreamingAggregationPlan.java +++ b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryStreamingAggregationPlan.java @@ -35,7 +35,6 @@ import com.apple.foundationdb.record.provider.common.StoreTimer; import com.apple.foundationdb.record.provider.foundationdb.FDBRecordStoreBase; import com.apple.foundationdb.record.provider.foundationdb.FDBStoreTimer; -import com.apple.foundationdb.record.query.plan.explain.ExplainPlanVisitor; import com.apple.foundationdb.record.query.plan.cascades.AliasMap; import com.apple.foundationdb.record.query.plan.cascades.CorrelationIdentifier; import com.apple.foundationdb.record.query.plan.cascades.Quantifier; @@ -50,6 +49,7 @@ import com.apple.foundationdb.record.query.plan.cascades.values.ObjectValue; import com.apple.foundationdb.record.query.plan.cascades.values.Value; import com.apple.foundationdb.record.query.plan.cascades.values.translation.TranslationMap; +import com.apple.foundationdb.record.query.plan.explain.ExplainPlanVisitor; import com.apple.foundationdb.record.query.plan.serialization.PlanSerialization; import com.google.auto.service.AutoService; import com.google.common.collect.ImmutableList; @@ -385,15 +385,18 @@ public PRecordQueryPlan toRecordQueryPlanProto(@Nonnull final PlanSerializationC @Nonnull public static RecordQueryStreamingAggregationPlan fromProto(@Nonnull final PlanSerializationContext serializationContext, @Nonnull final PRecordQueryStreamingAggregationPlan recordQueryStreamingAggregationPlanProto) { - return new RecordQueryStreamingAggregationPlan(Quantifier.Physical.fromProto(serializationContext, Objects.requireNonNull(recordQueryStreamingAggregationPlanProto.getInner())), - PlanSerialization.getFieldOrNull(recordQueryStreamingAggregationPlanProto, - PRecordQueryStreamingAggregationPlan::hasGroupingKeyValue, - m -> Value.fromValueProto(serializationContext, m.getGroupingKeyValue())), - (AggregateValue)Value.fromValueProto(serializationContext, Objects.requireNonNull(recordQueryStreamingAggregationPlanProto.getAggregateValue())), - CorrelationIdentifier.of(Objects.requireNonNull(recordQueryStreamingAggregationPlanProto.getGroupingKeyAlias())), - CorrelationIdentifier.of(Objects.requireNonNull(recordQueryStreamingAggregationPlanProto.getAggregateAlias())), - Value.fromValueProto(serializationContext, Objects.requireNonNull(recordQueryStreamingAggregationPlanProto.getCompleteResultValue())), - recordQueryStreamingAggregationPlanProto.hasIsCreateDefaultOnEmpty() ? recordQueryStreamingAggregationPlanProto.getIsCreateDefaultOnEmpty() : true); + // Note: it is important for proper deserialization (at least of things that interact with the serializationContext's cache of + // referenced values and plans) that we deserialize the values in the same order as they are serialized, or we may + // not + final Quantifier.Physical inner = Quantifier.Physical.fromProto(serializationContext, Objects.requireNonNull(recordQueryStreamingAggregationPlanProto.getInner())); + final AggregateValue aggregateValue = (AggregateValue) Value.fromValueProto(serializationContext, Objects.requireNonNull(recordQueryStreamingAggregationPlanProto.getAggregateValue())); + @Nullable final Value groupingKeyValue = PlanSerialization.getFieldOrNull(recordQueryStreamingAggregationPlanProto, PRecordQueryStreamingAggregationPlan::hasGroupingKeyValue, + m -> Value.fromValueProto(serializationContext, m.getGroupingKeyValue())); + final CorrelationIdentifier groupingKeyAlias = CorrelationIdentifier.of(Objects.requireNonNull(recordQueryStreamingAggregationPlanProto.getGroupingKeyAlias())); + final CorrelationIdentifier aggregateAlias = CorrelationIdentifier.of(Objects.requireNonNull(recordQueryStreamingAggregationPlanProto.getAggregateAlias())); + final Value completeResultValue = Value.fromValueProto(serializationContext, Objects.requireNonNull(recordQueryStreamingAggregationPlanProto.getCompleteResultValue())); + final boolean isCreateDefaultOnEmpty = recordQueryStreamingAggregationPlanProto.hasIsCreateDefaultOnEmpty() ? recordQueryStreamingAggregationPlanProto.getIsCreateDefaultOnEmpty() : true; + return new RecordQueryStreamingAggregationPlan(inner, groupingKeyValue, aggregateValue, groupingKeyAlias, aggregateAlias, completeResultValue, isCreateDefaultOnEmpty); } @Nonnull diff --git a/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/query/FDBStreamAggregationTest.java b/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/query/FDBStreamAggregationTest.java index 42e4105005..04d495c2b5 100644 --- a/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/query/FDBStreamAggregationTest.java +++ b/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/query/FDBStreamAggregationTest.java @@ -334,7 +334,8 @@ private void populateDB(final int numRecords) throws Exception { } @Nonnull - private RecordCursor executePlan(final RecordQueryPlan plan, final int rowLimit, final byte[] continuation) { + private RecordCursor executePlan(final RecordQueryPlan originalPlan, final int rowLimit, final byte[] continuation) { + final RecordQueryPlan plan = verifySerialization(originalPlan); final var types = plan.getDynamicTypes(); final var typeRepository = TypeRepository.newBuilder().addAllTypes(types).build(); ExecuteProperties executeProperties = ExecuteProperties.SERIAL_EXECUTE; diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlTestExtension.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlTestExtension.java index 1a6970b132..ca04177308 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlTestExtension.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlTestExtension.java @@ -67,7 +67,7 @@ public class YamlTestExtension implements TestTemplateInvocationContextProvider, @Override public void beforeAll(final ExtensionContext context) throws Exception { if (Boolean.parseBoolean(System.getProperty("tests.runQuick", "false"))) { - testConfigs = List.of(new EmbeddedConfig()); + testConfigs = List.of(new ForceContinuations(new EmbeddedConfig())); maintainConfigs = List.of(); } else { AtomicInteger serverPort = new AtomicInteger(1111); diff --git a/yaml-tests/src/test/resources/aggregate-index-tests-count.yamsql b/yaml-tests/src/test/resources/aggregate-index-tests-count.yamsql index 092607cf73..1a831e22b5 100644 --- a/yaml-tests/src/test/resources/aggregate-index-tests-count.yamsql +++ b/yaml-tests/src/test/resources/aggregate-index-tests-count.yamsql @@ -47,8 +47,9 @@ test_block: - - query: select count(*) from t1 - explain: "AISCAN(MV1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) - # - result: [{4}] + # Cannot run with FORCE_CONTINUATIONS due to: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{4}] - - query: select count(*) from t1 group by col2 - explain: "AISCAN(MV2 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" @@ -56,8 +57,9 @@ test_block: - - query: select count(col1) from t1 - explain: "AISCAN(MV3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) - # - result: [{2}] + # Cannot run with FORCE_CONTINUATIONS due to: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{2}] - - query: select count(col1) from t1 group by col2 - explain: "AISCAN(MV4 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)" @@ -83,21 +85,47 @@ test_block: - - query: select count(*) from t2 - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) - # - result: [{4}] + # Cannot run with FORCE_CONTINUATIONS due to: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{4}] - - query: select count(*) from t2 group by col2 + # Plan deserialization previously failed : https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - supported_version: !current_version - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)" - # 4.1 Triage: failed when running with forced continuations (Server-side exception) - # - result: [{1}, {3}] + - result: [{1}, {3}] + - + # Same as above test, but tests serialization upgrades from before !current_version. Can be removed once we no longer + # care about upgrading to that version from older versions + - query: select count(*) from t2 group by col2 + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{1}] + - result: [{2}] # Off by one due to: https://github.com/FoundationDB/fdb-record-layer/issues/3097 (also fixed in !current_version) + - error: 'XX000' # plan fails to deserialize on older server + - initialVersionAtLeast: !current_version + # Covered in above test case - - query: select count(col1) from t2 - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - # 4.1 Triage: failed when running with forced continuations (Received continuation shouldn't be at beginning) - # - result: [{2}] + # Cannot run with FORCE_CONTINUATIONS due to: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - maxRows: 0 + - result: [{2}] - - query: select count(col1) from t2 group by col2 + # Plan deserialization previously failed : https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - supported_version: !current_version - explain: "ISCAN(MV5 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)" - # 4.1 Triage: failed when running with forced continuations (server-side error) - # - result: [{1}, {1}] + - result: [{1}, {1}] + - + # Same as above test, but tests serialization upgrades from before !current_version. Can be removed once we no longer + # care about upgrading to that version from older versions + - query: select count(col1) from t2 group by col2 + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{1}] + - result: [{1}] + - error: 'XX000' # plan fails to deserialize on older server + - initialVersionAtLeast: !current_version + # Covered in above test case ... From 0e043b43ebb9870b967825fb1a4e1952501b78a6 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Fri, 28 Feb 2025 18:01:50 +0000 Subject: [PATCH 33/62] fix up groupby-tests.yamsql which were mostly failing with verify exceptions fixed in #3215 --- .../src/test/resources/groupby-tests.yamsql | 215 +++++++++++++----- 1 file changed, 163 insertions(+), 52 deletions(-) diff --git a/yaml-tests/src/test/resources/groupby-tests.yamsql b/yaml-tests/src/test/resources/groupby-tests.yamsql index 049a759d36..8f9ee0d935 100644 --- a/yaml-tests/src/test/resources/groupby-tests.yamsql +++ b/yaml-tests/src/test/resources/groupby-tests.yamsql @@ -57,21 +57,54 @@ setup: test_block: name: group-by-tests tests: - # 4.1 Triage: Test failed when run with forced continuations (used by: com.google.common.base.VerifyException) - # - - # - query: select max(q.s) from nested group by r.v.z having r.v.z > 120 - # - result: [{330}] - # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) - # - - # - query: select max(q.s) from nested group by r.v.z as GRP having GRP > 120 - # - result: [{330}] + - + - query: select max(q.s) from nested group by r.v.z having r.v.z > 120 + # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - supported_version: !current_version + - result: [{330}] + - + # Same as test above, but allows for testing upgrading continuations from before !current_version + # Can be removed when we no longer care about that mixed-mode path + - query: select max(q.s) from nested group by r.v.z having r.v.z > 120 + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{330}] + - result: [] + - initialVersionAtLeast: !current_version + # Handled in prior test case - - query: select max(id) from t1 group by col1 having min(id) > 0 and col1 = 20; + # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - supported_version: !current_version + - result: [{13}] + - + # Same as test above, but allows for testing upgrading continuations from before !current_version + # Can be removed when we no longer care about that mixed-mode path + - query: select max(id) from t1 group by col1 having min(id) > 0 and col1 = 20; + # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{13}] + - result: [] + - initialVersionAtLeast: !current_version + # Handled in prior test case + - + - query: select max(id) from t1 group by col1 + # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - supported_version: !current_version + - result: [{5}, {13}] + - + # Same as test above, but allows for testing upgrading continuations from before !current_version + # Can be removed when we no longer care about that mixed-mode path + - query: select max(id) from t1 group by col1 + # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{5}] - result: [{13}] - # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) - # - - # - query: select max(id) from t1 group by col1 - # - result: [{5}, {13}] + - error: 'XX000' + - initialVersionAtLeast: !current_version + # Handled in prior test case # - # # grouping by constant is not yet supported. # - query: select sum(col2) from T1 group by 3; @@ -122,42 +155,106 @@ test_block: - - query: select col1 from (select col1 from t1) as x group by x.col1; - result: [{!l 10}, {!l 20}] - # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) - # - - # - query: select MAX(x.col1) from (select col1 from t1) as x group by x.col1; - # - result: [{!l 10}, {!l 20}] - # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) - # - - # - query: select MAX(z) from (select col1 from t1) as x group by x.col1 as z; - # - result: [{!l 10}, {!l 20}] - # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) - # - - # - query: select MAX(x.col2) from (select col1,col2 from t1) as x group by x.col1; - # - result: [{!l 5}, {!l 13}] - # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) - # - - # - query: select MIN(x.col2) from (select col1,col2 from t1) as x group by x.col1; - # - result: [{!l 1}, {!l 6}] - # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) - # - - # - query: select COUNT(x.col2) from (select col1,col2 from t1) as x group by x.col1; - # - result: [{!l 5}, {!l 8}] + - + - query: select MAX(x.col1) from (select col1 from t1) as x group by x.col1; + # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - supported_version: !current_version + - result: [{!l 10}, {!l 20}] + - + # Same as test above, but allows for testing upgrading continuations from before !current_version + # Can be removed when we no longer care about that mixed-mode path + - query: select MAX(x.col1) from (select col1 from t1) as x group by x.col1; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 10}] + - result: [{!l 20}] + - error: 'XX000' + - initialVersionAtLeast: !current_version + - + - query: select MAX(z) from (select col1 from t1) as x group by x.col1 as z; + # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - supported_version: !current_version + - result: [{!l 10}, {!l 20}] + - + # Same as test above, but allows for testing upgrading continuations from before !current_version + # Can be removed when we no longer care about that mixed-mode path + - query: select MAX(z) from (select col1 from t1) as x group by x.col1 as z; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 10}] + - result: [{!l 20}] + - error: 'XX000' + - initialVersionAtLeast: !current_version + - + - query: select MAX(x.col2) from (select col1,col2 from t1) as x group by x.col1; + # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - supported_version: !current_version + - result: [{!l 5}, {!l 13}] + - + # Same as test above, but allows for testing upgrading continuations from before !current_version + # Can be removed when we no longer care about that mixed-mode path + - query: select MAX(x.col2) from (select col1,col2 from t1) as x group by x.col1; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 5}] + - result: [{!l 13}] + - error: 'XX000' + - initialVersionAtLeast: !current_version + - + - query: select MIN(x.col2) from (select col1,col2 from t1) as x group by x.col1; + # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - supported_version: !current_version + - result: [{!l 1}, {!l 6}] + - + # Same as test above, but allows for testing upgrading continuations from before !current_version + # Can be removed when we no longer care about that mixed-mode path + - query: select MIN(x.col2) from (select col1,col2 from t1) as x group by x.col1; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 1}] + - result: [{!l 7}] # Off by one from https://github.com/FoundationDB/fdb-record-layer/issues/3097 also fixed in !current_version + - error: 'XX000' + - initialVersionAtLeast: !current_version + - + - query: select COUNT(x.col2) from (select col1,col2 from t1) as x group by x.col1; + # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - supported_version: !current_version + - result: [{!l 5}, {!l 8}] + - + # Same as test above, but allows for testing upgrading continuations from before !current_version + # Can be removed when we no longer care about that mixed-mode path + - query: select COUNT(x.col2) from (select col1,col2 from t1) as x group by x.col1; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 5}] + - result: [{!l 7}] # Off by one from https://github.com/FoundationDB/fdb-record-layer/issues/3097 also fixed in !current_version + - error: 'XX000' + - initialVersionAtLeast: !current_version # 4.1 Triage: [Investigate further] Test failed when run with forced continuations (Result mismatch) # [4.0.559.6, !currentVersion] returned 10.0 instead of 9.5 - - query: select AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; - - maxRows: 0 - result: [{3.0}, {9.5}] - # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) - # - - # - query: select SUM(x.col2) from (select col1,col2 from t1) as x group by x.col1; - # - result: [{!l 15}, {!l 76}] + - + - query: select SUM(x.col2) from (select col1,col2 from t1) as x group by x.col1; + # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - supported_version: !current_version + - result: [{!l 15}, {!l 76}] + - + # Same as test above, but allows for testing upgrading continuations from before !current_version + # Can be removed when we no longer care about that mixed-mode path + - query: select SUM(x.col2) from (select col1,col2 from t1) as x group by x.col1; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 15}] + - result: [{!l 70}] # Off by one from https://github.com/FoundationDB/fdb-record-layer/issues/3097 also fixed in !current_version + - error: 'XX000' + - initialVersionAtLeast: !current_version # 4.1 Triage: [Investigate further] Test failed when run with forced continuations (Result mismatch) # [4.0.559.6, !currentVersion] returned {10, 10.0} instead of {9, 9.5} - # result is correct since we don't use (not support, yet) explicit casting. - query: select SUM(x.col2) / COUNT(x.col2), AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; - - maxRows: 0 - result: [{!l 3, 3.0}, {!l 9, 9.5}] - - query: select MAX(x.col2) from (select col1 from t1) as x group by x.col1; @@ -168,22 +265,18 @@ test_block: # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - - query: select MAX(x.col2) from (select col1,col2 from t1) as x; - - maxRows: 0 - result: [{!l 13}] # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - - query: select MIN(x.col2) from (select col1,col2 from t1) as x; - - maxRows: 0 - result: [{!l 1}] # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - - query: select COUNT(x.col2) from (select col1,col2 from t1) as x; - - maxRows: 0 - result: [{!l 13}] # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - - query: select AVG(x.col2) from (select col1,col2 from t1) as x; - - maxRows: 0 - result: [{7.0}] - - query: select x.col1 + 10 from (select col1 from t1) as x group by x.col1; @@ -194,23 +287,41 @@ test_block: - - query: select x.col1 + x.col1 from (select col1, col2 from t1) as x group by x.col1; - result: [{!l 20}, {!l 40}] - # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) - # - - # - query: select G + 4 from (select MIN(x.col2) as G from (select col1,col2 from t1) as x group by x.col1) as Y where G > 5; - # - result: [{!l 10}] - # 4.1 Triage: Test failed when run with forced continuations (Caused by: com.google.common.base.VerifyException) - # - - # - query: select G + 4 from (select MIN(x.col2) as G from (select col1,col2 from t1) as x group by x.col1 as K) as Y where G > 5; - # - result: [{!l 10}] + - + - query: select G + 4 from (select MIN(x.col2) as G from (select col1,col2 from t1) as x group by x.col1) as Y where G > 5; + # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - supported_version: !current_version + - result: [{!l 10}] + - + # Same as test above, but allows for testing upgrading continuations from before !current_version + # Can be removed when we no longer care about that mixed-mode path + - query: select G + 4 from (select MIN(x.col2) as G from (select col1,col2 from t1) as x group by x.col1) as Y where G > 5; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 10}] + - result: [] + - initialVersionAtLeast: !current_version + - + - query: select G + 4 from (select MIN(x.col2) as G from (select col1,col2 from t1) as x group by x.col1 as K) as Y where G > 5; + # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - supported_version: !current_version + - result: [{!l 10}] + - + # Same as test above, but allows for testing upgrading continuations from before !current_version + # Can be removed when we no longer care about that mixed-mode path + - query: select G + 4 from (select MIN(x.col2) as G from (select col1,col2 from t1) as x group by x.col1 as K) as Y where G > 5; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 10}] + - result: [] + - initialVersionAtLeast: !current_version # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - - query: select COUNT(*) from T1; - - maxRows: 0 - result: [{!l 13}] # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - - query: select COUNT(col1) from T1; - - maxRows: 0 - result: [{!l 13}] - - query: select x from t1 group by col1 as x, col2 as x; From e55da51c937c326e2bacf336276afa9cb8c50104 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Mon, 3 Mar 2025 12:30:52 +0000 Subject: [PATCH 34/62] fix up groupby-tests.yamsql to allow for force_continuations --- .../yamltests/command/QueryExecutor.java | 2 +- .../resources/groupby-tests.metrics.binpb | 153 ++++++++++++++++++ .../test/resources/groupby-tests.metrics.yaml | 95 +++++++++++ .../src/test/resources/groupby-tests.yamsql | 152 +++++++++++++---- 4 files changed, 371 insertions(+), 31 deletions(-) create mode 100644 yaml-tests/src/test/resources/groupby-tests.metrics.binpb create mode 100644 yaml-tests/src/test/resources/groupby-tests.metrics.yaml diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java index 3d856cf12f..b35c1dfc93 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java @@ -55,7 +55,7 @@ public class QueryExecutor { private static final Logger logger = LogManager.getLogger(QueryExecutor.class); private static final int FORCED_MAX_ROWS = 1; // The maxRows number to use when we are forcing it on the test private static final int MAX_CONTINUATIONS_ALLOWED = 100; - private static final SemanticVersion STRICT_ASSERTIONS_CUTOFF = SemanticVersion.parse("4.1.4.0"); + private static final SemanticVersion STRICT_ASSERTIONS_CUTOFF = SemanticVersion.parse("4.1.9.0"); @Nonnull private final String query; diff --git a/yaml-tests/src/test/resources/groupby-tests.metrics.binpb b/yaml-tests/src/test/resources/groupby-tests.metrics.binpb new file mode 100644 index 0000000000..15d0f6a12b --- /dev/null +++ b/yaml-tests/src/test/resources/groupby-tests.metrics.binpb @@ -0,0 +1,153 @@ + +b +group-by-testsPEXPLAIN select AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; +P (08@ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) | AGG (avg_l(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q8._1._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS _0)" ]; + 2 [ label=<
Streaming Aggregate
COLLECT (avg_l(q37._0.COL2) AS _0)
GROUP BY (q37._0.COL1 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0, )" ]; + 3 [ label=<
Value Computation
MAP (q4 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL1, AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2.COL1 AS COL1, q2.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL1, )" ]; + 5 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q37> label="q37" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} + +group-by-testsmEXPLAIN select SUM(x.col2) / COUNT(x.col2), AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; +팩#P Ҽ(0ݍ8@ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) | AGG (sum_l(_._0.COL2) AS _0, count(_._0.COL2) AS _1, avg_l(_._0.COL2) AS _2) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 / _._1._1 AS _0, _._1._2 AS _1)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q8._1._0 / q8._1._1 AS _0, q8._1._2 AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, )" ]; + 2 [ label=<
Streaming Aggregate
COLLECT (sum_l(q37._0.COL2) AS _0, count(q37._0.COL2) AS _1, avg_l(q37._0.COL2) AS _2)
GROUP BY (q37._0.COL1 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0, )" ]; + 3 [ label=<
Value Computation
MAP (q4 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL1, AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2.COL1 AS COL1, q2.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL1, )" ]; + 5 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q37> label="q37" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +R +group-by-tests@EXPLAIN select MAX(x.col2) from (select col1,col2 from t1) as x; + ( 083@ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) | AGG (max_l(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q8._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q8 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (max_l(q47._0.COL2) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q4 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL1, AS _0)" ]; + 5 [ label=<
Value Computation
MAP (q2.COL1 AS COL1, q2.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL1, )" ]; + 6 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q47> label="q47" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +R +group-by-tests@EXPLAIN select MIN(x.col2) from (select col1,col2 from t1) as x; +ת ަ( 083@ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) | AGG (min_l(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q8._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q8 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (min_l(q47._0.COL2) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q4 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL1, AS _0)" ]; + 5 [ label=<
Value Computation
MAP (q2.COL1 AS COL1, q2.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL1, )" ]; + 6 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q47> label="q47" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +T +group-by-testsBEXPLAIN select COUNT(x.col2) from (select col1,col2 from t1) as x; +C 1( 083@ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q8._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q8 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count(q47._0.COL2) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q4 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL1, AS _0)" ]; + 5 [ label=<
Value Computation
MAP (q2.COL1 AS COL1, q2.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL1, )" ]; + 6 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q47> label="q47" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +R +group-by-tests@EXPLAIN select AVG(x.col2) from (select col1,col2 from t1) as x; + Ĵ( 0e83@ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) | AGG (avg_l(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q8._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS _0)" ]; + 2 [ label=<
Value Computation
$q8 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (avg_l(q47._0.COL2) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q4 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL1, AS _0)" ]; + 5 [ label=<
Value Computation
MAP (q2.COL1 AS COL1, q2.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL1, )" ]; + 6 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q47> label="q47" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +2 +group-by-tests EXPLAIN select COUNT(*) from T1; +۔Bx 1(08/@ISCAN(I1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count_star(*) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q43> label="q43" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +5 +group-by-tests#EXPLAIN select COUNT(col1) from T1; +Bx 1(08/@ISCAN(I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count(q43._0.COL1) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q43> label="q43" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} \ No newline at end of file diff --git a/yaml-tests/src/test/resources/groupby-tests.metrics.yaml b/yaml-tests/src/test/resources/groupby-tests.metrics.yaml new file mode 100644 index 0000000000..d9c9ac9a69 --- /dev/null +++ b/yaml-tests/src/test/resources/groupby-tests.metrics.yaml @@ -0,0 +1,95 @@ +group-by-tests: +- query: EXPLAIN select AVG(x.col2) from (select col1,col2 from t1) as x group by + x.col1; + explain: ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) + | AGG (avg_l(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS + _0) + task_count: 240 + task_total_time_ms: 10 + transform_count: 80 + transform_time_ms: 5 + transform_yield_count: 21 + insert_time_ms: 0 + insert_new_count: 20 + insert_reused_count: 2 +- query: EXPLAIN select SUM(x.col2) / COUNT(x.col2), AVG(x.col2) from (select col1,col2 + from t1) as x group by x.col1; + explain: ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) + | AGG (sum_l(_._0.COL2) AS _0, count(_._0.COL2) AS _1, avg_l(_._0.COL2) AS + _2) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 / _._1._1 AS _0, _._1._2 AS + _1) + task_count: 240 + task_total_time_ms: 74 + transform_count: 80 + transform_time_ms: 47 + transform_yield_count: 21 + insert_time_ms: 2 + insert_new_count: 20 + insert_reused_count: 2 +- query: EXPLAIN select MAX(x.col2) from (select col1,col2 from t1) as x; + explain: ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) + | AGG (max_l(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) + task_count: 438 + task_total_time_ms: 33 + transform_count: 134 + transform_time_ms: 13 + transform_yield_count: 32 + insert_time_ms: 3 + insert_new_count: 51 + insert_reused_count: 4 +- query: EXPLAIN select MIN(x.col2) from (select col1,col2 from t1) as x; + explain: ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) + | AGG (min_l(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) + task_count: 438 + task_total_time_ms: 51 + transform_count: 134 + transform_time_ms: 15 + transform_yield_count: 32 + insert_time_ms: 3 + insert_new_count: 51 + insert_reused_count: 4 +- query: EXPLAIN select COUNT(x.col2) from (select col1,col2 from t1) as x; + explain: ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) + | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, + promote(0l AS LONG)) AS _0) + task_count: 438 + task_total_time_ms: 142 + transform_count: 134 + transform_time_ms: 104 + transform_yield_count: 32 + insert_time_ms: 7 + insert_new_count: 51 + insert_reused_count: 4 +- query: EXPLAIN select AVG(x.col2) from (select col1,col2 from t1) as x; + explain: ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) + | AGG (avg_l(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) + task_count: 438 + task_total_time_ms: 17 + transform_count: 134 + transform_time_ms: 7 + transform_yield_count: 32 + insert_time_ms: 1 + insert_new_count: 51 + insert_reused_count: 4 +- query: EXPLAIN select COUNT(*) from T1; + explain: ISCAN(I1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY + NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) + task_count: 396 + task_total_time_ms: 138 + transform_count: 120 + transform_time_ms: 104 + transform_yield_count: 30 + insert_time_ms: 8 + insert_new_count: 47 + insert_reused_count: 4 +- query: EXPLAIN select COUNT(col1) from T1; + explain: ISCAN(I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) | ON EMPTY + NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) + task_count: 396 + task_total_time_ms: 138 + transform_count: 120 + transform_time_ms: 103 + transform_yield_count: 30 + insert_time_ms: 10 + insert_new_count: 47 + insert_reused_count: 4 diff --git a/yaml-tests/src/test/resources/groupby-tests.yamsql b/yaml-tests/src/test/resources/groupby-tests.yamsql index 8f9ee0d935..dc9a32aea0 100644 --- a/yaml-tests/src/test/resources/groupby-tests.yamsql +++ b/yaml-tests/src/test/resources/groupby-tests.yamsql @@ -63,8 +63,7 @@ test_block: - supported_version: !current_version - result: [{330}] - - # Same as test above, but allows for testing upgrading continuations from before !current_version - # Can be removed when we no longer care about that mixed-mode path + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version - query: select max(q.s) from nested group by r.v.z having r.v.z > 120 - maxRows: 1 - initialVersionLessThan: !current_version @@ -78,8 +77,7 @@ test_block: - supported_version: !current_version - result: [{13}] - - # Same as test above, but allows for testing upgrading continuations from before !current_version - # Can be removed when we no longer care about that mixed-mode path + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version - query: select max(id) from t1 group by col1 having min(id) > 0 and col1 = 20; # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 - maxRows: 1 @@ -94,8 +92,7 @@ test_block: - supported_version: !current_version - result: [{5}, {13}] - - # Same as test above, but allows for testing upgrading continuations from before !current_version - # Can be removed when we no longer care about that mixed-mode path + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version - query: select max(id) from t1 group by col1 # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 - maxRows: 1 @@ -161,8 +158,7 @@ test_block: - supported_version: !current_version - result: [{!l 10}, {!l 20}] - - # Same as test above, but allows for testing upgrading continuations from before !current_version - # Can be removed when we no longer care about that mixed-mode path + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version - query: select MAX(x.col1) from (select col1 from t1) as x group by x.col1; - maxRows: 1 - initialVersionLessThan: !current_version @@ -176,8 +172,7 @@ test_block: - supported_version: !current_version - result: [{!l 10}, {!l 20}] - - # Same as test above, but allows for testing upgrading continuations from before !current_version - # Can be removed when we no longer care about that mixed-mode path + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version - query: select MAX(z) from (select col1 from t1) as x group by x.col1 as z; - maxRows: 1 - initialVersionLessThan: !current_version @@ -191,8 +186,7 @@ test_block: - supported_version: !current_version - result: [{!l 5}, {!l 13}] - - # Same as test above, but allows for testing upgrading continuations from before !current_version - # Can be removed when we no longer care about that mixed-mode path + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version - query: select MAX(x.col2) from (select col1,col2 from t1) as x group by x.col1; - maxRows: 1 - initialVersionLessThan: !current_version @@ -206,8 +200,7 @@ test_block: - supported_version: !current_version - result: [{!l 1}, {!l 6}] - - # Same as test above, but allows for testing upgrading continuations from before !current_version - # Can be removed when we no longer care about that mixed-mode path + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version - query: select MIN(x.col2) from (select col1,col2 from t1) as x group by x.col1; - maxRows: 1 - initialVersionLessThan: !current_version @@ -221,8 +214,7 @@ test_block: - supported_version: !current_version - result: [{!l 5}, {!l 8}] - - # Same as test above, but allows for testing upgrading continuations from before !current_version - # Can be removed when we no longer care about that mixed-mode path + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version - query: select COUNT(x.col2) from (select col1,col2 from t1) as x group by x.col1; - maxRows: 1 - initialVersionLessThan: !current_version @@ -230,11 +222,23 @@ test_block: - result: [{!l 7}] # Off by one from https://github.com/FoundationDB/fdb-record-layer/issues/3097 also fixed in !current_version - error: 'XX000' - initialVersionAtLeast: !current_version - # 4.1 Triage: [Investigate further] Test failed when run with forced continuations (Result mismatch) - # [4.0.559.6, !currentVersion] returned 10.0 instead of 9.5 - - query: select AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; + - explain: "ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) | AGG (avg_l(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)" + - maxRows: 0 # Disable force_continuations. Can be removed when we longer care about testing with versions older than !current_version - result: [{3.0}, {9.5}] + - + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version + - query: select AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{3.0}] + - result: [{10.0}] # Incorrect value because of off-by-one: https://github.com/FoundationDB/fdb-record-layer/issues/3097 + - result: [] + - initialVersionAtLeast: !current_version + - result: [{3.0}] + - result: [{9.5}] + - result: [] - - query: select SUM(x.col2) from (select col1,col2 from t1) as x group by x.col1; # Plans did not serialize before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3214 @@ -243,6 +247,7 @@ test_block: - # Same as test above, but allows for testing upgrading continuations from before !current_version # Can be removed when we no longer care about that mixed-mode path + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version - query: select SUM(x.col2) from (select col1,col2 from t1) as x group by x.col1; - maxRows: 1 - initialVersionLessThan: !current_version @@ -250,34 +255,97 @@ test_block: - result: [{!l 70}] # Off by one from https://github.com/FoundationDB/fdb-record-layer/issues/3097 also fixed in !current_version - error: 'XX000' - initialVersionAtLeast: !current_version - # 4.1 Triage: [Investigate further] Test failed when run with forced continuations (Result mismatch) - # [4.0.559.6, !currentVersion] returned {10, 10.0} instead of {9, 9.5} - # result is correct since we don't use (not support, yet) explicit casting. - query: select SUM(x.col2) / COUNT(x.col2), AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; + - explain: "ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) | AGG (sum_l(_._0.COL2) AS _0, count(_._0.COL2) AS _1, avg_l(_._0.COL2) AS _2) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 / _._1._1 AS _0, _._1._2 AS _1)" + - maxRows: 0 # Disable force_continuations. Can be removed when we longer care about testing with versions older than !current_version - result: [{!l 3, 3.0}, {!l 9, 9.5}] + - + # Duplicate of above but with simulation of force_continuations mode. Can be removed after we no longer + # care about mixed-mode testing with versions before !current_version + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version + - query: select SUM(x.col2) / COUNT(x.col2), AVG(x.col2) from (select col1,col2 from t1) as x group by x.col1; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 3, 3.0}] + - result: [{!l 10, 10.0}] # Incorrect value due to off-by-one: https://github.com/FoundationDB/fdb-record-layer/issues/3097 + - result: [] + - initialVersionAtLeast: !current_version + - result: [{!l 3, 3.0}] + - result: [{!l 9, 9.5}] + - result: [] - - query: select MAX(x.col2) from (select col1 from t1) as x group by x.col1; - error: "42703" - - query: select X.col2 from (select col1, col2 from t1) as x group by x.col1; - error: "42803" - # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - - query: select MAX(x.col2) from (select col1,col2 from t1) as x; + - explain: "ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) | AGG (max_l(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" + - maxRows: 0 # Disable force_continuations. Can be removed when we longer care about testing with versions older than !current_version + - result: [{!l 13}] + - + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version + - query: select MAX(x.col2) from (select col1,col2 from t1) as x; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 13}] + - result: [{!null _}] + - result: [{!l 13}] # ad infinitum. Due to incorrect continuation serialization identified in: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + - initialVersionAtLeast: !current_version - result: [{!l 13}] - # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + - result: [] + - + - query: select MIN(x.col2) from (select col1,col2 from t1) as x; + - explain: "ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) | AGG (min_l(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" + - maxRows: 0 # Disable force_continuations. Can be removed when we longer care about testing with versions older than !current_version + - result: [{!l 1}] - + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version - query: select MIN(x.col2) from (select col1,col2 from t1) as x; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 1}] + - result: [{!null _}] + - result: [{!l 1}] # ad infinitum. Due to incorrect continuation serialization identified in: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + - initialVersionAtLeast: !current_version - result: [{!l 1}] - # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) + - result: [] - - query: select COUNT(x.col2) from (select col1,col2 from t1) as x; + - explain: "ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - maxRows: 0 # Disable force_continuations. Can be removed when we longer care about testing with versions older than !current_version - result: [{!l 13}] - # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version + - query: select COUNT(x.col2) from (select col1,col2 from t1) as x; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 13}] + - result: [{!l 0}] + - result: [{!l 13}] # ad infinitum. Due to incorrect continuation serialization identified in: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + - initialVersionAtLeast: !current_version + - result: [{!l 13}] + - result: [] + - + - query: select AVG(x.col2) from (select col1,col2 from t1) as x; + - explain: "ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) | AGG (avg_l(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" + - maxRows: 0 # Disable force_continuations. Can be removed when we longer care about testing with versions older than !current_version + - result: [{7.0}] + - + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version - query: select AVG(x.col2) from (select col1,col2 from t1) as x; + - explain: "ISCAN(I1 <,>) | MAP (_.COL1 AS COL1, _.COL2 AS COL2) | MAP (_ AS _0) | AGG (avg_l(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" + - maxRows: 1 + - initialVersionLessThan: !current_version - result: [{7.0}] + - result: [{!null _}] + - result: [{7.0}] # ad infinitum. Due to incorrect continuation serialization identified in: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + - initialVersionAtLeast: !current_version + - result: [{7.0}] + - result: [] - - query: select x.col1 + 10 from (select col1 from t1) as x group by x.col1; - result: [{!l 20}, {!l 30}] @@ -293,8 +361,7 @@ test_block: - supported_version: !current_version - result: [{!l 10}] - - # Same as test above, but allows for testing upgrading continuations from before !current_version - # Can be removed when we no longer care about that mixed-mode path + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version - query: select G + 4 from (select MIN(x.col2) as G from (select col1,col2 from t1) as x group by x.col1) as Y where G > 5; - maxRows: 1 - initialVersionLessThan: !current_version @@ -307,22 +374,47 @@ test_block: - supported_version: !current_version - result: [{!l 10}] - - # Same as test above, but allows for testing upgrading continuations from before !current_version - # Can be removed when we no longer care about that mixed-mode path + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version - query: select G + 4 from (select MIN(x.col2) as G from (select col1,col2 from t1) as x group by x.col1 as K) as Y where G > 5; - maxRows: 1 - initialVersionLessThan: !current_version - result: [{!l 10}] - result: [] - initialVersionAtLeast: !current_version - # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - - query: select COUNT(*) from T1; + - explain: "ISCAN(I1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - maxRows: 0 # Disable force_continuations. Can be removed when we longer care about testing with versions older than !current_version + - result: [{!l 13}] + - + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version + - query: select COUNT(*) from T1; + - explain: "ISCAN(I1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 13}] + - result: [{!l 0}] + - result: [{!l 13}] # ad infinitum. Due to incorrect continuation serialization identified in: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + - initialVersionAtLeast: !current_version + - result: [{!l 13}] + - result: [] + - + - query: select COUNT(col1) from T1; + - explain: "ISCAN(I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - maxRows: 0 # Disable force_continuations. Can be removed when we longer care about testing with versions older than !current_version - result: [{!l 13}] - # 4.1 Triage: [Deferred: Client checks for End] Test failed when run with forced continuations (Received continuation shouldn't be at beginning) - + # Same as above but simulates force_continuations mode. Can be removed after we no longer care about compatibility with versions before !current_version - query: select COUNT(col1) from T1; + - explain: "ISCAN(I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - maxRows: 1 + - initialVersionLessThan: !current_version - result: [{!l 13}] + - result: [{!l 0}] + - result: [{!l 13}] # ad infinitum. Due to incorrect continuation serialization identified in: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + - initialVersionAtLeast: !current_version + - result: [{!l 13}] + - result: [] - - query: select x from t1 group by col1 as x, col2 as x; - error: "42702" From c37b95a99ed66227fd7834a7e7bb205272f44858 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Mon, 3 Mar 2025 13:03:47 +0000 Subject: [PATCH 35/62] fix up boolean.yamsql to enable force_continuations on most queries --- yaml-tests/src/test/resources/boolean.yamsql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/yaml-tests/src/test/resources/boolean.yamsql b/yaml-tests/src/test/resources/boolean.yamsql index 0ff8f1e2d4..96cfaf4710 100644 --- a/yaml-tests/src/test/resources/boolean.yamsql +++ b/yaml-tests/src/test/resources/boolean.yamsql @@ -94,20 +94,20 @@ test_block: - - query: select B AND FALSE from lb - result: [ { false }, { false }, { false } ] - # 4.1 Triage: [Deferred: literal null issue] failing when running with forced continuations (cannot continue query due to mismatch between serialized and actual plan hash) - # - - # - query: select B AND NULL from lb - # - result: [ { !null }, { false }, { !null } ] + - + - query: select B AND NULL from lb + - maxRows: 0 # Disable force_continuations because of plan hash instability. See: https://github.com/FoundationDB/fdb-record-layer/issues/3218 + - result: [ { !null }, { false }, { !null } ] - - query: select B OR TRUE from lb - result: [ { true }, { true }, { true } ] - - query: select B OR FALSE from lb - result: [ { true }, { false }, { !null } ] - # 4.1 Triage: [Deferred: literal null issue] failing when running with forced continuations (cannot continue query due to mismatch between serialized and actual plan hash) - # - - # - query: select B OR NULL from lb - # - result: [ { true }, { !null }, { !null } ] + - + - query: select B OR NULL from lb + - maxRows: 0 # Disable force_continuations because of plan hash instability. See: https://github.com/FoundationDB/fdb-record-layer/issues/3218 + - result: [ { true }, { !null }, { !null } ] - - query: select NOT B from lb - result: [ { false }, { true }, { !null } ] From 3848f0a771c4547b0ff60055e94f7ef12656f5fa Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Mon, 3 Mar 2025 16:56:25 +0000 Subject: [PATCH 36/62] `EXISTS` queries now honor continuation from previous runs to avoid infinite loops The `RecordQueryFirstOrDefaultPlan` constructs a special cursor which has cardinality at most one. The continuation it returns back to the user is not based on the inner cursor but only on whether the cursor has returned any data. Previously, we were taking the `FutureCursor`'s continuation (which is always `\x00`) and giving it back to the `inner` plan, which would generally result in the plan resuming from the beginning. That is not the appropriate way to interpret the continuation, so this updates the logic to instead skip creating the inner cursor if we get a non-beginning continuation, which is in line with what the `FutureCursor`'s continuation means. This fixes #3219. --- .../plans/RecordQueryFirstOrDefaultPlan.java | 17 +++-- .../src/test/resources/join-tests.yamsql | 32 +++++++-- .../resources/select-a-star.metrics.binpb | 67 +++++++++++++++++++ .../test/resources/select-a-star.metrics.yaml | 41 ++++++++++++ .../src/test/resources/select-a-star.yamsql | 54 +++++++++++++-- 5 files changed, 197 insertions(+), 14 deletions(-) create mode 100644 yaml-tests/src/test/resources/select-a-star.metrics.binpb create mode 100644 yaml-tests/src/test/resources/select-a-star.metrics.yaml diff --git a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryFirstOrDefaultPlan.java b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryFirstOrDefaultPlan.java index 2ca4593b5c..4883c9e1bf 100644 --- a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryFirstOrDefaultPlan.java +++ b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryFirstOrDefaultPlan.java @@ -96,10 +96,19 @@ public RecordCursor executePlan(@Nonnull final @Nonnull final EvaluationContext context, @Nullable final byte[] continuation, @Nonnull final ExecuteProperties executeProperties) { - return new FutureCursor<>(store.getExecutor(), - getChild().executePlan(store, context, continuation, executeProperties).first() - .thenApply(resultOptional -> - resultOptional.orElseGet(() -> QueryResult.ofComputed(onEmptyResultValue.eval(store, context))))); + if (continuation == null) { + return new FutureCursor<>(store.getExecutor(), + getChild().executePlan(store, context, null, executeProperties).first() + .thenApply(resultOptional -> + resultOptional.orElseGet(() -> QueryResult.ofComputed(onEmptyResultValue.eval(store, context))))); + } else { + // The FutureCursor only ever returns a single continuation, indicating that the future + // has been completed. So, if we get a non-null continuation back, that means we've already + // completed the work done and returned something, so send an empty cursor back. + // Note that this doesn't handle out-of-band cursor no-next-reasons + // See: https://github.com/FoundationDB/fdb-record-layer/issues/3220 + return RecordCursor.empty(store.getExecutor()); + } } @Override diff --git a/yaml-tests/src/test/resources/join-tests.yamsql b/yaml-tests/src/test/resources/join-tests.yamsql index d497c76851..da7f11d736 100644 --- a/yaml-tests/src/test/resources/join-tests.yamsql +++ b/yaml-tests/src/test/resources/join-tests.yamsql @@ -67,20 +67,44 @@ test_block: - # Get names of people working on a project - query: select fname, lname from emp where exists (select * from project where emp_id = emp.id); - # 4.1 Triage: [Investigate further: Exists subquery] This runs into infinite loop - - maxRows: 0 + - supported_version: !current_version - unorderedResult: [{"Emily", "Martinez"}, {"Daniel", "Miller"}, {"Megan", "Miller"}] + - + # Version of above query to simulate force_continuations with older versions. + # Can remove once we do not care about cross-version compatibility before !current_version + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3219 + - query: select fname, lname from emp where exists (select * from project where emp_id = emp.id); + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{"Emily", "Martinez"}] + - result: [{"Daniel", "Miller"}] + - result: [{"Daniel", "Miller"}] + - result: [{"Megan", "Miller"}] + - result: [{"Megan", "Miller"}] + - result: [] + - initialVersionAtLeast: !current_version - # Get names of people working on a project in Sales department - query: select fname, lname from (select fname, lname, dept_id from emp where exists (select * from project where emp_id = emp.id)) as sq, dept where sq.dept_id = dept.id and dept.name = 'Sales'; - # 4.1 Triage: [Investigate further: Exists subquery] This runs into infinite loop - - maxRows: 0 + - supported_version: !current_version - unorderedResult: [{"Daniel", "Miller"}] + - + # Get names of people working on a project in Sales department + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3219 + - query: select fname, lname from + (select fname, lname, dept_id from emp where exists (select * from project where emp_id = emp.id)) as sq, + dept + where sq.dept_id = dept.id and dept.name = 'Sales'; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{"Daniel", "Miller"}] + - result: [] + - initialVersionAtLeast: !current_version - # three-way join to find which departments' corresponding projects. - query: select dept.name, project.name from emp, dept, project where emp.dept_id = dept.id and project.emp_id = emp.id; diff --git a/yaml-tests/src/test/resources/select-a-star.metrics.binpb b/yaml-tests/src/test/resources/select-a-star.metrics.binpb new file mode 100644 index 0000000000..3ef2056746 --- /dev/null +++ b/yaml-tests/src/test/resources/select-a-star.metrics.binpb @@ -0,0 +1,67 @@ ++ +e +select-star-testsPEXPLAIN select B1 from B where exists (select A.*, B1 from A group by A1,A2,A3);* +5 ͞"($08&@SCAN(<,>) | TFILTER B | FLATMAP q0 -> { ISCAN(A_IDX <,>) | MAP (_ AS _0) | AGG () GROUP BY (_._0.A1 AS _0, _._0.A2 AS _1, _._0.A3 AS _2) | MAP (_._0._0 AS A1, _._0._1 AS A2, _._0._2 AS A3, q0.B1 AS B1) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN (q0.B1 AS B1) }(digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Nested Loop Join
FLATMAP (q2.B1 AS B1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS B1)" ]; + 2 [ label=<
Type Filter
WHERE record IS [B]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS B1, )" ]; + 3 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 4 [ label=<
Primary Storage
record types: [A, B]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 5 [ label=<
Predicate Filter
WHERE q14 NOT_NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A1, )" ]; + 6 [ label=<
Value Computation
FIRST $q14 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A1, )" ]; + 7 [ label=<
Value Computation
MAP (q10._0._0 AS A1, q10._0._1 AS A2, q10._0._2 AS A3, q2.B1 AS B1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A1, )" ]; + 8 [ label=<
Streaming Aggregate
COLLECT ()
GROUP BY (q48._0.A1 AS _0, q48._0.A2 AS _1, q48._0.A3 AS _2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0, )" ]; + 9 [ label=<
Value Computation
MAP (q6 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A1, AS _0)" ]; + 10 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A1, )" ]; + 11 [ label=<
Index
A_IDX
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A1, )" ]; + 3 -> 2 [ label=< q52> label="q52" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ label=< q10> label="q10" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ label=< q48> label="q48" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 11 -> 10 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 1 [ label=< q14> label="q14" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + { + rank=same; + rankDir=LR; + 2 -> 5 [ color="red" style="invis" ]; + } +}+ +g +select-star-testsREXPLAIN select B.* from B where exists (select A.*, B.* from A group by A1,A2,A3);* +  ($0F8&@SCAN(<,>) | TFILTER B | FLATMAP q0 -> { ISCAN(A_IDX <,>) | MAP (_ AS _0) | AGG () GROUP BY (_._0.A1 AS _0, _._0.A2 AS _1, _._0.A3 AS _2) | MAP (_._0._0 AS A1, _._0._1 AS A2, _._0._2 AS A3, q0.B1 AS B1, q0.B2 AS B2, q0.B3 AS B3) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN q0 }(digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Nested Loop Join
FLATMAP q2
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS B1, )" ]; + 2 [ label=<
Type Filter
WHERE record IS [B]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS B1, )" ]; + 3 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 4 [ label=<
Primary Storage
record types: [A, B]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 5 [ label=<
Predicate Filter
WHERE q14 NOT_NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A1, )" ]; + 6 [ label=<
Value Computation
FIRST $q14 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A1, )" ]; + 7 [ label=<
Value Computation
MAP (q10._0._0 AS A1, q10._0._1 AS A2, q10._0._2 AS A3, q2.B1 AS B1, q2.B2 AS B2, q2.B3 AS B3)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A1, )" ]; + 8 [ label=<
Streaming Aggregate
COLLECT ()
GROUP BY (q48._0.A1 AS _0, q48._0.A2 AS _1, q48._0.A3 AS _2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0, )" ]; + 9 [ label=<
Value Computation
MAP (q6 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A1, AS _0)" ]; + 10 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A1, )" ]; + 11 [ label=<
Index
A_IDX
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A1, )" ]; + 3 -> 2 [ label=< q52> label="q52" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ label=< q10> label="q10" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ label=< q48> label="q48" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 11 -> 10 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 1 [ label=< q14> label="q14" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + { + rank=same; + rankDir=LR; + 2 -> 5 [ color="red" style="invis" ]; + } +} \ No newline at end of file diff --git a/yaml-tests/src/test/resources/select-a-star.metrics.yaml b/yaml-tests/src/test/resources/select-a-star.metrics.yaml new file mode 100644 index 0000000000..5ea814676c --- /dev/null +++ b/yaml-tests/src/test/resources/select-a-star.metrics.yaml @@ -0,0 +1,41 @@ +select-star-tests: +- query: EXPLAIN select B1 from B where exists (select A.*, B1 from A group by A1,A2,A3); + explain: SCAN(<,>) | TFILTER B | FLATMAP q0 -> { ISCAN(A_IDX <,>) | MAP (_ AS + _0) | AGG () GROUP BY (_._0.A1 AS _0, _._0.A2 AS _1, _._0.A3 AS _2) | MAP + (_._0._0 AS A1, _._0._1 AS A2, _._0._2 AS A3, q0.B1 AS B1) | DEFAULT NULL + | FILTER _ NOT_NULL AS q0 RETURN (q0.B1 AS B1) } + task_count: 445 + task_total_time_ms: 112 + transform_count: 145 + transform_time_ms: 71 + transform_yield_count: 36 + insert_time_ms: 6 + insert_new_count: 38 + insert_reused_count: 4 +- query: EXPLAIN select B1 from B where exists (select A.*, B1 from A group by A1,A2,A3); + explain: SCAN(<,>) | TFILTER B | FLATMAP q0 -> { ISCAN(A_IDX <,>) | MAP (_ AS + _0) | AGG () GROUP BY (_._0.A1 AS _0, _._0.A2 AS _1, _._0.A3 AS _2) | MAP + (_._0._0 AS A1, _._0._1 AS A2, _._0._2 AS A3, q0.B1 AS B1) | DEFAULT NULL + | FILTER _ NOT_NULL AS q0 RETURN (q0.B1 AS B1) } + task_count: 445 + task_total_time_ms: 112 + transform_count: 145 + transform_time_ms: 71 + transform_yield_count: 36 + insert_time_ms: 6 + insert_new_count: 38 + insert_reused_count: 4 +- query: EXPLAIN select B.* from B where exists (select A.*, B.* from A group by + A1,A2,A3); + explain: SCAN(<,>) | TFILTER B | FLATMAP q0 -> { ISCAN(A_IDX <,>) | MAP (_ AS + _0) | AGG () GROUP BY (_._0.A1 AS _0, _._0.A2 AS _1, _._0.A3 AS _2) | MAP + (_._0._0 AS A1, _._0._1 AS A2, _._0._2 AS A3, q0.B1 AS B1, q0.B2 AS B2, q0.B3 + AS B3) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN q0 } + task_count: 445 + task_total_time_ms: 27 + transform_count: 145 + transform_time_ms: 11 + transform_yield_count: 36 + insert_time_ms: 1 + insert_new_count: 38 + insert_reused_count: 4 diff --git a/yaml-tests/src/test/resources/select-a-star.yamsql b/yaml-tests/src/test/resources/select-a-star.yamsql index c677b6b075..18c78413aa 100644 --- a/yaml-tests/src/test/resources/select-a-star.yamsql +++ b/yaml-tests/src/test/resources/select-a-star.yamsql @@ -40,9 +40,23 @@ test_block: tests: - - query: select B1 from B where exists (select A.*, B1 from A group by A1,A2,A3); - # 4.1 Triage: [Investigate further: Exists subquery] Infinite loop - - maxRows: 0 + - supported_version: !current_version + - explain: "SCAN(<,>) | TFILTER B | FLATMAP q0 -> { ISCAN(A_IDX <,>) | MAP (_ AS _0) | AGG () GROUP BY (_._0.A1 AS _0, _._0.A2 AS _1, _._0.A3 AS _2) | MAP (_._0._0 AS A1, _._0._1 AS A2, _._0._2 AS A3, q0.B1 AS B1) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN (q0.B1 AS B1) }" - result: [{1}, {2}, {3}] + - + # Version of above query to simulate force_continuations with older versions. + # Can remove once we do not care about cross-version compatibility before !current_version + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3219 + - query: select B1 from B where exists (select A.*, B1 from A group by A1,A2,A3); + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{1}] + - result: [{2}] + - result: [{2}] + - result: [{3}] + - result: [{3}] + - result: [] + - initialVersionAtLeast: !current_version # Handled by above query in force_continuations mode - - query: select A.* from A; - result: [{A1: 1 , A2: 10, A3: 1}, {A1: 2, A2: 10, A3: 2}, {A1: 3, A2: 10, A3: 3}] @@ -80,16 +94,44 @@ test_block: - error: "42803" - - query: select B1 from B where exists (select A.*, B1 from A group by A1,A2,A3); - # 4.1 Triage: [Investigate further: Exists subquery] Infinite loop - - maxRows: 0 + - supported_version: !current_version + - explain: "SCAN(<,>) | TFILTER B | FLATMAP q0 -> { ISCAN(A_IDX <,>) | MAP (_ AS _0) | AGG () GROUP BY (_._0.A1 AS _0, _._0.A2 AS _1, _._0.A3 AS _2) | MAP (_._0._0 AS A1, _._0._1 AS A2, _._0._2 AS A3, q0.B1 AS B1) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN (q0.B1 AS B1) }" - result: [{1}, {2}, {3}] + - + # Version of above query to simulate force_continuations with older versions. + # Can remove once we do not care about cross-version compatibility before !current_version + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3219 + - query: select B1 from B where exists (select A.*, B1 from A group by A1,A2,A3); + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{1}] + - result: [{2}] + - result: [{2}] + - result: [{3}] + - result: [{3}] + - result: [] + - initialVersionAtLeast: !current_version # Handled by above query in force_continuations mode - - query: select B.* from B where exists (select A.*, B.* from A group by A1,A2,A3); - # 4.1 Triage: [Investigate further: Exists subquery] Infinite loop - - maxRows: 0 + - supported_version: !current_version + - explain: "SCAN(<,>) | TFILTER B | FLATMAP q0 -> { ISCAN(A_IDX <,>) | MAP (_ AS _0) | AGG () GROUP BY (_._0.A1 AS _0, _._0.A2 AS _1, _._0.A3 AS _2) | MAP (_._0._0 AS A1, _._0._1 AS A2, _._0._2 AS A3, q0.B1 AS B1, q0.B2 AS B2, q0.B3 AS B3) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN q0 }" - result: [{1, 20, {4, 40}}, {2, 20, {5, 50}}, {3, 20, {6, 60}}] + - + # Version of above query to simulate force_continuations with older versions. + # Can remove once we do not care about cross-version compatibility before !current_version + # See: https://github.com/FoundationDB/fdb-record-layer/issues/3219 + - query: select B.* from B where exists (select A.*, B.* from A group by A1,A2,A3); + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{1, 20, {4, 40}}] + - result: [{2, 20, {5, 50}}] + - result: [{2, 20, {5, 50}}] + - result: [{3, 20, {6, 60}}] + - result: [{3, 20, {6, 60}}] + - result: [] + - initialVersionAtLeast: !current_version # Handled by above query in force_continuations mode - # Not yet supported - query: select B.B3.* from B; From ad17b135192b25929081462a2a51227e908191a3 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Mon, 3 Mar 2025 18:07:06 +0000 Subject: [PATCH 37/62] fixup subquery-tests.yamsql to enable more force continuations tests --- .../resources/subquery-tests.metrics.binpb | 199 ++++++++++++++++++ .../resources/subquery-tests.metrics.yaml | 81 +++++++ .../src/test/resources/subquery-tests.yamsql | 63 +++++- 3 files changed, 335 insertions(+), 8 deletions(-) create mode 100644 yaml-tests/src/test/resources/subquery-tests.metrics.binpb create mode 100644 yaml-tests/src/test/resources/subquery-tests.metrics.yaml diff --git a/yaml-tests/src/test/resources/subquery-tests.metrics.binpb b/yaml-tests/src/test/resources/subquery-tests.metrics.binpb new file mode 100644 index 0000000000..3526d993d9 --- /dev/null +++ b/yaml-tests/src/test/resources/subquery-tests.metrics.binpb @@ -0,0 +1,199 @@ +) +[ +subquery-testsIEXPLAIN select ida from a where exists (select ida from a where ida = 1);) +  (0g88@SCAN(<,>) | TFILTER A | FILTER _.IDA EQUALS promote(@c15 AS INT) | MAP (_.IDA AS IDA) | DEFAULT NULL | FLATMAP q0 -> { SCAN(<,>) | TFILTER A | FILTER q0 NOT_NULL AS q1 RETURN (q1.IDA AS IDA) }'digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Nested Loop Join
FLATMAP (q2.IDA AS IDA)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDA)" ]; + 2 [ label=<
Value Computation
FIRST $q8 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDA)" ]; + 3 [ label=<
Value Computation
MAP (q25.IDA AS IDA)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDA)" ]; + 4 [ label=<
Predicate Filter
WHERE q4.IDA EQUALS promote(@c15 AS INT)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDA, )" ]; + 5 [ label=<
Type Filter
WHERE record IS [A]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDA, )" ]; + 6 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 7 [ label=<
Primary Storage
record types: [X, A, B, R]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Predicate Filter
WHERE q8 NOT_NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDA, )" ]; + 9 [ label=<
Type Filter
WHERE record IS [A]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDA, )" ]; + 10 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 11 [ label=<
Primary Storage
record types: [X, A, B, R]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q25> label="q25" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q21> label="q21" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q8> label="q8" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ label=< q21> label="q21" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 11 -> 10 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + { + rank=same; + rankDir=LR; + 2 -> 8 [ color="red" style="invis" ]; + } +}) +Y +subquery-testsGEXPLAIN select idx from x where exists (select x from a where ida = 1);) +@ ر'('0ÿ8>@SCAN(<,>) | TFILTER A | FILTER _.IDA EQUALS promote(@c15 AS INT) | MAP (_.X AS X) | DEFAULT NULL | FLATMAP q0 -> { SCAN(<,>) | TFILTER X | FILTER q0 NOT_NULL AS q1 RETURN (q1.IDX AS IDX) }'digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Nested Loop Join
FLATMAP (q2.IDX AS IDX)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDX)" ]; + 2 [ label=<
Value Computation
FIRST $q10 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 3 [ label=<
Value Computation
MAP (q33.X AS X)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 4 [ label=<
Predicate Filter
WHERE q6.IDA EQUALS promote(@c15 AS INT)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDA, )" ]; + 5 [ label=<
Type Filter
WHERE record IS [A]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDA, )" ]; + 6 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 7 [ label=<
Primary Storage
record types: [X, A, B, R]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Predicate Filter
WHERE q10 NOT_NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDX, )" ]; + 9 [ label=<
Type Filter
WHERE record IS [X]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDX, )" ]; + 10 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 11 [ label=<
Primary Storage
record types: [X, A, B, R]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q10> label="q10" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q33> label="q33" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q29> label="q29" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q10> label="q10" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ label=< q43> label="q43" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 11 -> 10 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + { + rank=same; + rankDir=LR; + 2 -> 8 [ color="red" style="invis" ]; + } +}* +m +subquery-tests[EXPLAIN select x from a where exists (select a.x, max(idb) from b where q > a.x group by q)) +ԁ1 ((0莩84@SCAN(<,>) | TFILTER A | FLATMAP q0 -> { ISCAN(IB [[GREATER_THAN q0.X]]) | MAP (_ AS _0) | AGG (max_i(_._0.IDB) AS _0) GROUP BY (_._0.Q AS _0) | MAP (q0.X AS X, _._1._0 AS _1) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN (q0.X AS X) }'digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Nested Loop Join
FLATMAP (q2.X AS X)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 2 [ label=<
Type Filter
WHERE record IS [A]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDA, )" ]; + 3 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 4 [ label=<
Primary Storage
record types: [X, A, B, R]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 5 [ label=<
Predicate Filter
WHERE q14 NOT_NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X, )" ]; + 6 [ label=<
Value Computation
FIRST $q14 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X, )" ]; + 7 [ label=<
Value Computation
MAP (q2.X AS X, q10._1._0 AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X, )" ]; + 8 [ label=<
Streaming Aggregate
COLLECT (max_i(q56._0.IDB) AS _0)
GROUP BY (q56._0.Q AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0 AS _0, )" ]; + 9 [ label=<
Value Computation
MAP (q6 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDB, AS _0)" ]; + 10 [ label=<
Index Scan
comparisons: [[GREATER_THAN q2.X]]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDB, )" ]; + 11 [ label=<
Index
IB
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDB, )" ]; + 3 -> 2 [ label=< q60> label="q60" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ label=< q10> label="q10" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ label=< q56> label="q56" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 11 -> 10 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 1 [ label=< q14> label="q14" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + { + rank=same; + rankDir=LR; + 2 -> 5 [ color="red" style="invis" ]; + } +}* +i +subquery-testsWEXPLAIN select x from a where exists (select x, max(idb) from b where q > x group by q)) +2 ((084@SCAN(<,>) | TFILTER A | FLATMAP q0 -> { ISCAN(IB [[GREATER_THAN q0.X]]) | MAP (_ AS _0) | AGG (max_i(_._0.IDB) AS _0) GROUP BY (_._0.Q AS _0) | MAP (q0.X AS X, _._1._0 AS _1) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN (q0.X AS X) }'digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Nested Loop Join
FLATMAP (q2.X AS X)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 2 [ label=<
Type Filter
WHERE record IS [A]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDA, )" ]; + 3 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 4 [ label=<
Primary Storage
record types: [X, A, B, R]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 5 [ label=<
Predicate Filter
WHERE q14 NOT_NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X, )" ]; + 6 [ label=<
Value Computation
FIRST $q14 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X, )" ]; + 7 [ label=<
Value Computation
MAP (q2.X AS X, q10._1._0 AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X, )" ]; + 8 [ label=<
Streaming Aggregate
COLLECT (max_i(q56._0.IDB) AS _0)
GROUP BY (q56._0.Q AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0 AS _0, )" ]; + 9 [ label=<
Value Computation
MAP (q6 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDB, AS _0)" ]; + 10 [ label=<
Index Scan
comparisons: [[GREATER_THAN q2.X]]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDB, )" ]; + 11 [ label=<
Index
IB
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDB, )" ]; + 3 -> 2 [ label=< q60> label="q60" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ label=< q10> label="q10" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ label=< q56> label="q56" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 11 -> 10 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 1 [ label=< q14> label="q14" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + { + rank=same; + rankDir=LR; + 2 -> 5 [ color="red" style="invis" ]; + } +}+ +n +subquery-tests\EXPLAIN select x from a where exists (select max(x), max(idb) from b where q > x group by q)* +0 ((0ؖ84@SCAN(<,>) | TFILTER A | FLATMAP q0 -> { ISCAN(IB [[GREATER_THAN q0.X]]) | MAP (_ AS _0) | AGG (max_i(q0.X) AS _0, max_i(_._0.IDB) AS _1) GROUP BY (_._0.Q AS _0) | MAP (_._1._0 AS _0, _._1._1 AS _1) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN (q0.X AS X) }(digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Nested Loop Join
FLATMAP (q2.X AS X)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 2 [ label=<
Type Filter
WHERE record IS [A]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDA, )" ]; + 3 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 4 [ label=<
Primary Storage
record types: [X, A, B, R]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 5 [ label=<
Predicate Filter
WHERE q14 NOT_NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0, )" ]; + 6 [ label=<
Value Computation
FIRST $q14 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0, )" ]; + 7 [ label=<
Value Computation
MAP (q10._1._0 AS _0, q10._1._1 AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0, )" ]; + 8 [ label=<
Streaming Aggregate
COLLECT (max_i(q2.X) AS _0, max_i(q56._0.IDB) AS _1)
GROUP BY (q56._0.Q AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0 AS _0, )" ]; + 9 [ label=<
Value Computation
MAP (q6 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDB, AS _0)" ]; + 10 [ label=<
Index Scan
comparisons: [[GREATER_THAN q2.X]]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDB, )" ]; + 11 [ label=<
Index
IB
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDB, )" ]; + 3 -> 2 [ label=< q60> label="q60" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ label=< q10> label="q10" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ label=< q56> label="q56" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 11 -> 10 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 1 [ label=< q14> label="q14" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + { + rank=same; + rankDir=LR; + 2 -> 5 [ color="red" style="invis" ]; + } +}+ +p +subquery-tests^EXPLAIN select x from a where exists (select max(a.x), max(idb) from b where q > x group by q)* + ((084@SCAN(<,>) | TFILTER A | FLATMAP q0 -> { ISCAN(IB [[GREATER_THAN q0.X]]) | MAP (_ AS _0) | AGG (max_i(q0.X) AS _0, max_i(_._0.IDB) AS _1) GROUP BY (_._0.Q AS _0) | MAP (_._1._0 AS _0, _._1._1 AS _1) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN (q0.X AS X) }(digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Nested Loop Join
FLATMAP (q2.X AS X)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 2 [ label=<
Type Filter
WHERE record IS [A]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDA, )" ]; + 3 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 4 [ label=<
Primary Storage
record types: [X, A, B, R]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 5 [ label=<
Predicate Filter
WHERE q14 NOT_NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0, )" ]; + 6 [ label=<
Value Computation
FIRST $q14 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0, )" ]; + 7 [ label=<
Value Computation
MAP (q10._1._0 AS _0, q10._1._1 AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0, )" ]; + 8 [ label=<
Streaming Aggregate
COLLECT (max_i(q2.X) AS _0, max_i(q56._0.IDB) AS _1)
GROUP BY (q56._0.Q AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0 AS _0, )" ]; + 9 [ label=<
Value Computation
MAP (q6 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDB, AS _0)" ]; + 10 [ label=<
Index Scan
comparisons: [[GREATER_THAN q2.X]]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDB, )" ]; + 11 [ label=<
Index
IB
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(INT AS IDB, )" ]; + 3 -> 2 [ label=< q60> label="q60" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ label=< q10> label="q10" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ label=< q56> label="q56" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 11 -> 10 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 1 [ label=< q14> label="q14" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + { + rank=same; + rankDir=LR; + 2 -> 5 [ color="red" style="invis" ]; + } +} \ No newline at end of file diff --git a/yaml-tests/src/test/resources/subquery-tests.metrics.yaml b/yaml-tests/src/test/resources/subquery-tests.metrics.yaml new file mode 100644 index 0000000000..cc92bf20f4 --- /dev/null +++ b/yaml-tests/src/test/resources/subquery-tests.metrics.yaml @@ -0,0 +1,81 @@ +subquery-tests: +- query: EXPLAIN select ida from a where exists (select ida from a where ida = 1); + explain: SCAN(<,>) | TFILTER A | FILTER _.IDA EQUALS promote(@c15 AS INT) | MAP + (_.IDA AS IDA) | DEFAULT NULL | FLATMAP q0 -> { SCAN(<,>) | TFILTER A | FILTER + q0 NOT_NULL AS q1 RETURN (q1.IDA AS IDA) } + task_count: 576 + task_total_time_ms: 23 + transform_count: 168 + transform_time_ms: 5 + transform_yield_count: 31 + insert_time_ms: 1 + insert_new_count: 56 + insert_reused_count: 2 +- query: EXPLAIN select idx from x where exists (select x from a where ida = 1); + explain: SCAN(<,>) | TFILTER A | FILTER _.IDA EQUALS promote(@c15 AS INT) | MAP + (_.X AS X) | DEFAULT NULL | FLATMAP q0 -> { SCAN(<,>) | TFILTER X | FILTER + q0 NOT_NULL AS q1 RETURN (q1.IDX AS IDX) } + task_count: 671 + task_total_time_ms: 135 + transform_count: 195 + transform_time_ms: 82 + transform_yield_count: 39 + insert_time_ms: 7 + insert_new_count: 62 + insert_reused_count: 3 +- query: EXPLAIN select x from a where exists (select a.x, max(idb) from b where + q > a.x group by q) + explain: SCAN(<,>) | TFILTER A | FLATMAP q0 -> { ISCAN(IB [[GREATER_THAN q0.X]]) + | MAP (_ AS _0) | AGG (max_i(_._0.IDB) AS _0) GROUP BY (_._0.Q AS _0) | MAP + (q0.X AS X, _._1._0 AS _1) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN + (q0.X AS X) } + task_count: 542 + task_total_time_ms: 104 + transform_count: 170 + transform_time_ms: 55 + transform_yield_count: 40 + insert_time_ms: 2 + insert_new_count: 52 + insert_reused_count: 3 +- query: EXPLAIN select x from a where exists (select x, max(idb) from b where q + > x group by q) + explain: SCAN(<,>) | TFILTER A | FLATMAP q0 -> { ISCAN(IB [[GREATER_THAN q0.X]]) + | MAP (_ AS _0) | AGG (max_i(_._0.IDB) AS _0) GROUP BY (_._0.Q AS _0) | MAP + (q0.X AS X, _._1._0 AS _1) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN + (q0.X AS X) } + task_count: 542 + task_total_time_ms: 106 + transform_count: 170 + transform_time_ms: 56 + transform_yield_count: 40 + insert_time_ms: 3 + insert_new_count: 52 + insert_reused_count: 3 +- query: EXPLAIN select x from a where exists (select max(x), max(idb) from b where + q > x group by q) + explain: SCAN(<,>) | TFILTER A | FLATMAP q0 -> { ISCAN(IB [[GREATER_THAN q0.X]]) + | MAP (_ AS _0) | AGG (max_i(q0.X) AS _0, max_i(_._0.IDB) AS _1) GROUP BY + (_._0.Q AS _0) | MAP (_._1._0 AS _0, _._1._1 AS _1) | DEFAULT NULL | FILTER + _ NOT_NULL AS q0 RETURN (q0.X AS X) } + task_count: 542 + task_total_time_ms: 102 + transform_count: 170 + transform_time_ms: 52 + transform_yield_count: 40 + insert_time_ms: 3 + insert_new_count: 52 + insert_reused_count: 3 +- query: EXPLAIN select x from a where exists (select max(a.x), max(idb) from b + where q > x group by q) + explain: SCAN(<,>) | TFILTER A | FLATMAP q0 -> { ISCAN(IB [[GREATER_THAN q0.X]]) + | MAP (_ AS _0) | AGG (max_i(q0.X) AS _0, max_i(_._0.IDB) AS _1) GROUP BY + (_._0.Q AS _0) | MAP (_._1._0 AS _0, _._1._1 AS _1) | DEFAULT NULL | FILTER + _ NOT_NULL AS q0 RETURN (q0.X AS X) } + task_count: 542 + task_total_time_ms: 33 + transform_count: 170 + transform_time_ms: 13 + transform_yield_count: 40 + insert_time_ms: 2 + insert_new_count: 52 + insert_reused_count: 3 diff --git a/yaml-tests/src/test/resources/subquery-tests.yamsql b/yaml-tests/src/test/resources/subquery-tests.yamsql index 2212ff6be0..9c9b0ff7b3 100644 --- a/yaml-tests/src/test/resources/subquery-tests.yamsql +++ b/yaml-tests/src/test/resources/subquery-tests.yamsql @@ -40,12 +40,14 @@ test_block: - # non correlated subquery, resolving alias should be fine. - query: select ida from a where exists (select ida from a where ida = 1); + - explain: "SCAN(<,>) | TFILTER A | FILTER _.IDA EQUALS promote(@c15 AS INT) | MAP (_.IDA AS IDA) | DEFAULT NULL | FLATMAP q0 -> { SCAN(<,>) | TFILTER A | FILTER q0 NOT_NULL AS q1 RETURN (q1.IDA AS IDA) }" - result: [{1}, {2}, {3}] - # this should work albeit being seemingly ambiguous # upper query block resolution should kick in _iff_ we fail to resolve # the identifier in current query block. - query: select idx from x where exists (select x from a where ida = 1); + - explain: "SCAN(<,>) | TFILTER A | FILTER _.IDA EQUALS promote(@c15 AS INT) | MAP (_.X AS X) | DEFAULT NULL | FLATMAP q0 -> { SCAN(<,>) | TFILTER X | FILTER q0 NOT_NULL AS q1 RETURN (q1.IDX AS IDX) }" - result: [{4}, {5}, {6}] - # PartiQL resolution. @@ -62,25 +64,70 @@ test_block: - # correlations are allowed inside a nested subquery with group by - query: select x from a where exists (select a.x, max(idb) from b where q > a.x group by q) - # 4.1 Triage: fail with forced continuations (Verify Exception for continuation, Type$Record.fromProto(Type.java:2095)) - - maxRows: 0 + - supported_version: !current_version + - explain: "SCAN(<,>) | TFILTER A | FLATMAP q0 -> { ISCAN(IB [[GREATER_THAN q0.X]]) | MAP (_ AS _0) | AGG (max_i(_._0.IDB) AS _0) GROUP BY (_._0.Q AS _0) | MAP (q0.X AS X, _._1._0 AS _1) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN (q0.X AS X) }" - result: [{1}, {2}, {3}] + - + # Copy of above to simulate force_continuations with versions older than !current_version + # Can remove when we no longer care about mixed mode compatibility with older versions + - query: select x from a where exists (select a.x, max(idb) from b where q > a.x group by q) + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{1}] + - result: [{2}] + - error: 'XX000' # Fails to deserialize due to https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - initialVersionAtLeast: !current_version # Handled in previous query - # correlations are allowed inside a nested subquery with group by, not necessarily qualified - query: select x from a where exists (select x, max(idb) from b where q > x group by q) - # 4.1 Triage: fail with forced continuations (Verify Exception for continuation, Type$Record.fromProto(Type.java:2095)) - - maxRows: 0 + - supported_version: !current_version + - explain: "SCAN(<,>) | TFILTER A | FLATMAP q0 -> { ISCAN(IB [[GREATER_THAN q0.X]]) | MAP (_ AS _0) | AGG (max_i(_._0.IDB) AS _0) GROUP BY (_._0.Q AS _0) | MAP (q0.X AS X, _._1._0 AS _1) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN (q0.X AS X) }" - result: [{1}, {2}, {3}] + - + # Copy of above to simulate force_continuations with versions older than !current_version + # Can remove when we no longer care about mixed mode compatibility with older versions + - query: select x from a where exists (select x, max(idb) from b where q > x group by q) + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{1}] + - result: [{2}] + - error: 'XX000' # Fails to deserialize due to https://github.com/FoundationDB/fdb-record-layer/issues/3214 + - initialVersionAtLeast: !current_version # Handled in previous query - # correlations inside aggregations are allowed inside a nested subquery with group by - query: select x from a where exists (select max(x), max(idb) from b where q > x group by q) - # 4.1 Triage: [Investigate further: exists subquery] infinite loop for continuation - - maxRows: 0 + - supported_version: !current_version + - explain: "SCAN(<,>) | TFILTER A | FLATMAP q0 -> { ISCAN(IB [[GREATER_THAN q0.X]]) | MAP (_ AS _0) | AGG (max_i(q0.X) AS _0, max_i(_._0.IDB) AS _1) GROUP BY (_._0.Q AS _0) | MAP (_._1._0 AS _0, _._1._1 AS _1) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN (q0.X AS X) }" - result: [{1}, {2}, {3}] + - + # Copy of above to simulate force_continuations with versions older than !current_version + # Can remove when we no longer care about mixed mode compatibility with older versions + - query: select x from a where exists (select max(x), max(idb) from b where q > x group by q) + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{1}] + - result: [{2}] + - result: [{2}] # Repetition of previously returned result due to: https://github.com/FoundationDB/fdb-record-layer/issues/3219 + - result: [{3}] + - result: [{3}] + - result: [] + - initialVersionAtLeast: !current_version - # correlations inside aggregations are allowed inside a nested subquery with group by - query: select x from a where exists (select max(a.x), max(idb) from b where q > x group by q) - # 4.1 Triage: [Investigate further: exists subquery] infinite loop for continuation - - maxRows: 0 + - supported_version: !current_version + - explain: "SCAN(<,>) | TFILTER A | FLATMAP q0 -> { ISCAN(IB [[GREATER_THAN q0.X]]) | MAP (_ AS _0) | AGG (max_i(q0.X) AS _0, max_i(_._0.IDB) AS _1) GROUP BY (_._0.Q AS _0) | MAP (_._1._0 AS _0, _._1._1 AS _1) | DEFAULT NULL | FILTER _ NOT_NULL AS q0 RETURN (q0.X AS X) }" - result: [{1}, {2}, {3}] + - + # correlations inside aggregations are allowed inside a nested subquery with group by + - query: select x from a where exists (select max(a.x), max(idb) from b where q > x group by q) + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{1}] + - result: [{2}] + - result: [{2}] # Repetition of previously returned result due to: https://github.com/FoundationDB/fdb-record-layer/issues/3219 + - result: [{3}] + - result: [{3}] + - result: [] + - initialVersionAtLeast: !current_version ... From 51c816bb596a9d5193cf159474011cbe2fcf7971 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Mon, 3 Mar 2025 18:29:32 +0000 Subject: [PATCH 38/62] touch up bitmap-aggregate-index.yamsql --- .../yamltests/command/QueryExecutor.java | 16 +++++++------- .../resources/bitmap-aggregate-index.yamsql | 21 +++++++++++++------ yaml-tests/yaml-tests.gradle | 17 ++++++++++++++- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java index b35c1dfc93..97a8ec107e 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java @@ -147,13 +147,15 @@ private Object executeStatementAndCheckCacheIfNeeded(@Nonnull Statement s, final preMetricCollector.getCountsForCounter(RelationalMetric.RelationalCount.PLAN_CACHE_TERTIARY_HIT) : 0; final var toReturn = executeStatementAndCheckForceContinuations(s, statementHasQuery, queryString, connection, maxRows); final var postMetricCollector = connection.getMetricCollector(); - final var postValue = postMetricCollector.hasCounter(RelationalMetric.RelationalCount.PLAN_CACHE_TERTIARY_HIT) ? - postMetricCollector.getCountsForCounter(RelationalMetric.RelationalCount.PLAN_CACHE_TERTIARY_HIT) : 0; - final var planFound = preMetricCollector != postMetricCollector ? postValue == 1 : postValue == preValue + 1; - if (!planFound) { - reportTestFailure("‼️ Expected to retrieve the plan from the cache at line " + lineNumber); - } else { - logger.debug("🎁 Retrieved the plan from the cache!"); + if (postMetricCollector != null) { + final var postValue = postMetricCollector.hasCounter(RelationalMetric.RelationalCount.PLAN_CACHE_TERTIARY_HIT) ? + postMetricCollector.getCountsForCounter(RelationalMetric.RelationalCount.PLAN_CACHE_TERTIARY_HIT) : 0; + final var planFound = preMetricCollector != postMetricCollector ? postValue == 1 : postValue == preValue + 1; + if (!planFound) { + reportTestFailure("‼️ Expected to retrieve the plan from the cache at line " + lineNumber); + } else { + logger.debug("🎁 Retrieved the plan from the cache!"); + } } return toReturn; } diff --git a/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql b/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql index 2422090c2f..b71a63ef1e 100644 --- a/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql +++ b/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql @@ -71,8 +71,7 @@ test_block: - query: SELECT bitmap_construct_agg(bitmap_bit_position(id)) as bitmap, bitmap_bucket_offset(id) as offset FROM T2 GROUP BY bitmap_bucket_offset(id) - supported_version: !current_version - explain: "ISCAN(AGG_INDEX_1 <,>) | MAP (_ AS _0) | AGG (bitmap_construct_agg_l((_._0.ID) bitmap_bit_position 10000) AS _0) GROUP BY ((_._0.ID) bitmap_bucket_offset 10000 AS _0) | MAP (_._1._0 AS BITMAP, _._0._0 AS OFFSET)" - # 4.1 Triage: [Initial version] this fails with continuation tests against 4.0.559.6. Wrong results - # - unorderedResult: [{BITMAP: xStartsWith_1250'060000c', 'OFFSET':0}, {BITMAP: xStartsWith_1250'02', 'OFFSET':10000}] + - unorderedResult: [{BITMAP: xStartsWith_1250'060000c', 'OFFSET':0}, {BITMAP: xStartsWith_1250'02', 'OFFSET':10000}] - - query: SELECT bitmap_construct_agg(bitmap_bit_position(id)) as bitmap, bitmap_bucket_offset(id) as offset FROM T2 GROUP BY bitmap_bucket_offset(id) - maxRows: 1 @@ -103,8 +102,18 @@ test_block: - query: SELECT bitmap_construct_agg(bitmap_bit_position(id)) as bitmap, category, bitmap_bucket_offset(id) as offset FROM T2 GROUP BY category, bitmap_bucket_offset(id) - supported_version: !current_version - explain: "ISCAN(AGG_INDEX_2 <,>) | MAP (_ AS _0) | AGG (bitmap_construct_agg_l((_._0.ID) bitmap_bit_position 10000) AS _0) GROUP BY (_._0.CATEGORY AS _0, (_._0.ID) bitmap_bucket_offset 10000 AS _1) | MAP (_._1._0 AS BITMAP, _._0._0 AS CATEGORY, _._0._1 AS OFFSET)" - # 4.1 Triage: [Initial version] this fails with continuation tests against 4.0.559.6. Wrong results - # - unorderedResult: [{BITMAP: xStartsWith_1250'0200004', 'CATEGORY': 'hello', 'OFFSET':0}, - # {BITMAP: xStartsWith_1250'02', 'CATEGORY': 'hello', 'OFFSET':10000}, - # {BITMAP: xStartsWith_1250'0400008', 'CATEGORY': 'world', 'OFFSET':0}] + - unorderedResult: [{BITMAP: xStartsWith_1250'0200004', 'CATEGORY': 'hello', 'OFFSET':0}, + {BITMAP: xStartsWith_1250'02', 'CATEGORY': 'hello', 'OFFSET':10000}, + {BITMAP: xStartsWith_1250'0400008', 'CATEGORY': 'world', 'OFFSET':0}] + - + # Copy of the previous but query, but disable force_continuation. + # This doesn't work before !current_version because of: https://github.com/FoundationDB/fdb-record-layer/issues/3097 + # It's hard to write a test assertion that follows the expected behavior across multiple upgrades, + # but it can end up skipping values when resuming from a continuation + - query: SELECT bitmap_construct_agg(bitmap_bit_position(id)) as bitmap, category, bitmap_bucket_offset(id) as offset FROM T2 GROUP BY category, bitmap_bucket_offset(id) + - maxRows: 0 + - explain: "ISCAN(AGG_INDEX_2 <,>) | MAP (_ AS _0) | AGG (bitmap_construct_agg_l((_._0.ID) bitmap_bit_position 10000) AS _0) GROUP BY (_._0.CATEGORY AS _0, (_._0.ID) bitmap_bucket_offset 10000 AS _1) | MAP (_._1._0 AS BITMAP, _._0._0 AS CATEGORY, _._0._1 AS OFFSET)" + - unorderedResult: [{BITMAP: xStartsWith_1250'0200004', 'CATEGORY': 'hello', 'OFFSET':0}, + {BITMAP: xStartsWith_1250'02', 'CATEGORY': 'hello', 'OFFSET':10000}, + {BITMAP: xStartsWith_1250'0400008', 'CATEGORY': 'world', 'OFFSET':0}] ... diff --git a/yaml-tests/yaml-tests.gradle b/yaml-tests/yaml-tests.gradle index 84a1938206..744973f4a0 100644 --- a/yaml-tests/yaml-tests.gradle +++ b/yaml-tests/yaml-tests.gradle @@ -96,7 +96,8 @@ ext.resolveOtherServer = { Set rejectedVersions -> 'classifier': 'all'], { version { - strictly '4.0.559.6' + // strictly '4.0.559.6' + strictly '+' if (rejectedVersions.size() > 0) { reject rejectedVersions.toArray(new String[0]) } @@ -140,6 +141,7 @@ static def getAttributesFromJar(File file) { ext.resolveManyServers = { -> Set selectedServers = new HashSet<>(); + // return selectedServers Set rejectedVersions = new HashSet<>(); while (selectedServers.size() < 50) { def serverFile = resolveOtherServer(rejectedVersions) @@ -170,6 +172,19 @@ task serverJars(type: Copy) { } } +task downloadManyExternalServers(type: Copy) { + dependsOn "cleanExternalServerDirectory" + from resolveManyServers() + into project.layout.buildDirectory.dir('externalServer') +} + +mixedModeTest { + dependsOn("downloadManyExternalServers") + systemProperty("yaml_testing_external_server", project.layout.buildDirectory.dir('externalServer').get().asFile) + // this is specified in testing.gradle, but it looks like it needs to be repeated here. + ignoreFailures = true +} + test { dependsOn "serverJars" systemProperty("yaml_testing_external_server", project.layout.buildDirectory.dir('externalServer').get().asFile) From a194aacd9a6cb7c7d32e67d28265a5c473af252b Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Mon, 3 Mar 2025 18:37:28 +0000 Subject: [PATCH 39/62] include issues in functions.yamsql --- yaml-tests/src/test/resources/functions.yamsql | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/yaml-tests/src/test/resources/functions.yamsql b/yaml-tests/src/test/resources/functions.yamsql index b5b8993ce6..0756446ea9 100644 --- a/yaml-tests/src/test/resources/functions.yamsql +++ b/yaml-tests/src/test/resources/functions.yamsql @@ -92,10 +92,9 @@ test_block: - - query: select least(a1, a2, a8), least(1, 2, 3.0, 4, 5) from A - result: [{_0: 1.0, _1: 1.0}] - # 4.1 triage: [Deferred: literal null issue] Fails with force continuations for all versions with (including snapshot): cannot continue query due to mismatch between serialized and actual plan hash - - query: select coalesce(null, null, 5), coalesce(null, 1, null), coalesce(null, a1, a8) from A - - maxRows: 0 + - maxRows: 0 # Disable FORCE_CONTINUATIONS due to plan hash instability: https://github.com/FoundationDB/fdb-record-layer/issues/3218 - result: [{_0: 5, _1: 1, _2: 1.0}] - - query: select b1, b2, coalesce(b1, b2, 42) from B @@ -125,10 +124,9 @@ test_block: {{ T1: 3, A: 'c', B: 3.0}}, {{ T1: 4, A: 'd', B: 4.0}}, {!null _}] - # 4.1 triage: [Deferred: literal null issue] Fails with force continuations for all versions with (including snapshot): cannot continue query due to mismatch between serialized and actual plan hash - - query: select coalesce(null, (1, 1.0, 'a', true)) from C - - maxRows: 0 + - maxRows: 0 # Disable FORCE_CONTINUATIONS due to plan hash instability: https://github.com/FoundationDB/fdb-record-layer/issues/3218 - unorderedResult: [ {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, From d6a54b5363a2accd96a6e6b0313228b6de87bda5 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Tue, 4 Mar 2025 10:04:15 +0000 Subject: [PATCH 40/62] update catalog.yamsql --- .../src/test/resources/catalog.metrics.binpb | 42 +++++++++++++++++++ .../src/test/resources/catalog.metrics.yaml | 32 ++++++++++++++ yaml-tests/src/test/resources/catalog.yamsql | 22 +++++----- yaml-tests/yaml-tests.gradle | 8 ++-- 4 files changed, 91 insertions(+), 13 deletions(-) create mode 100644 yaml-tests/src/test/resources/catalog.metrics.binpb create mode 100644 yaml-tests/src/test/resources/catalog.metrics.yaml diff --git a/yaml-tests/src/test/resources/catalog.metrics.binpb b/yaml-tests/src/test/resources/catalog.metrics.binpb new file mode 100644 index 0000000000..8868c886e0 --- /dev/null +++ b/yaml-tests/src/test/resources/catalog.metrics.binpb @@ -0,0 +1,42 @@ + + + catalog-testsEXPLAIN select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas group by template_name, template_version having template_name = 'TEST_TEMPLATE_1') as t; +ٌ +('0I80@AISCAN(TEMPLATES_COUNT_INDEX [EQUALS promote(@c29 AS STRING)] BY_GROUP -> [_0: KEY:[0], _1: KEY:[1], _2: VALUE:[0]]) | MAP (_._2 AS CNT, _._0 AS TEMPLATE_NAME, _._1 AS TEMPLATE_VERSION) | MAP (_ AS _0) | AGG (sum_l(_._0.CNT) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q12._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q12 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q62._0.CNT) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q8 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS CNT, AS _0)" ]; + 5 [ label=<
Value Computation
MAP (q6._2 AS CNT, q6._0 AS TEMPLATE_NAME, q6._1 AS TEMPLATE_VERSION)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS CNT, )" ]; + 6 [ label=<
Index Scan
scan type: BY_GROUP
comparisons: [EQUALS promote(@c29 AS STRING)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0, )" ]; + 7 [ label=<
Index
TEMPLATES_COUNT_INDEX
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS DATABASE_ID, )" ]; + 3 -> 2 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q62> label="q62" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} + + catalog-testsEXPLAIN select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas group by template_name, template_version having template_name = 'TEST_TEMPLATE_1' and template_version = 1) as t; +޽ ܹ ('0U80@AISCAN(TEMPLATES_COUNT_INDEX [EQUALS promote(@c29 AS STRING), EQUALS promote(@c33 AS INT)] BY_GROUP -> [_0: KEY:[0], _1: KEY:[1], _2: VALUE:[0]]) | MAP (_._2 AS CNT, _._0 AS TEMPLATE_NAME, _._1 AS TEMPLATE_VERSION) | MAP (_ AS _0) | AGG (sum_l(_._0.CNT) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q12._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q12 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q62._0.CNT) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q8 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS CNT, AS _0)" ]; + 5 [ label=<
Value Computation
MAP (q6._2 AS CNT, q6._0 AS TEMPLATE_NAME, q6._1 AS TEMPLATE_VERSION)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS CNT, )" ]; + 6 [ label=<
Index Scan
scan type: BY_GROUP
comparisons: [EQUALS promote(@c29 AS STRING), EQUALS promote(@c33 AS INT)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0, )" ]; + 7 [ label=<
Index
TEMPLATES_COUNT_INDEX
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS DATABASE_ID, )" ]; + 3 -> 2 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q62> label="q62" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} \ No newline at end of file diff --git a/yaml-tests/src/test/resources/catalog.metrics.yaml b/yaml-tests/src/test/resources/catalog.metrics.yaml new file mode 100644 index 0000000000..3b19b743d6 --- /dev/null +++ b/yaml-tests/src/test/resources/catalog.metrics.yaml @@ -0,0 +1,32 @@ +catalog-tests: +- query: EXPLAIN select sum(cnt) from (select count(*) as cnt, template_name, template_version + from schemas group by template_name, template_version having template_name + = 'TEST_TEMPLATE_1') as t; + explain: 'AISCAN(TEMPLATES_COUNT_INDEX [EQUALS promote(@c29 AS STRING)] BY_GROUP + -> [_0: KEY:[0], _1: KEY:[1], _2: VALUE:[0]]) | MAP (_._2 AS CNT, _._0 AS + TEMPLATE_NAME, _._1 AS TEMPLATE_VERSION) | MAP (_ AS _0) | AGG (sum_l(_._0.CNT) + AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)' + task_count: 479 + task_total_time_ms: 45 + transform_count: 164 + transform_time_ms: 23 + transform_yield_count: 39 + insert_time_ms: 1 + insert_new_count: 48 + insert_reused_count: 3 +- query: EXPLAIN select sum(cnt) from (select count(*) as cnt, template_name, template_version + from schemas group by template_name, template_version having template_name + = 'TEST_TEMPLATE_1' and template_version = 1) as t; + explain: 'AISCAN(TEMPLATES_COUNT_INDEX [EQUALS promote(@c29 AS STRING), EQUALS + promote(@c33 AS INT)] BY_GROUP -> [_0: KEY:[0], _1: KEY:[1], _2: VALUE:[0]]) + | MAP (_._2 AS CNT, _._0 AS TEMPLATE_NAME, _._1 AS TEMPLATE_VERSION) | MAP + (_ AS _0) | AGG (sum_l(_._0.CNT) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS + _0)' + task_count: 479 + task_total_time_ms: 52 + transform_count: 164 + transform_time_ms: 24 + transform_yield_count: 39 + insert_time_ms: 1 + insert_new_count: 48 + insert_reused_count: 3 diff --git a/yaml-tests/src/test/resources/catalog.yamsql b/yaml-tests/src/test/resources/catalog.yamsql index bc51ff2cbb..4b9ec7208b 100644 --- a/yaml-tests/src/test/resources/catalog.yamsql +++ b/yaml-tests/src/test/resources/catalog.yamsql @@ -58,21 +58,23 @@ test_block: - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas group by template_name, template_version having template_name = 't') as t; - explainContains: 'AISCAN(TEMPLATES_COUNT_INDEX' - # 4.1 Triage: [Deferred: Client checks for End] failing when running with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas - # group by template_name, template_version having template_name = 'TEST_TEMPLATE_1') as t; - # - result: [{4}] + - + - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas + group by template_name, template_version having template_name = 'TEST_TEMPLATE_1') as t; + - explain: "AISCAN(TEMPLATES_COUNT_INDEX [EQUALS promote(@c29 AS STRING)] BY_GROUP -> [_0: KEY:[0], _1: KEY:[1], _2: VALUE:[0]]) | MAP (_._2 AS CNT, _._0 AS TEMPLATE_NAME, _._1 AS TEMPLATE_VERSION) | MAP (_ AS _0) | AGG (sum_l(_._0.CNT) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" + - maxRows: 0 # Disable force continuations because of empty continuation due to: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - result: [{4}] - # How many schemas with the specified schemaTemplateName and schemaTemplateVersion exist in this cluster? - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas group by template_name, template_version having template_name = 't' and template_version = 1) as t; - explainContains: 'AISCAN(TEMPLATES_COUNT_INDEX' - # 4.1 Triage: [Deferred: Client checks for End] failing when running with forced continuations (Received continuation shouldn't be at beginning) - # - - # - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas - # group by template_name, template_version having template_name = 'TEST_TEMPLATE_1' and template_version = 1) as t; - # - result: [{4}] + - + - query: select sum(cnt) from (select count(*) as cnt, template_name, template_version from schemas + group by template_name, template_version having template_name = 'TEST_TEMPLATE_1' and template_version = 1) as t; + - explain: "AISCAN(TEMPLATES_COUNT_INDEX [EQUALS promote(@c29 AS STRING), EQUALS promote(@c33 AS INT)] BY_GROUP -> [_0: KEY:[0], _1: KEY:[1], _2: VALUE:[0]]) | MAP (_._2 AS CNT, _._0 AS TEMPLATE_NAME, _._1 AS TEMPLATE_VERSION) | MAP (_ AS _0) | AGG (sum_l(_._0.CNT) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" + - maxRows: 0 # Disable force continuations because of empty continuation due to: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - result: [{4}] - # how many unique templates in a cluster? - query: select count(*) from (select count(*), template_name, template_version from schemas diff --git a/yaml-tests/yaml-tests.gradle b/yaml-tests/yaml-tests.gradle index 744973f4a0..78ae11f487 100644 --- a/yaml-tests/yaml-tests.gradle +++ b/yaml-tests/yaml-tests.gradle @@ -96,8 +96,8 @@ ext.resolveOtherServer = { Set rejectedVersions -> 'classifier': 'all'], { version { - // strictly '4.0.559.6' - strictly '+' + strictly '4.0.559.6' + // strictly '+' if (rejectedVersions.size() > 0) { reject rejectedVersions.toArray(new String[0]) } @@ -141,8 +141,10 @@ static def getAttributesFromJar(File file) { ext.resolveManyServers = { -> Set selectedServers = new HashSet<>(); - // return selectedServers + return selectedServers Set rejectedVersions = new HashSet<>(); + rejectedVersions.add('4.0.561.0') + rejectedVersions.add('4.0.559.2') while (selectedServers.size() < 50) { def serverFile = resolveOtherServer(rejectedVersions) def attributes = getAttributesFromJar(serverFile) From 8d73c93a426e3cd4e6f909024f311e7b85beb91a Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Tue, 4 Mar 2025 11:04:18 +0000 Subject: [PATCH 41/62] fix up standard-tests-proto.yamsql to allow force_continuations on it --- .../standard-tests-proto.metrics.binpb | Bin 0 -> 7052 bytes .../standard-tests-proto.metrics.yaml | 47 ++++++++++++++++++ .../resources/standard-tests-proto.yamsql | 19 ++++++- 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 yaml-tests/src/test/resources/standard-tests-proto.metrics.binpb create mode 100644 yaml-tests/src/test/resources/standard-tests-proto.metrics.yaml diff --git a/yaml-tests/src/test/resources/standard-tests-proto.metrics.binpb b/yaml-tests/src/test/resources/standard-tests-proto.metrics.binpb new file mode 100644 index 0000000000000000000000000000000000000000..cb21c4fc4e9c12a1b8468f4a18392cd16a51d4e6 GIT binary patch literal 7052 zcmeHLL2nyH6viMyYB)qelqekfv?|fMN?LpEM5d0dxT%{)avc-96ckz3cz3c{b-c5g zod_Jr9R%tHdH|$y=otZ3L7cd?6{r3N+A{>HrwW9aS+AXSFlk)k)TNc|mEU-0=gqh8 zee=C{fTEn|3H^$X{|S2FpND4U_cD3`aGBp+=d3Sz3uIpkqQ> zW~^zt4$>{#Z2#>b!|?2+l9}O5d<{UvGVQcN@CsKlMTQMaM;yZ$i*U?lPH-b5F7nnc zw_iA$Tgt&&;z8RFJm!SwcP0ZmB~&ok zldxQlRRR-wflWpj?u;~%6|1~P)^Rhmyj=ZH(H4ivj2Ci#C<``dXd-QQ#CnSt{$(x1 z7!{<2jI?4?R!2kuZ-^s{$RS(!D>+1|QNG%abFp%OI>zmq>!j8a8J|m(wS=IHW;*Wh zsz!-~W#66Jys@7&-em3$GWTixo6zuAU*C(4&cUA_efzqg@%uk*^-ANK_Jq**bXOV= zZ2uv%>nV*(^6G_;`i$698uv8ULy3lgqw(o&8lOIJ8vpIp@J3LL*LSFKA+4*@;J?E<~M@;UZ{oi5%a_5TWcc5@SpKs08 zDI(a_ag|WpRIA6UQSq5*7Xwk!Ua$3}v1_k97A3)3NQfYqqjhJUBW}?LDOwN8PB_+L z+8zKIoYO_bKwCQXx!~#*-J=3aSX}aAZ;$}<)5C|Y?*~kYGmPq@l!dHmGHi;9HGoF9 zT48Q6pU=&eyJvM^?jt^?tIo9Z`odnoU9L7RwK zF12NWy6Z7CSWvbIaJt_hJ_!}S-?H=T?wGc%*kam2OE!RnY(xYY+IK4+-F7Q3+ldF- z5CE8xZUyMhcPqK=m1yi8v{Td4DM=*V7jD&Q``#as&B?A!n@1Zwo1YAYc~I}0JM{jZ zy6?LQebJ~A0$ldyJC**YFNmi6 FzX7mQ>+}Es literal 0 HcmV?d00001 diff --git a/yaml-tests/src/test/resources/standard-tests-proto.metrics.yaml b/yaml-tests/src/test/resources/standard-tests-proto.metrics.yaml new file mode 100644 index 0000000000..a05e55caad --- /dev/null +++ b/yaml-tests/src/test/resources/standard-tests-proto.metrics.yaml @@ -0,0 +1,47 @@ +unnamed-2: +- query: EXPLAIN select * from (select * from (select * from T1) as x where ID = + 5) as y; + explain: SCAN(<,>) | FILTER _.ID EQUALS promote(@c19 AS LONG) + task_count: 178 + task_total_time_ms: 108 + transform_count: 66 + transform_time_ms: 77 + transform_yield_count: 12 + insert_time_ms: 4 + insert_new_count: 9 + insert_reused_count: 1 +- query: EXPLAIN select * from (select * from (select * from T1) as x) as y where + ID = 5; + explain: SCAN(<,>) | FILTER _.ID EQUALS promote(@c22 AS LONG) + task_count: 175 + task_total_time_ms: 102 + transform_count: 67 + transform_time_ms: 78 + transform_yield_count: 12 + insert_time_ms: 3 + insert_new_count: 9 + insert_reused_count: 1 +- query: EXPLAIN select count(*) from (select * from (select * from (select * from + T1 where ID = 5) as x) as y) as z; + explain: SCAN([EQUALS promote(@c23 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) + AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) + AS _0) + task_count: 395 + task_total_time_ms: 106 + transform_count: 142 + transform_time_ms: 65 + transform_yield_count: 22 + insert_time_ms: 3 + insert_new_count: 31 + insert_reused_count: 1 +- query: EXPLAIN select * from (select * from (select * from (select * from T1 where + ID > 10) as x) as y) as z; + explain: SCAN([[GREATER_THAN promote(@c20 AS LONG)]]) + task_count: 277 + task_total_time_ms: 119 + transform_count: 100 + transform_time_ms: 86 + transform_yield_count: 19 + insert_time_ms: 2 + insert_new_count: 16 + insert_reused_count: 0 diff --git a/yaml-tests/src/test/resources/standard-tests-proto.yamsql b/yaml-tests/src/test/resources/standard-tests-proto.yamsql index e8c1c0ecac..fdb5f40435 100644 --- a/yaml-tests/src/test/resources/standard-tests-proto.yamsql +++ b/yaml-tests/src/test/resources/standard-tests-proto.yamsql @@ -51,17 +51,34 @@ test_block: tests: - - query: select * from (select * from (select * from T1) as x where ID = 5) as y; + - explain: "SCAN(<,>) | FILTER _.ID EQUALS promote(@c19 AS LONG)" - result: [{ID: !l 5, !l 10, !l 5}] - - query: select * from (select * from (select * from T1) as x) as y where ID = 5; + - explain: "SCAN(<,>) | FILTER _.ID EQUALS promote(@c22 AS LONG)" - result: [{ID: !l 5, !l 10, !l 5}] # 4.1 Triage: [Deferred: Client checks for End] failed when running with forced continuations (Received continuation shouldn't be at beginning) - - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; - - maxRows: 0 + - supported_version: !current_version + - explain: "SCAN([EQUALS promote(@c23 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - result: [{!l 1}] + - + # Copy of above query to simulate force continuations mode, which does not work prior to !current_version due to + # https://github.com/FoundationDB/fdb-record-layer/issues/3096. Can remove once we no longer with testing mixed-mode + # capabilities with versions older than !current_version + - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 1}] + - result: [{!l 0}] + - result: [{!l 1}] + - initialVersionAtLeast: !current_version + - result: [{!l 1}] + - result: [] - - query: select * from (select * from (select * from (select * from T1 where ID > 10) as x) as y) as z; + - explain: "SCAN([[GREATER_THAN promote(@c20 AS LONG)]])" - result: [{ID: !l 11, !l 20, !l 11}, {ID: !l 12, !l 20, !l 12}, {ID: !l 13, !l 20, !l 13}] --- setup: From e967f670567d4a74f8fcd95135cd00c02319bb8b Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Tue, 4 Mar 2025 11:11:51 +0000 Subject: [PATCH 42/62] fix up standard-tests.yamsql --- .../resources/standard-tests.metrics.binpb | 92 +++++++++++++++++++ .../resources/standard-tests.metrics.yaml | 74 +++++++++++++++ .../src/test/resources/standard-tests.yamsql | 21 ++++- 3 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 yaml-tests/src/test/resources/standard-tests.metrics.binpb create mode 100644 yaml-tests/src/test/resources/standard-tests.metrics.yaml diff --git a/yaml-tests/src/test/resources/standard-tests.metrics.binpb b/yaml-tests/src/test/resources/standard-tests.metrics.binpb new file mode 100644 index 0000000000..fbaf83bdc7 --- /dev/null +++ b/yaml-tests/src/test/resources/standard-tests.metrics.binpb @@ -0,0 +1,92 @@ + + +standard-testsnEXPLAIN select id, case when col1 = 10 then 100 when col2 in (6,7,8,9) then 200 else 300 end as NEWCOL from T1 +G ľ(08@ISCAN(I1 <,>) | MAP (_.ID AS ID, pick(ConditionSelector(_.COL1 equals @c8, _.COL2 IN promote(@c14 AS ARRAY(LONG)), TRUE), @c10, @c24, @c26) AS NEWCOL) +digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q2.ID AS ID, pick(ConditionSelector(q2.COL1 equals @c8, q2.COL2 IN promote(@c14 AS ARRAY(LONG)), TRUE), @c10, @c24, @c26) AS NEWCOL)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +w +standard-testseEXPLAIN select id, case when col1 = 10 then 100 when col2 in (6,7,8,9) then 200 end as NEWCOL from T1 +G (08@ISCAN(I1 <,>) | MAP (_.ID AS ID, pick(ConditionSelector(_.COL1 equals @c8, _.COL2 IN promote(@c14 AS ARRAY(LONG))), @c10, @c24) AS NEWCOL) +digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q2.ID AS ID, pick(ConditionSelector(q2.COL1 equals @c8, q2.COL2 IN promote(@c14 AS ARRAY(LONG))), @c10, @c24) AS NEWCOL)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +b +standard-testsPEXPLAIN select * from (select * from (select * from T1) as x where ID = 5) as y; +Ζ:m +(0Ŀ8@aCOVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID EQUALS promote(@c19 AS LONG) | FETCH digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, )" ]; + 2 [ label=<
Predicate Filter
WHERE q38.ID EQUALS promote(@c19 AS LONG)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 4 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q38> label="q38" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q40> label="q40" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +b +standard-testsPEXPLAIN select * from (select * from (select * from T1) as x) as y where ID = 5; +ȱ +p (058@aCOVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID EQUALS promote(@c22 AS LONG) | FETCH digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, )" ]; + 2 [ label=<
Predicate Filter
WHERE q38.ID EQUALS promote(@c22 AS LONG)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 4 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q38> label="q38" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q40> label="q40" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} + +standard-testsmEXPLAIN select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; +B .(-08L@COVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID EQUALS promote(@c23 AS LONG) | FETCH | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q12._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q12 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count_star(*) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q8 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Predicate Filter
WHERE q38.ID EQUALS promote(@c23 AS LONG)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 8 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q59> label="q59" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q40> label="q40" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q38> label="q38" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +y +standard-testsgEXPLAIN select * from (select * from (select * from (select * from T1 where ID > 10) as x) as y) as z; +@ /('081@gCOVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID GREATER_THAN promote(@c20 AS LONG) | FETCH digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, )" ]; + 2 [ label=<
Predicate Filter
WHERE q34.ID GREATER_THAN promote(@c20 AS LONG)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 4 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q34> label="q34" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q36> label="q36" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} \ No newline at end of file diff --git a/yaml-tests/src/test/resources/standard-tests.metrics.yaml b/yaml-tests/src/test/resources/standard-tests.metrics.yaml new file mode 100644 index 0000000000..46d3609a3c --- /dev/null +++ b/yaml-tests/src/test/resources/standard-tests.metrics.yaml @@ -0,0 +1,74 @@ +standard-tests: +- query: EXPLAIN select id, case when col1 = 10 then 100 when col2 in (6,7,8,9) + then 200 else 300 end as NEWCOL from T1 + explain: ISCAN(I1 <,>) | MAP (_.ID AS ID, pick(ConditionSelector(_.COL1 equals + @c8, _.COL2 IN promote(@c14 AS ARRAY(LONG)), TRUE), @c10, @c24, @c26) AS NEWCOL) + task_count: 213 + task_total_time_ms: 66 + transform_count: 71 + transform_time_ms: 38 + transform_yield_count: 22 + insert_time_ms: 4 + insert_new_count: 21 + insert_reused_count: 3 +- query: EXPLAIN select id, case when col1 = 10 then 100 when col2 in (6,7,8,9) + then 200 end as NEWCOL from T1 + explain: ISCAN(I1 <,>) | MAP (_.ID AS ID, pick(ConditionSelector(_.COL1 equals + @c8, _.COL2 IN promote(@c14 AS ARRAY(LONG))), @c10, @c24) AS NEWCOL) + task_count: 213 + task_total_time_ms: 66 + transform_count: 71 + transform_time_ms: 39 + transform_yield_count: 22 + insert_time_ms: 3 + insert_new_count: 21 + insert_reused_count: 3 +- query: EXPLAIN select * from (select * from (select * from T1) as x where ID = + 5) as y; + explain: 'COVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID EQUALS + promote(@c19 AS LONG) | FETCH' + task_count: 350 + task_total_time_ms: 122 + transform_count: 109 + transform_time_ms: 90 + transform_yield_count: 30 + insert_time_ms: 4 + insert_new_count: 31 + insert_reused_count: 4 +- query: EXPLAIN select * from (select * from (select * from T1) as x) as y where + ID = 5; + explain: 'COVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID EQUALS + promote(@c22 AS LONG) | FETCH' + task_count: 344 + task_total_time_ms: 21 + transform_count: 112 + transform_time_ms: 6 + transform_yield_count: 30 + insert_time_ms: 0 + insert_new_count: 31 + insert_reused_count: 5 +- query: EXPLAIN select count(*) from (select * from (select * from (select * from + T1 where ID = 5) as x) as y) as z; + explain: 'COVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID EQUALS + promote(@c23 AS LONG) | FETCH | MAP (_ AS _0) | AGG (count_star(*) AS _0) + | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)' + task_count: 704 + task_total_time_ms: 139 + transform_count: 212 + transform_time_ms: 97 + transform_yield_count: 45 + insert_time_ms: 7 + insert_new_count: 76 + insert_reused_count: 5 +- query: EXPLAIN select * from (select * from (select * from (select * from T1 where + ID > 10) as x) as y) as z; + explain: 'COVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID GREATER_THAN + promote(@c20 AS LONG) | FETCH' + task_count: 555 + task_total_time_ms: 135 + transform_count: 164 + transform_time_ms: 100 + transform_yield_count: 39 + insert_time_ms: 5 + insert_new_count: 49 + insert_reused_count: 4 diff --git a/yaml-tests/src/test/resources/standard-tests.yamsql b/yaml-tests/src/test/resources/standard-tests.yamsql index 9f61b78fbb..806a8e00a7 100644 --- a/yaml-tests/src/test/resources/standard-tests.yamsql +++ b/yaml-tests/src/test/resources/standard-tests.yamsql @@ -47,6 +47,7 @@ test_block: when col2 in (6,7,8,9) then 200 else 300 end as NEWCOL from T1 + - explain: "ISCAN(I1 <,>) | MAP (_.ID AS ID, pick(ConditionSelector(_.COL1 equals @c8, _.COL2 IN promote(@c14 AS ARRAY(LONG)), TRUE), @c10, @c24, @c26) AS NEWCOL)" - result: [{ID: 1, NEWCOL: 100}, {ID: 2, NEWCOL: 100}, {ID: 3, NEWCOL: 100}, @@ -64,6 +65,7 @@ test_block: - query: select id, case when col1 = 10 then 100 when col2 in (6,7,8,9) then 200 end as NEWCOL from T1 + - explain: "ISCAN(I1 <,>) | MAP (_.ID AS ID, pick(ConditionSelector(_.COL1 equals @c8, _.COL2 IN promote(@c14 AS ARRAY(LONG))), @c10, @c24) AS NEWCOL)" - result: [{ID: 1, NEWCOL: 100}, {ID: 2, NEWCOL: 100}, {ID: 3, NEWCOL: 100}, @@ -79,16 +81,33 @@ test_block: {ID: 13, NEWCOL: !null x} ] - - query: select * from (select * from (select * from T1) as x where ID = 5) as y; + - explain: "COVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID EQUALS promote(@c19 AS LONG) | FETCH" - result: [{ID: !l 5, !l 10, !l 5}] - - query: select * from (select * from (select * from T1) as x) as y where ID = 5; + - explain: "COVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID EQUALS promote(@c22 AS LONG) | FETCH" - result: [{ID: !l 5, !l 10, !l 5}] - # 4.1 Triage: [Deferred: Client checks for End] Failed running with forced continuations: (Received continuation shouldn't be at beginning) - - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; + - supported_version: !current_version + - explain: "COVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID EQUALS promote(@c23 AS LONG) | FETCH | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - maxRows: 0 - result: [{!l 1}] + - + # Copy of above query to simulate force continuations mode, which does not work prior to !current_version due to + # https://github.com/FoundationDB/fdb-record-layer/issues/3096. Can remove once we no longer with testing mixed-mode + # capabilities with versions older than !current_version + - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 1}] + - result: [{!l 0}] + - result: [{!l 1}] + - initialVersionAtLeast: !current_version + - result: [{!l 1}] + - result: [] - - query: select * from (select * from (select * from (select * from T1 where ID > 10) as x) as y) as z; + - explain: "COVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID GREATER_THAN promote(@c20 AS LONG) | FETCH" - result: [{ID: !l 11, !l 20, !l 11}, {ID: !l 12, !l 20, !l 12}, {ID: !l 13, !l 20, !l 13}] ... From 9b41439051cf6fde9d130a422df6ed43a9b07dfe Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Tue, 4 Mar 2025 11:29:27 +0000 Subject: [PATCH 43/62] require !current_version on create-drop.yamsql --- .../test/resources/create-drop.metrics.binpb | 69 +++++ .../test/resources/create-drop.metrics.yaml | 41 +++ .../src/test/resources/create-drop.yamsql | 267 +++++++----------- 3 files changed, 219 insertions(+), 158 deletions(-) create mode 100644 yaml-tests/src/test/resources/create-drop.metrics.binpb create mode 100644 yaml-tests/src/test/resources/create-drop.metrics.yaml diff --git a/yaml-tests/src/test/resources/create-drop.metrics.binpb b/yaml-tests/src/test/resources/create-drop.metrics.binpb new file mode 100644 index 0000000000..285dcfbaaa --- /dev/null +++ b/yaml-tests/src/test/resources/create-drop.metrics.binpb @@ -0,0 +1,69 @@ + +S + unnamed-4FEXPLAIN select count(*) from "TEMPLATES" where template_name = 'TEMP1' +ũ7j ʕ%(08@SCAN(<,>) | TFILTER TEMPLATES | FILTER _.TEMPLATE_NAME EQUALS promote(@c11 AS STRING) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count_star(*) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q23 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS TEMPLATE_NAME, AS _0)" ]; + 5 [ label=<
Predicate Filter
WHERE q2.TEMPLATE_NAME EQUALS promote(@c11 AS STRING)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS TEMPLATE_NAME, )" ]; + 6 [ label=<
Type Filter
WHERE record IS [TEMPLATES]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS TEMPLATE_NAME, )" ]; + 7 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Primary Storage
record types: [DATABASES, SCHEMAS, TEMPLATES]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q32> label="q32" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +T + +unnamed-10FEXPLAIN select count(*) from "DATABASES" where database_id = '/FRL/DB' +s ۟ (0i8@SCAN(<,>) | TFILTER DATABASES | FILTER _.DATABASE_ID EQUALS promote(@c11 AS STRING) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count_star(*) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q31 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS DATABASE_ID AS _0)" ]; + 5 [ label=<
Predicate Filter
WHERE q2.DATABASE_ID EQUALS promote(@c11 AS STRING)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS DATABASE_ID)" ]; + 6 [ label=<
Type Filter
WHERE record IS [DATABASES]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS DATABASE_ID)" ]; + 7 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Primary Storage
record types: [DATABASES, SCHEMAS, TEMPLATES]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q40> label="q40" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q31> label="q31" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q27> label="q27" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +R + +unnamed-20DEXPLAIN select count(*) from "SCHEMAS" where database_id = '/FRL/DB' +› (*08O@COVERING(TEMPLATES_VALUE_INDEX <,> -> [DATABASE_ID: KEY[2], SCHEMA_NAME: KEY[3], TEMPLATE_NAME: KEY[0], TEMPLATE_VERSION: KEY[1]]) | FILTER _.DATABASE_ID EQUALS promote(@c11 AS STRING) | FETCH | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count_star(*) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q43 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS DATABASE_ID, AS _0)" ]; + 5 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(STRING AS DATABASE_ID, )" ]; + 6 [ label=<
Predicate Filter
WHERE q48.DATABASE_ID EQUALS promote(@c11 AS STRING)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS DATABASE_ID, )" ]; + 7 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS DATABASE_ID, )" ]; + 8 [ label=<
Index
TEMPLATES_VALUE_INDEX
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS DATABASE_ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q72> label="q72" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q43> label="q43" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q50> label="q50" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q48> label="q48" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} \ No newline at end of file diff --git a/yaml-tests/src/test/resources/create-drop.metrics.yaml b/yaml-tests/src/test/resources/create-drop.metrics.yaml new file mode 100644 index 0000000000..c88ec478f9 --- /dev/null +++ b/yaml-tests/src/test/resources/create-drop.metrics.yaml @@ -0,0 +1,41 @@ +unnamed-4: +- query: EXPLAIN select count(*) from "TEMPLATES" where template_name = 'TEMP1' + explain: SCAN(<,>) | TFILTER TEMPLATES | FILTER _.TEMPLATE_NAME EQUALS promote(@c11 + AS STRING) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP + (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) + task_count: 335 + task_total_time_ms: 116 + transform_count: 106 + transform_time_ms: 77 + transform_yield_count: 17 + insert_time_ms: 5 + insert_new_count: 28 + insert_reused_count: 2 +unnamed-10: +- query: EXPLAIN select count(*) from "DATABASES" where database_id = '/FRL/DB' + explain: SCAN(<,>) | TFILTER DATABASES | FILTER _.DATABASE_ID EQUALS promote(@c11 + AS STRING) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP + (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) + task_count: 353 + task_total_time_ms: 38 + transform_count: 115 + transform_time_ms: 28 + transform_yield_count: 26 + insert_time_ms: 1 + insert_new_count: 28 + insert_reused_count: 2 +unnamed-20: +- query: EXPLAIN select count(*) from "SCHEMAS" where database_id = '/FRL/DB' + explain: 'COVERING(TEMPLATES_VALUE_INDEX <,> -> [DATABASE_ID: KEY[2], SCHEMA_NAME: + KEY[3], TEMPLATE_NAME: KEY[0], TEMPLATE_VERSION: KEY[1]]) | FILTER _.DATABASE_ID + EQUALS promote(@c11 AS STRING) | FETCH | MAP (_ AS _0) | AGG (count_star(*) + AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) + AS _0)' + task_count: 623 + task_total_time_ms: 60 + transform_count: 177 + transform_time_ms: 29 + transform_yield_count: 42 + insert_time_ms: 3 + insert_new_count: 79 + insert_reused_count: 3 diff --git a/yaml-tests/src/test/resources/create-drop.yamsql b/yaml-tests/src/test/resources/create-drop.yamsql index 5602266553..4668557c36 100644 --- a/yaml-tests/src/test/resources/create-drop.yamsql +++ b/yaml-tests/src/test/resources/create-drop.yamsql @@ -16,7 +16,14 @@ # 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. - +--- +options: + # Prior to !current_version, these tests did not work in force_continuations mode due to + # https://github.com/FoundationDB/fdb-record-layer/pull/3211. This would result in looping + # continuations. We have coverage of similar queries in other files, (see: + # aggregate-index-tests.yamsql, aggregate-empty-count.yamsql, aggregate-empty.yamsql), so for + # this file, just require the version is at least !current_version + supported_version: !current_version --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" @@ -44,120 +51,87 @@ setup: - query: drop database if exists /frl/DB - query: create schema template temp1 create table T1(a1 bigint, primary key(a1)) -# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations for all versions with: -# Received continuation shouldn't be at beginning -#--- -#test_block: -# connect: "jdbc:embed:/__SYS?schema=CATALOG" -# preset: single_repetition_ordered -# tests: -# - -# - query: select count(*) from "TEMPLATES" where template_name = 'TEMP1' -# - result: [{1}] +--- +test_block: + connect: "jdbc:embed:/__SYS?schema=CATALOG" + preset: single_repetition_ordered + tests: + - + - query: select count(*) from "TEMPLATES" where template_name = 'TEMP1' + - explain: "SCAN(<,>) | TFILTER TEMPLATES | FILTER _.TEMPLATE_NAME EQUALS promote(@c11 AS STRING) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - result: [{1}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop schema template temp1 -# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations (Does not fail with SNAPSHOT) -# Embedded -> 4.0.559.6: -# Received continuation shouldn't be at beginning -# 4.1 Triage: fails with force continuations (Does not fail with SNAPSHOT) -# 4.0.559.6 -> Embedded: -# expected: but was: -# org.opentest4j.AssertionFailedError: expected: but was: -# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementWithForcedContinuations(QueryExecutor.java:258) -# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementAndCheckForceContinuations(QueryExecutor.java:219) -#--- -#test_block: -# connect: "jdbc:embed:/__SYS?schema=CATALOG" -# preset: single_repetition_ordered -# tests: -# - -# - query: select count(*) from "TEMPLATES" where template_name = 'TEMP1' -# - result: [{0}] +--- +test_block: + connect: "jdbc:embed:/__SYS?schema=CATALOG" + preset: single_repetition_ordered + tests: + - + - query: select count(*) from "TEMPLATES" where template_name = 'TEMP1' + - result: [{0}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create schema template temp2 create table T1(a1 bigint, primary key(a1)) -# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations for all versions (including SNAPSHOT): -# Received continuation shouldn't be at beginning -#--- -#test_block: -# connect: "jdbc:embed:/__SYS?schema=CATALOG" -# preset: single_repetition_ordered -# tests: -# - -# - query: select count(*) from "TEMPLATES" where template_name = 'TEMP2' -# - result: [{1}] +--- +test_block: + connect: "jdbc:embed:/__SYS?schema=CATALOG" + preset: single_repetition_ordered + tests: + - + - query: select count(*) from "TEMPLATES" where template_name = 'TEMP2' + - result: [{1}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create database /frl/db -# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations for all versions (including SNAPSHOT): -# Received continuation shouldn't be at beginning -#--- -#test_block: -# connect: "jdbc:embed:/__SYS?schema=CATALOG" -# preset: single_repetition_ordered -# tests: -# - -# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' -# - result: [{1}] +--- +test_block: + connect: "jdbc:embed:/__SYS?schema=CATALOG" + preset: single_repetition_ordered + tests: + - + - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' + - explain: "SCAN(<,>) | TFILTER DATABASES | FILTER _.DATABASE_ID EQUALS promote(@c11 AS STRING) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - result: [{1}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database /frl/db -# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations (but not for snapshot) -# Embedded -> 4.0.559.6: -# Received continuation shouldn't be at beginning -# 4.1 triage: Fails with force continuations (but not for snapshot) -# 4.0.559.6 -> Embedded: -# expected: but was: -# org.opentest4j.AssertionFailedError: expected: but was: -# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementWithForcedContinuations(QueryExecutor.java:258) -# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementAndCheckForceContinuations(QueryExecutor.java:219) -#--- -#test_block: -# connect: "jdbc:embed:/__SYS?schema=CATALOG" -# preset: single_repetition_ordered -# tests: -# - -# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' -# - result: [{0}] +--- +test_block: + connect: "jdbc:embed:/__SYS?schema=CATALOG" + preset: single_repetition_ordered + tests: + - + - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' + - result: [{0}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create database /frl/db -# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations for all versions (including SNAPSHOT): -# Received continuation shouldn't be at beginning -#--- -#test_block: -# connect: "jdbc:embed:/__SYS?schema=CATALOG" -# preset: single_repetition_ordered -# tests: -# - -# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' -# - result: [{1}] +--- +test_block: + connect: "jdbc:embed:/__SYS?schema=CATALOG" + preset: single_repetition_ordered + tests: + - + - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' + - result: [{1}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database if exists /frl/db -# 4.1 triage: [Initial version] Fails with force continuations (but not for snapshot) -# Embedded -> 4.0.559.6: -# expected: but was: -# org.opentest4j.AssertionFailedError: expected: but was: -# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementWithForcedContinuations(QueryExecutor.java:258) -# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementAndCheckForceContinuations(QueryExecutor.java:219) -# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations (but not for snapshot) -# 4.0.559.6 -> Embedded: -# Received continuation shouldn't be at beginning -#--- +--- test_block: connect: "jdbc:embed:/__SYS?schema=CATALOG" preset: single_repetition_ordered @@ -171,56 +145,44 @@ setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create database /frl/db -# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations for all versions (including SNAPSHOT): -# Received continuation shouldn't be at beginning -#--- -#test_block: -# connect: "jdbc:embed:/__SYS?schema=CATALOG" -# preset: single_repetition_ordered -# tests: -# - -# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' -# - result: [{1}] +--- +test_block: + connect: "jdbc:embed:/__SYS?schema=CATALOG" + preset: single_repetition_ordered + tests: + - + - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' + - result: [{1}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: create schema /frl/db/s1 with template temp2 -# 4.1 triage: [Deferred: Client checks for End] Fails with force continuations for all versions (including SNAPSHOT): -# Received continuation shouldn't be at beginning -#--- -#test_block: -# connect: "jdbc:embed:/__SYS?schema=CATALOG" -# preset: single_repetition_ordered -# tests: -# - -# - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' -# - result: [{1}] +--- +test_block: + connect: "jdbc:embed:/__SYS?schema=CATALOG" + preset: single_repetition_ordered + tests: + - + - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' + - explain: "COVERING(TEMPLATES_VALUE_INDEX <,> -> [DATABASE_ID: KEY[2], SCHEMA_NAME: KEY[3], TEMPLATE_NAME: KEY[0], TEMPLATE_VERSION: KEY[1]]) | FILTER _.DATABASE_ID EQUALS promote(@c11 AS STRING) | FETCH | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - result: [{1}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database /frl/db -# 4.1 triage: [Deferred: Client checks for End] Both queries fail with force continuations (but not for snapshot) -# Embedded -> 4.0.559.6: -# Received continuation shouldn't be at beginning -# 4.1 triage: Both queries fail with force continuations (but not for snapshot) -# 4.0.559.6 -> Embedded: -# expected: but was: -# org.opentest4j.AssertionFailedError: expected: but was: -# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementWithForcedContinuations(QueryExecutor.java:258) -# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementAndCheckForceContinuations(QueryExecutor.java:219) -#--- -#test_block: -# connect: "jdbc:embed:/__SYS?schema=CATALOG" -# preset: single_repetition_ordered -# tests: -# - -# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' -# - result: [{0}] -# - -# - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' -# - result: [{0}] +--- +test_block: + connect: "jdbc:embed:/__SYS?schema=CATALOG" + preset: single_repetition_ordered + tests: + - + - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' + - result: [{0}] + - + - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' + - result: [{0}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" @@ -229,44 +191,33 @@ setup: - query: create database /frl/db - query: create schema /frl/db/s1 with template temp2 - query: create schema /frl/db/s2 with template temp2 -# 4.1 triage: [Deferred: Client checks for End] Both queries fail with force continuations for all versions (including SNAPSHOT): -# Received continuation shouldn't be at beginning -#--- -#test_block: -# connect: "jdbc:embed:/__SYS?schema=CATALOG" -# preset: single_repetition_ordered -# tests: -# - -# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' -# - result: [{1}] -# - -# - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' -# - result: [{2}] +--- +test_block: + connect: "jdbc:embed:/__SYS?schema=CATALOG" + preset: single_repetition_ordered + tests: + - + - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' + - result: [{1}] + - + - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' + - result: [{2}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" steps: - query: drop database /frl/db -# 4.1 triage: [Deferred: Client checks for End] Both queries fail with force continuations (but not for snapshot) -# Embedded -> 4.0.559.6: -# Received continuation shouldn't be at beginning -# 4.1 triage: Both queries fail with force continuations (but not for snapshot) -# 4.0.559.6 -> Embedded: -# expected: but was: -# org.opentest4j.AssertionFailedError: expected: but was: -# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementWithForcedContinuations(QueryExecutor.java:258) -# at app//com.apple.foundationdb.relational.yamltests.command.QueryExecutor.executeStatementAndCheckForceContinuations(QueryExecutor.java:219) -#--- -#test_block: -# connect: "jdbc:embed:/__SYS?schema=CATALOG" -# preset: single_repetition_ordered -# tests: -# - -# - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' -# - result: [{0}] -# - -# - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' -# - result: [{0}] +--- +test_block: + connect: "jdbc:embed:/__SYS?schema=CATALOG" + preset: single_repetition_ordered + tests: + - + - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' + - result: [{0}] + - + - query: select count(*) from "SCHEMAS" where database_id = '/FRL/DB' + - result: [{0}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" From d2004d437800e55fa73578f27708f5e7818d345f Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Tue, 4 Mar 2025 11:43:59 +0000 Subject: [PATCH 44/62] update field-index-tests-proto.yamsql to allow for force continuations testing --- .../field-index-tests-proto.metrics.binpb | 55 +++++++++++++++++++ .../field-index-tests-proto.metrics.yaml | 36 ++++++++++++ .../resources/field-index-tests-proto.yamsql | 51 +++++++++++++++-- 3 files changed, 136 insertions(+), 6 deletions(-) create mode 100644 yaml-tests/src/test/resources/field-index-tests-proto.metrics.binpb create mode 100644 yaml-tests/src/test/resources/field-index-tests-proto.metrics.yaml diff --git a/yaml-tests/src/test/resources/field-index-tests-proto.metrics.binpb b/yaml-tests/src/test/resources/field-index-tests-proto.metrics.binpb new file mode 100644 index 0000000000..f9cc1bc266 --- /dev/null +++ b/yaml-tests/src/test/resources/field-index-tests-proto.metrics.binpb @@ -0,0 +1,55 @@ + + +field-index-tests-prototEXPLAIN select count(*) from (select * from (select * from (select * from "MyTable" where ID = 5) as x) as y) as z; +0 $(08@SCAN([EQUALS promote(@c23 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q12._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q12 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count_star(*) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q8 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Scan
comparisons: [EQUALS promote(@c23 AS LONG)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Primary Storage
record types: [MyTable]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q30> label="q30" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +C +field-index-tests-proto(EXPLAIN select sum(COL1) from "MyTable"; +ȝ1W &(08@^SCAN(<,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q23._0.COL1) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Primary Storage
record types: [MyTable]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +E +field-index-tests-proto*EXPLAIN select count(COL1) from "MyTable"; +ÿW (0Ŏ8@SCAN(<,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count(q23._0.COL1) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Primary Storage
record types: [MyTable]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} \ No newline at end of file diff --git a/yaml-tests/src/test/resources/field-index-tests-proto.metrics.yaml b/yaml-tests/src/test/resources/field-index-tests-proto.metrics.yaml new file mode 100644 index 0000000000..e1bd65c7c6 --- /dev/null +++ b/yaml-tests/src/test/resources/field-index-tests-proto.metrics.yaml @@ -0,0 +1,36 @@ +field-index-tests-proto: +- query: EXPLAIN select count(*) from (select * from (select * from (select * from + "MyTable" where ID = 5) as x) as y) as z; + explain: SCAN([EQUALS promote(@c23 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) + AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) + AS _0) + task_count: 395 + task_total_time_ms: 100 + transform_count: 142 + transform_time_ms: 76 + transform_yield_count: 22 + insert_time_ms: 2 + insert_new_count: 31 + insert_reused_count: 1 +- query: EXPLAIN select sum(COL1) from "MyTable"; + explain: SCAN(<,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL + | MAP (_._0._0 AS _0) + task_count: 249 + task_total_time_ms: 102 + transform_count: 87 + transform_time_ms: 80 + transform_yield_count: 15 + insert_time_ms: 6 + insert_new_count: 20 + insert_reused_count: 2 +- query: EXPLAIN select count(COL1) from "MyTable"; + explain: SCAN(<,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) | ON EMPTY NULL + | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) + task_count: 249 + task_total_time_ms: 15 + transform_count: 87 + transform_time_ms: 5 + transform_yield_count: 15 + insert_time_ms: 2 + insert_new_count: 20 + insert_reused_count: 2 diff --git a/yaml-tests/src/test/resources/field-index-tests-proto.yamsql b/yaml-tests/src/test/resources/field-index-tests-proto.yamsql index a42d715f72..c4a8f202f7 100644 --- a/yaml-tests/src/test/resources/field-index-tests-proto.yamsql +++ b/yaml-tests/src/test/resources/field-index-tests-proto.yamsql @@ -56,24 +56,63 @@ test_block: - - query: select * from (select * from (select * from "MyTable") as x) as y where ID = 5; - result: [{ID: !l 5, COL1: !l 10, COL31: !l 5, COL32: !null _, COL2: !l 5}] - # 4.1 Triage: [Deferred: Client checks for End] failed when running with forced continuations (Received continuation shouldn't be at beginning) - - query: select count(*) from (select * from (select * from (select * from "MyTable" where ID = 5) as x) as y) as z; - - maxRows: 0 + - supported_version: !current_version + - explain: "SCAN([EQUALS promote(@c23 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - result: [{!l 1}] + - + # Copy of above query to simulate force continuations mode, which doesn't work prior to !current_version + # due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + # Can remove when we no longer care about supported mixed mode testing with prior versions + - query: select count(*) from (select * from (select * from (select * from "MyTable" where ID = 5) as x) as y) as z; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 1}] + - result: [{!l 0}] + - result: [{!l 1}] # ad infinitum + - initialVersionAtLeast: !current_version + - result: [{!l 1}] + - result: [] - - query: select COL31, COL32 from (select * from (select * from "MyTable") as x) as y where ID = 5; - result: [{COL31: !l 5, COL32: !null _}] - # 4.1 Triage: [Deferred: Client checks for End] failed when running with forced continuations (Received continuation shouldn't be at beginning) - - query: select sum(COL1) from "MyTable"; - - maxRows: 0 + - supported_version: !current_version + - explain: "SCAN(<,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" + - result: [{!l 210}] + - + # Copy of above query to simulate force continuations mode, which doesn't work prior to !current_version + # due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + # Can remove when we no longer care about supported mixed mode testing with prior versions + - query: select sum(COL1) from "MyTable"; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 210}] + - result: [{!null _}] + - result: [{!l 210}] # ad infinitum + - initialVersionAtLeast: !current_version - result: [{!l 210}] - # 4.1 Triage: [Deferred: Client checks for End] failed when running with forced continuations (Received continuation shouldn't be at beginning) + - result: [] + - + - query: select count(COL1) from "MyTable"; + - supported_version: !current_version + - explain: "SCAN(<,>) | MAP (_ AS _0) | AGG (count(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - result: [{!l 13}] - + # Copy of above query to simulate force continuations mode, which doesn't work prior to !current_version + # due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + # Can remove when we no longer care about supported mixed mode testing with prior versions - query: select count(COL1) from "MyTable"; - - maxRows: 0 + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 13}] + - result: [{!l 0}] + - result: [{!l 13}] # ad infinitum + - initialVersionAtLeast: !current_version - result: [{!l 13}] + - result: [] - - query: select * from (select * from (select * from (select * from "MyTable" where ID > 10) as x) as y) as z; - result: [{ID: !l 11, COL1: !l 20, COL31: !null _, COL32: !l 12, COL2: !l 11}, From 601ec197bccf85e7916101a146749fc13ed8aec9 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Tue, 4 Mar 2025 12:15:30 +0000 Subject: [PATCH 45/62] update inserts-updates-deletes.yamsql to account for new error messages --- .../resources/inserts-updates-deletes.yamsql | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql b/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql index 48444b726d..ecd35143c5 100644 --- a/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql +++ b/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql @@ -105,16 +105,22 @@ test_block: - result: [{ B1: 10, B2: 22, B3: { 5, 41 } }, { B1: 20, B2: 22, B3: { 6, 51 } }, { B1: 30, B2: 22, B3: { 7, 61 } } ] - # 4.1 Triage: [Initial version] failed when running against 4.0.559.6 ("expecting '42601' error code, got 'XXXXX' instead" and "java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1") - # - - # Case where not all values are provided of A. Still works, since the columns for which no values are provided can be nullable. - # - query: insert into A(A1, A2, A3) values (4); - # - error: "42601" - # 4.1 Triage: [Initial version] Failed when initial version is 4.0.559.6 (expecting statement to throw an error, however it returned a count) - # - - # Case when the number of values is more than the number of columns specified. - # - query: insert into A(A1, A2, A3) values (5, 6, 7, 8, 9); - # - error: "42601" + - + # Case where not all values are provided of A. Still works, since the columns for which no values are provided can be nullable. + - query: insert into A(A1, A2, A3) values (4); + - initialVersionLessThan: 4.1.5.0 + # Used to get an internal error prior to: https://github.com/FoundationDB/fdb-record-layer/pull/3070 + - error: "XXXXX" + - initialVersionAtLeast: 4.1.5.0 + - error: "42601" + - + # Case when the number of values is more than the number of columns specified. + - query: insert into A(A1, A2, A3) values (5, 6, 7, 8, 9); + - initialVersionLessThan: 4.1.5.0 + # Used to ignore extra column prior to: https://github.com/FoundationDB/fdb-record-layer/pull/3070 + - count: 1 + - initialVersionAtLeast: 4.1.5.0 + - error: "42601" - # Case when a nullable column's value is not provided - query: insert into A(A1, A3) values (6, 7); @@ -127,6 +133,13 @@ test_block: # Case when a nullable column's value is not provided and column is the last one - query: insert into A(A1, A2) values (7, 8); - count: 1 + - + # Value returned by this query depends on whether the insert a few steps up succeeded + - query: select * from A where A1 = 5 + - initialVersionLessThan: 4.1.5.0 + - result: [{ A1: 5, A2: 6, A3: 7 }] + - initialVersionAtLeast: 4.1.5.0 + - result: [] - - query: select * from A where A1 = 6 - result: [{ A1: 6, A2: !null , A3: 7 }] From 571bda68efe57a464f04cafc1fac4200a90452ff Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Tue, 4 Mar 2025 12:23:24 +0000 Subject: [PATCH 46/62] fixup null-operator-tests.yamsql --- .../null-operator-tests.metrics.binpb | 23 +++++++++++++++++++ .../null-operator-tests.metrics.yaml | 14 +++++++++++ .../test/resources/null-operator-tests.yamsql | 18 +++++++++++++-- 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 yaml-tests/src/test/resources/null-operator-tests.metrics.binpb create mode 100644 yaml-tests/src/test/resources/null-operator-tests.metrics.yaml diff --git a/yaml-tests/src/test/resources/null-operator-tests.metrics.binpb b/yaml-tests/src/test/resources/null-operator-tests.metrics.binpb new file mode 100644 index 0000000000..00391fc441 --- /dev/null +++ b/yaml-tests/src/test/resources/null-operator-tests.metrics.binpb @@ -0,0 +1,23 @@ + +v +null-operator-tests_EXPLAIN select count(*) from (select * from (select * from T1) as x where ID is not null) as y; +6 ($08:@COVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID NOT_NULL | FETCH | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q10._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q10 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count_star(*) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q6 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Predicate Filter
WHERE q42.ID NOT_NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 8 [ label=<
Index
I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q10> label="q10" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q49> label="q49" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q44> label="q44" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q10> label="q10" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} \ No newline at end of file diff --git a/yaml-tests/src/test/resources/null-operator-tests.metrics.yaml b/yaml-tests/src/test/resources/null-operator-tests.metrics.yaml new file mode 100644 index 0000000000..32497670e9 --- /dev/null +++ b/yaml-tests/src/test/resources/null-operator-tests.metrics.yaml @@ -0,0 +1,14 @@ +null-operator-tests: +- query: EXPLAIN select count(*) from (select * from (select * from T1) as x where + ID is not null) as y; + explain: 'COVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID NOT_NULL + | FETCH | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP + (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)' + task_count: 499 + task_total_time_ms: 114 + transform_count: 157 + transform_time_ms: 62 + transform_yield_count: 36 + insert_time_ms: 7 + insert_new_count: 58 + insert_reused_count: 5 diff --git a/yaml-tests/src/test/resources/null-operator-tests.yamsql b/yaml-tests/src/test/resources/null-operator-tests.yamsql index be346e02df..a68ec52cef 100644 --- a/yaml-tests/src/test/resources/null-operator-tests.yamsql +++ b/yaml-tests/src/test/resources/null-operator-tests.yamsql @@ -48,8 +48,22 @@ test_block: # 4.1 Triage: [Deferred: Client checks for End] failed when running with forced continuations (Received continuation shouldn't be at beginning) - - query: select count(*) from (select * from (select * from T1) as x where ID is not null) as y; - - maxRows: 0 - - unorderedResult: [{13}] + - supported_version: !current_version + - explain: "COVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID NOT_NULL | FETCH | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" + - result: [{13}] + - + # Copy of above query that simulates force continuations mode, which does not work prior to !current_version + # due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + # Can be removed once we no longer care about mixed-mode compatibility with versions prior to !current_version + - query: select count(*) from (select * from (select * from T1) as x where ID is not null) as y; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{13}] + - result: [{0}] + - result: [{13}] # ad infinitum + - initialVersionAtLeast: !current_version + - result: [{13}] + - result: [] # - # - query: select count(*) from (select * from (select * from T1) as x where ID != null) as y; # - unorderedResult: [{13}] From 60f8955ba4dafea1f574fdf650556eecc1e156a9 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Tue, 4 Mar 2025 13:46:34 +0000 Subject: [PATCH 47/62] fixup primary-key-tests.yamsql --- .../resources/primary-key-tests.metrics.binpb | 19 +++++++++++++++++++ .../resources/primary-key-tests.metrics.yaml | 12 ++++++++++++ .../test/resources/primary-key-tests.yamsql | 17 +++++++++++++++-- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 yaml-tests/src/test/resources/primary-key-tests.metrics.binpb create mode 100644 yaml-tests/src/test/resources/primary-key-tests.metrics.yaml diff --git a/yaml-tests/src/test/resources/primary-key-tests.metrics.binpb b/yaml-tests/src/test/resources/primary-key-tests.metrics.binpb new file mode 100644 index 0000000000..a9ff43c359 --- /dev/null +++ b/yaml-tests/src/test/resources/primary-key-tests.metrics.binpb @@ -0,0 +1,19 @@ + +4 +primary-key-testsEXPLAIN SELECT COUNT(*) FROM T1 +%W (0ܛ8@SCAN(<,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count_star(*) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, AS ID, AS _0)" ]; + 5 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, AS ID, )" ]; + 6 [ label=<
Primary Storage
record types: [T1]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} \ No newline at end of file diff --git a/yaml-tests/src/test/resources/primary-key-tests.metrics.yaml b/yaml-tests/src/test/resources/primary-key-tests.metrics.yaml new file mode 100644 index 0000000000..8f905ed66a --- /dev/null +++ b/yaml-tests/src/test/resources/primary-key-tests.metrics.yaml @@ -0,0 +1,12 @@ +primary-key-tests: +- query: EXPLAIN SELECT COUNT(*) FROM T1 + explain: SCAN(<,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL + | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) + task_count: 249 + task_total_time_ms: 78 + transform_count: 87 + transform_time_ms: 60 + transform_yield_count: 15 + insert_time_ms: 4 + insert_new_count: 20 + insert_reused_count: 2 diff --git a/yaml-tests/src/test/resources/primary-key-tests.yamsql b/yaml-tests/src/test/resources/primary-key-tests.yamsql index ebb101d7fb..5e1f59847a 100644 --- a/yaml-tests/src/test/resources/primary-key-tests.yamsql +++ b/yaml-tests/src/test/resources/primary-key-tests.yamsql @@ -31,11 +31,24 @@ test_block: VALUES ((1, 2, 3, 4), 5), ((1, 2, 30, 40), 50) - error: "23505" - # 4.1 Triage: [Deferred: Client checks for End] failed when running with forced continuations against 4.0.559.6 (Received continuation shouldn't be at beginning) - - query: SELECT COUNT(*) FROM T1 - - maxRows: 0 + - supported_version: 4.1.4.0 + - explain: "SCAN(<,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - result: [{0}] + - + # Copy of above query to simulate force_continuations on versions before 4.1.4.0 + # Older versions did not correctly handle enforcing the limit due to: https://github.com/FoundationDB/fdb-record-layer/issues/3093 + # Can be removed once we no longer care about upgrading from versions before 4.1.4.0 + - query: SELECT COUNT(*) FROM T1 + - supported_version: 4.1.4.0 + - maxRows: 1 + - initialVersionLessThan: 4.1.4.0 + - result: [{0}] + - result: [{0}] + - initialVersionAtLeast: 4.1.4.0 + - result: [{0}] + - result: [] - - query: INSERT INTO T1 VALUES ((1, 2, 3, 4), 5), From 6917a8689c5716e307c4393b066cae2952ba0976 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Tue, 4 Mar 2025 13:47:46 +0000 Subject: [PATCH 48/62] remove 4.1 triage from null-operator-tests.yamsql --- yaml-tests/src/test/resources/null-operator-tests.yamsql | 1 - 1 file changed, 1 deletion(-) diff --git a/yaml-tests/src/test/resources/null-operator-tests.yamsql b/yaml-tests/src/test/resources/null-operator-tests.yamsql index a68ec52cef..56c49c1b65 100644 --- a/yaml-tests/src/test/resources/null-operator-tests.yamsql +++ b/yaml-tests/src/test/resources/null-operator-tests.yamsql @@ -45,7 +45,6 @@ test_block: - - query: select * from (select * from (select * from T1) as x where ID is null) as y; - result: [] - # 4.1 Triage: [Deferred: Client checks for End] failed when running with forced continuations (Received continuation shouldn't be at beginning) - - query: select count(*) from (select * from (select * from T1) as x where ID is not null) as y; - supported_version: !current_version From db5c326983b0a85ed9edfb5beace1b201208008d Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Tue, 4 Mar 2025 13:51:00 +0000 Subject: [PATCH 49/62] fixup standard-tests-metadata.yamsql --- .../standard-tests-metadata.metrics.binpb | 19 +++++++++++++++++++ .../standard-tests-metadata.metrics.yaml | 14 ++++++++++++++ .../resources/standard-tests-metadata.yamsql | 15 ++++++++++++++- .../resources/standard-tests-proto.yamsql | 1 - 4 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 yaml-tests/src/test/resources/standard-tests-metadata.metrics.binpb create mode 100644 yaml-tests/src/test/resources/standard-tests-metadata.metrics.yaml diff --git a/yaml-tests/src/test/resources/standard-tests-metadata.metrics.binpb b/yaml-tests/src/test/resources/standard-tests-metadata.metrics.binpb new file mode 100644 index 0000000000..a5ceff0fad --- /dev/null +++ b/yaml-tests/src/test/resources/standard-tests-metadata.metrics.binpb @@ -0,0 +1,19 @@ + + +standard-tests-metadatamEXPLAIN select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; +խ/ (08@SCAN([EQUALS promote(@c23 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q12._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q12 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count_star(*) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q8 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Scan
comparisons: [EQUALS promote(@c23 AS LONG)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Primary Storage
record types: [T1]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q30> label="q30" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} \ No newline at end of file diff --git a/yaml-tests/src/test/resources/standard-tests-metadata.metrics.yaml b/yaml-tests/src/test/resources/standard-tests-metadata.metrics.yaml new file mode 100644 index 0000000000..231aff59f2 --- /dev/null +++ b/yaml-tests/src/test/resources/standard-tests-metadata.metrics.yaml @@ -0,0 +1,14 @@ +standard-tests-metadata: +- query: EXPLAIN select count(*) from (select * from (select * from (select * from + T1 where ID = 5) as x) as y) as z; + explain: SCAN([EQUALS promote(@c23 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) + AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) + AS _0) + task_count: 395 + task_total_time_ms: 99 + transform_count: 142 + transform_time_ms: 65 + transform_yield_count: 22 + insert_time_ms: 6 + insert_new_count: 31 + insert_reused_count: 1 diff --git a/yaml-tests/src/test/resources/standard-tests-metadata.yamsql b/yaml-tests/src/test/resources/standard-tests-metadata.yamsql index 765f8158da..02379e8016 100644 --- a/yaml-tests/src/test/resources/standard-tests-metadata.yamsql +++ b/yaml-tests/src/test/resources/standard-tests-metadata.yamsql @@ -56,11 +56,24 @@ test_block: - - query: select * from (select * from (select * from T1) as x) as y where ID = 5; - result: [{ID: !l 5, !l 10, !l 5}] - # 4.1 Triage: [Deferred: Client checks for End] failed running with forced continuations (Received continuation shouldn't be at beginning) - - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; + - explain: "SCAN([EQUALS promote(@c23 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - maxRows: 0 - result: [{!l 1}] + - + # Copy of above query to simulate force continuations mode, which does not work prior to !current_version due to + # https://github.com/FoundationDB/fdb-record-layer/issues/3096. Can remove once we no longer with testing mixed-mode + # capabilities with versions older than !current_version + - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{!l 1}] + - result: [{!l 0}] + - result: [{!l 1}] # ad infinitum + - initialVersionAtLeast: !current_version + - result: [{!l 1}] + - result: [] - - query: select * from (select * from (select * from (select * from T1 where ID > 10) as x) as y) as z; - result: [{ID: !l 11, !l 20, !l 11}, {ID: !l 12, !l 20, !l 12}, {ID: !l 13, !l 20, !l 13}] diff --git a/yaml-tests/src/test/resources/standard-tests-proto.yamsql b/yaml-tests/src/test/resources/standard-tests-proto.yamsql index fdb5f40435..c989673cfe 100644 --- a/yaml-tests/src/test/resources/standard-tests-proto.yamsql +++ b/yaml-tests/src/test/resources/standard-tests-proto.yamsql @@ -57,7 +57,6 @@ test_block: - query: select * from (select * from (select * from T1) as x) as y where ID = 5; - explain: "SCAN(<,>) | FILTER _.ID EQUALS promote(@c22 AS LONG)" - result: [{ID: !l 5, !l 10, !l 5}] - # 4.1 Triage: [Deferred: Client checks for End] failed when running with forced continuations (Received continuation shouldn't be at beginning) - - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; - supported_version: !current_version From 7afba2b88113ff2534a0f728529508caa1d33ec1 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Tue, 4 Mar 2025 18:49:11 +0000 Subject: [PATCH 50/62] fixup union.yamsql though it is still a bit rough --- .../src/test/resources/union.metrics.binpb | 61 ++++++++++++++++--- .../src/test/resources/union.metrics.yaml | 34 ++++++++--- yaml-tests/src/test/resources/union.yamsql | 34 +++++++---- 3 files changed, 100 insertions(+), 29 deletions(-) diff --git a/yaml-tests/src/test/resources/union.metrics.binpb b/yaml-tests/src/test/resources/union.metrics.binpb index 99ae2e0447..9bc437f341 100644 --- a/yaml-tests/src/test/resources/union.metrics.binpb +++ b/yaml-tests/src/test/resources/union.metrics.binpb @@ -1,7 +1,49 @@ -= +G + + union-testsEXPLAIN select sum(a) as a, sum(b) as b from (select sum(col1) as a, count(*) as b from t1 union all select sum(col1) as a, count(*) as b from t2) as xE + ޣ(608Y@ISCAN(VI1 <,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0, count_star(*) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, coalesce_long(_._0._1, promote(0l AS LONG)) AS B) ⊎ SCAN(<,>) | TFILTER T2 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0, count_star(*) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, coalesce_long(_._0._1, promote(0l AS LONG)) AS B) | MAP (_ AS _0) | AGG (sum_l(_._0.A) AS _0, sum_l(_._0.B) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, _._0._1 AS B)Adigraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q24._0._0 AS A, q24._0._1 AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, )" ]; + 2 [ label=<
Value Computation
$q24 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q105._0.A) AS _0, sum_l(q105._0.B) AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q20 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, AS _0)" ]; + 5 [ label=<
Union All
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS A, )" ]; + 6 [ label=<
Value Computation
MAP (q6._0._0 AS A, coalesce_long(q6._0._1, promote(0l AS LONG)) AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, )" ]; + 7 [ label=<
Value Computation
MAP (q16._0._0 AS A, coalesce_long(q16._0._1, promote(0l AS LONG)) AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, )" ]; + 8 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0)" ]; + 9 [ label=<
Value Computation
$q16 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0)" ]; + 10 [ label=<
Streaming Aggregate
COLLECT (sum_l(q86._0.COL1) AS _0, count_star(*) AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0)" ]; + 11 [ label=<
Streaming Aggregate
COLLECT (sum_l(q57._0.COL1) AS _0, count_star(*) AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0)" ]; + 12 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 13 [ label=<
Value Computation
MAP (q12 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 14 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 15 [ label=<
Type Filter
WHERE record IS [T2]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 16 [ label=<
Index
VI1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 17 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 18 [ label=<
Primary Storage
record types: [T4, T5, T6, T7, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q24> label="q24" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q105> label="q105" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q20> label="q20" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q100> label="q100" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 5 [ label=< q102> label="q102" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 6 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 7 [ label=< q16> label="q16" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 8 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 11 -> 9 [ label=< q16> label="q16" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 12 -> 10 [ label=< q86> label="q86" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 13 -> 11 [ label=< q57> label="q57" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 14 -> 12 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 15 -> 13 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 16 -> 14 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 17 -> 15 [ label=< q49> label="q49" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 18 -> 17 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q24> label="q24" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +}=  - union-tests}EXPLAIN select sum(Y) as S from (select count(*) as Y from t3 where a < 10 group by a union all select count(*) from t4) as X< - Ɏ(.0%87@AISCAN(MV10 [[LESS_THAN promote(@c22 AS DOUBLE)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS Y) | MAP (_.Y AS Y) ⊎ SCAN(<,>) | TFILTER T4 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)9digraph G { + union-tests}EXPLAIN select sum(Y) as S from (select count(*) as Y from t3 where a < 10 group by a union all select count(*) from t4) as X< +, (.0ܜ87@AISCAN(MV10 [[LESS_THAN promote(@c22 AS DOUBLE)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS Y) | MAP (_.Y AS Y) ⊎ SCAN(<,>) | TFILTER T4 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)9digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -36,10 +78,10 @@ 15 -> 14 [ label=< q55> label="q55" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 16 -> 15 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q26> label="q26" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}H +}H t - union-testseEXPLAIN select sum(Y) as S from (select count(*) as Y from t3 union all select count(*) from t1) as XG - (<0V8[@SCAN(<,>) | TFILTER T3 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ ISCAN(VI1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)Ddigraph G { + union-testseEXPLAIN select sum(Y) as S from (select count(*) as Y from t3 union all select count(*) from t1) as XG +3 ߈(<0ȭ8[@SCAN(<,>) | TFILTER T3 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ ISCAN(VI1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)Ddigraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -80,10 +122,11 @@ t 18 -> 16 [ label=< q94> label="q94" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 19 -> 18 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q26> label="q26" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}= +}= t - union-testseEXPLAIN select sum(Y) as S from (select count(*) as Y from t6 union all select count(*) from t7) as X< - (G0r8o@AISCAN(MV11 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ AISCAN(MV12 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)9digraph G { + union-testseEXPLAIN select sum(Y) as S from (select count(*) as Y from t6 union all select count(*) from t7) as X< +Ɬ Պ +(G08o@AISCAN(MV11 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ AISCAN(MV12 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)9digraph G { fontname=courier; rankdir=BT; splines=polyline; diff --git a/yaml-tests/src/test/resources/union.metrics.yaml b/yaml-tests/src/test/resources/union.metrics.yaml index 5bb98449de..7ebb25fde3 100644 --- a/yaml-tests/src/test/resources/union.metrics.yaml +++ b/yaml-tests/src/test/resources/union.metrics.yaml @@ -1,4 +1,20 @@ union-tests: +- query: EXPLAIN select sum(a) as a, sum(b) as b from (select sum(col1) as a, count(*) + as b from t1 union all select sum(col1) as a, count(*) as b from t2) as x + explain: ISCAN(VI1 <,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0, count_star(*) + AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, coalesce_long(_._0._1, promote(0l + AS LONG)) AS B) ⊎ SCAN(<,>) | TFILTER T2 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) + AS _0, count_star(*) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, coalesce_long(_._0._1, + promote(0l AS LONG)) AS B) | MAP (_ AS _0) | AGG (sum_l(_._0.A) AS _0, sum_l(_._0.B) + AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, _._0._1 AS B) + task_count: 831 + task_total_time_ms: 46 + transform_count: 269 + transform_time_ms: 13 + transform_yield_count: 54 + insert_time_ms: 3 + insert_new_count: 89 + insert_reused_count: 6 - query: EXPLAIN select sum(Y) as S from (select count(*) as Y from t3 where a < 10 group by a union all select count(*) from t4) as X explain: 'AISCAN(MV10 [[LESS_THAN promote(@c22 AS DOUBLE)]] BY_GROUP -> [_0: KEY:[0], @@ -7,11 +23,11 @@ union-tests: promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)' task_count: 676 - task_total_time_ms: 15 + task_total_time_ms: 92 transform_count: 237 - transform_time_ms: 4 + transform_time_ms: 58 transform_yield_count: 46 - insert_time_ms: 0 + insert_time_ms: 4 insert_new_count: 55 insert_reused_count: 3 - query: EXPLAIN select sum(Y) as S from (select count(*) as Y from t3 union all @@ -23,11 +39,11 @@ union-tests: MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S) task_count: 873 - task_total_time_ms: 32 + task_total_time_ms: 107 transform_count: 286 - transform_time_ms: 9 + transform_time_ms: 61 transform_yield_count: 60 - insert_time_ms: 1 + insert_time_ms: 5 insert_new_count: 91 insert_reused_count: 6 - query: EXPLAIN select sum(Y) as S from (select count(*) as Y from t6 union all @@ -38,10 +54,10 @@ union-tests: NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)' task_count: 1026 - task_total_time_ms: 40 + task_total_time_ms: 51 transform_count: 351 - transform_time_ms: 12 + transform_time_ms: 22 transform_yield_count: 71 - insert_time_ms: 1 + insert_time_ms: 3 insert_new_count: 111 insert_reused_count: 7 diff --git a/yaml-tests/src/test/resources/union.yamsql b/yaml-tests/src/test/resources/union.yamsql index aa36293532..e7d4cc104d 100644 --- a/yaml-tests/src/test/resources/union.yamsql +++ b/yaml-tests/src/test/resources/union.yamsql @@ -58,8 +58,9 @@ test_block: tests: - - query: select sum(a) as a, sum(b) as b from (select sum(col1) as a, count(*) as b from t1 union all select sum(col1) as a, count(*) as b from t2) as x - # 4.1 Triage: [Investigate further: aggregates on subquery] infinite loop - - maxRows: 0 + # Versions prior to !current_version, this would infinite loop in a hard to assert about way due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + - supported_version: !current_version + - explain: "ISCAN(VI1 <,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0, count_star(*) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, coalesce_long(_._0._1, promote(0l AS LONG)) AS B) ⊎ SCAN(<,>) | TFILTER T2 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0, count_star(*) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, coalesce_long(_._0._1, promote(0l AS LONG)) AS B) | MAP (_ AS _0) | AGG (sum_l(_._0.A) AS _0, sum_l(_._0.B) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, _._0._1 AS B)" - unorderedResult: [{A: 74 , B: 13}] - - query: select col1, col2 from t1 union all select col1, col2 from t1 @@ -157,21 +158,19 @@ test_block: {A: 10.0, B: 20.0}] - - query: select sum(Y) as S from (select count(*) as Y from t3 where a < 10 group by a union all select count(*) from t4) as X - # 4.1 Triage: [Investigate further: aggregates on subquery] Infinite loop - - maxRows: 0 + # Does not work in force continuations mode on prior versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + # Hard to write asserts for on older versions, but no unexpected mixed mode issues when running with older versions + - supported_version: !current_version - explain: "AISCAN(MV10 [[LESS_THAN promote(@c22 AS DOUBLE)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS Y) | MAP (_.Y AS Y) ⊎ SCAN(<,>) | TFILTER T4 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)" - result: [{S: 2}] - - query: select sum(Y) as S from (select count(*) as Y from t3 union all select count(*) from t1) as X + - supported_version: !current_version - explain: "SCAN(<,>) | TFILTER T3 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ ISCAN(VI1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)" - # 4.1 Triage: [Investigate further: aggregates on subquery] Infinite loop - - maxRows: 0 - result: [{S: 5}] - - query: select col2 from t1 where exists (select a from t3 where col2 <= id union all select b from t4 where col2 <= id) - # 4.1 Triage: [Investigate further] fails with forced continuations (Invalid continuation) - # Failed with both 559 and 4.1.8, RecordCoreException: invalid continuation - - maxRows: 0 + - supported_version: !current_version - result: [{1}, {2}, {6}, {7}] - - query: select col1, col2 from t1 union all select col1 from t1 @@ -183,12 +182,25 @@ test_block: - query: select col1, col2 from t1 union all select a, b from t5 - error: "42F65" - - # 4.1 Triage: [Initial version] Failing with 559: (Wrong result with forced continuation (NULL vs 0)) - # 4.1 Triage: [deferred: Client checks for END] Failing with forced continuations: (Received continuation shouldn't be at beginning) - query: select sum(Y) as S from (select count(*) as Y from t6 union all select count(*) from t7) as X - explain: "AISCAN(MV11 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ AISCAN(MV12 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)" + - maxRows: 0 # Disable force_continuations until we no longer care about versions before !current_version + # Value returned on empty changed in 4.0.561.0 due to: https://github.com/FoundationDB/fdb-record-layer/pull/3029 - initialVersionLessThan: 4.0.561.0 - result: [{!null _ }] - initialVersionAtLeast: 4.0.561.0 - result: [{0}] + - + # Copy of above query to simulate force_continuations before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + # Can remove once we no longer care about mixed mode with older versions + - query: select sum(Y) as S from (select count(*) as Y from t6 union all select count(*) from t7) as X + - supported_version: 4.1.4.0 + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{0}] + - result: [{!null _}] + - result: [{0}] # ad infinitum + - initialVersionAtLeast: !current_version + - result: [{0}] + - result: [] ... From c331d8a18f4190220cd8c5b7d57b95769e0f1dbf Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Tue, 4 Mar 2025 19:26:15 +0000 Subject: [PATCH 51/62] update union-empty-tables.yamsql and like.yamsql --- .../src/test/java/YamlIntegrationTests.java | 5 - yaml-tests/src/test/resources/like.yamsql | 18 - .../union-empty-tables.metrics.binpb | 366 +++++++++++++++++- .../resources/union-empty-tables.metrics.yaml | 174 ++++++++- .../test/resources/union-empty-tables.yamsql | 22 ++ yaml-tests/yaml-tests.gradle | 6 +- 6 files changed, 556 insertions(+), 35 deletions(-) diff --git a/yaml-tests/src/test/java/YamlIntegrationTests.java b/yaml-tests/src/test/java/YamlIntegrationTests.java index 5e4ec8a9e6..83859adcf4 100644 --- a/yaml-tests/src/test/java/YamlIntegrationTests.java +++ b/yaml-tests/src/test/java/YamlIntegrationTests.java @@ -18,7 +18,6 @@ * limitations under the License. */ -import com.apple.foundationdb.relational.yamltests.ExcludeYamlTestConfig; import com.apple.foundationdb.relational.yamltests.MaintainYamlTestConfig; import com.apple.foundationdb.relational.yamltests.YamlTest; import com.apple.foundationdb.relational.yamltests.YamlTestConfigFilters; @@ -186,8 +185,6 @@ public void caseWhen(YamlTest.Runner runner) throws Exception { } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Update statements fail with force continuations") public void updateDeleteReturning(YamlTest.Runner runner) throws Exception { runner.runYamsql("update-delete-returning.yamsql"); } @@ -233,8 +230,6 @@ public void union(YamlTest.Runner runner) throws Exception { } @TestTemplate - @ExcludeYamlTestConfig(value = YamlTestConfigFilters.DO_NOT_FORCE_CONTINUATIONS, - reason = "Infinite continuation loop (https://github.com/FoundationDB/fdb-record-layer/issues/3095)") public void unionEmptyTables(YamlTest.Runner runner) throws Exception { runner.runYamsql("union-empty-tables.yamsql"); } diff --git a/yaml-tests/src/test/resources/like.yamsql b/yaml-tests/src/test/resources/like.yamsql index bc23cdd1bf..ab12895a6e 100644 --- a/yaml-tests/src/test/resources/like.yamsql +++ b/yaml-tests/src/test/resources/like.yamsql @@ -17,8 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# 4.1 triage: [Deferred: like continuations] All queries that return any results, fail with force continuations, even against current version -# with: The like operator expects an escape character of length 1. --- schema_template: create table A(a1 string, primary key(a1)) @@ -54,7 +52,6 @@ test_block: - result: [] - - query: select * from A WHERE A1 LIKE '%abc%' - - maxRows: 0 - unorderedResult: [ {'abcdefghijklmnopqrstuvwxyz'}, {'___abcdef'}, @@ -65,7 +62,6 @@ test_block: {'{abcdefghijk}'}] - - query: select * from A WHERE A1 LIKE '_abc%' - - maxRows: 0 - unorderedResult: [ {'(abcdefghijk)'}, {'[abcdefghijk]'}, @@ -74,24 +70,20 @@ test_block: - # TODO (Investigate `Missing binding for __const_CONSTANT` error with queries when using plan from cache) - query: select * from A WHERE A1 LIKE '%ABC%' - - maxRows: 0 - unorderedResult: [{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}] - - query: select * from A WHERE A1 LIKE '%ABC%X_Z' - - maxRows: 0 - unorderedResult: [{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}] - - query: select * from A WHERE A1 LIKE '%ABC%XY_Z' - unorderedResult: [] - - query: select * from A WHERE A1 LIKE '__' - - maxRows: 0 - unorderedResult: [ {'学校'}, {'^$'}] - - query: select * from A WHERE A1 LIKE '_____' - - maxRows: 0 - unorderedResult: [ {'école'}, {'ありがとう'}, @@ -106,42 +98,33 @@ test_block: tests: - - query: select * from A WHERE A1 LIKE '|_|_%' ESCAPE '|' - - maxRows: 0 - result: [{'___abcdef'}] - - query: select * from A WHERE A1 LIKE '\_%' ESCAPE '\' - - maxRows: 0 - result: [{'___abcdef'}] - - query: select * from A WHERE A1 LIKE '\_%' ESCAPE '|' - - maxRows: 0 - result: [{'\\||%'}] - - query: select * from A WHERE A1 LIKE '\_%' - - maxRows: 0 - result: [{'\\||%'}] - - query: select * from A WHERE A1 LIKE '\_\_\_abcdef' ESCAPE '\' - - maxRows: 0 - result: [{'___abcdef'}] - - query: select * from A WHERE A1 LIKE '\_\_\_______' ESCAPE '\' - - maxRows: 0 - result: [{'___abcdef'}] - - query: select * from A WHERE A1 LIKE '\__\_______' ESCAPE '\' - - maxRows: 0 - result: [{'___abcdef'}] - - query: select * from A WHERE A1 LIKE '\__\______\_' ESCAPE '\' - result: [] - - query: select * from A WHERE A1 LIKE '%\%' ESCAPE '\' - - maxRows: 0 - result: [{'\\||%'}] - - query: select * from A WHERE A1 NOT LIKE '|_|_%' ESCAPE '|' - - maxRows: 0 - unorderedResult: [ {'abcdefghijklmnopqrstuvwxyz'}, {'%%abcdef'}, @@ -162,7 +145,6 @@ test_block: - unorderedResult: [] - - query: select * from A WHERE A1 NOT LIKE '%abcde%' - - maxRows: 0 - unorderedResult: [ {'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}, {'école'}, diff --git a/yaml-tests/src/test/resources/union-empty-tables.metrics.binpb b/yaml-tests/src/test/resources/union-empty-tables.metrics.binpb index e4137863a4..5a849fca07 100644 --- a/yaml-tests/src/test/resources/union-empty-tables.metrics.binpb +++ b/yaml-tests/src/test/resources/union-empty-tables.metrics.binpb @@ -1,8 +1,317 @@ -= + +A + unnamed-14EXPLAIN select sum(col1) as a, count(*) as b from t1 +BW ,(08@SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0, count_star(*) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, coalesce_long(_._0._1, promote(0l AS LONG)) AS B)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS A, coalesce_long(q6._0._1, promote(0l AS LONG)) AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, )" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q27._0.COL1) AS _0, count_star(*) AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 7 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q27> label="q27" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +}J + + unnamed-1EXPLAIN select sum(a) as a, sum(b) as b from (select sum(col1) as a, count(*) as b from t1 union all select sum(col1) as a, count(*) as b from t2) as xI +  (&0m8=@SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0, count_star(*) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, coalesce_long(_._0._1, promote(0l AS LONG)) AS B) ⊎ SCAN(<,>) | TFILTER T2 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0, count_star(*) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, coalesce_long(_._0._1, promote(0l AS LONG)) AS B) | MAP (_ AS _0) | AGG (sum_l(_._0.A) AS _0, sum_l(_._0.B) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, _._0._1 AS B)Edigraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q24._0._0 AS A, q24._0._1 AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, )" ]; + 2 [ label=<
Value Computation
$q24 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q85._0.A) AS _0, sum_l(q85._0.B) AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q20 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, AS _0)" ]; + 5 [ label=<
Union All
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS A, )" ]; + 6 [ label=<
Value Computation
MAP (q6._0._0 AS A, coalesce_long(q6._0._1, promote(0l AS LONG)) AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, )" ]; + 7 [ label=<
Value Computation
MAP (q16._0._0 AS A, coalesce_long(q16._0._1, promote(0l AS LONG)) AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, )" ]; + 8 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0)" ]; + 9 [ label=<
Value Computation
$q16 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0)" ]; + 10 [ label=<
Streaming Aggregate
COLLECT (sum_l(q70._0.COL1) AS _0, count_star(*) AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0)" ]; + 11 [ label=<
Streaming Aggregate
COLLECT (sum_l(q51._0.COL1) AS _0, count_star(*) AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, AS _0)" ]; + 12 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 13 [ label=<
Value Computation
MAP (q12 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 14 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 15 [ label=<
Type Filter
WHERE record IS [T2]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 16 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 17 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 18 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 19 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q24> label="q24" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q85> label="q85" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q20> label="q20" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q80> label="q80" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 5 [ label=< q82> label="q82" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 6 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 7 [ label=< q16> label="q16" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 8 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 11 -> 9 [ label=< q16> label="q16" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 12 -> 10 [ label=< q70> label="q70" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 13 -> 11 [ label=< q51> label="q51" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 14 -> 12 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 15 -> 13 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 16 -> 14 [ label=< q62> label="q62" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 17 -> 15 [ label=< q43> label="q43" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 18 -> 16 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 19 -> 17 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q24> label="q24" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +}! +R + unnamed-1EEXPLAIN select col1, col2 from t1 union all select col1, col2 from t1 +B ߔ(0,8@SCAN(<,>) | TFILTER T1 | MAP (_.COL1 AS COL1, _.COL2 AS COL2) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.COL1 AS COL1, _.COL2 AS COL2)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Union All
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS COL1, )" ]; + 2 [ label=<
Value Computation
MAP (q2.COL1 AS COL1, q2.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL1, )" ]; + 3 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 4 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 5 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 6 [ label=<
Value Computation
MAP (q8.COL1 AS COL1, q8.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL1, )" ]; + 7 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 8 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 9 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q40> label="q40" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 1 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +A + unnamed-14EXPLAIN select * from t1 union all select * from t1; +ȱ@@ +(08@1SCAN(<,>) | TFILTER T1 ⊎ SCAN(<,>) | TFILTER T1digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Union All
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, )" ]; + 2 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 4 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 5 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 7 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q34> label="q34" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 1 [ label=< q36> label="q36" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +N + unnamed-1AEXPLAIN select * from t1 union all select id, col1, col2 from t1; +BQ +(0°8@dSCAN(<,>) | TFILTER T1 ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Union All
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, )" ]; + 2 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 4 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 5 [ label=<
Value Computation
MAP (q8.ID AS ID, q8.COL1 AS COL1, q8.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q35> label="q35" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 1 [ label=< q37> label="q37" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +N + unnamed-1AEXPLAIN select id, col1, col2 from t1 union all select * from t1; +BS ,(08@dSCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2) ⊎ SCAN(<,>) | TFILTER T1digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Union All
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, )" ]; + 2 [ label=<
Value Computation
MAP (q2.ID AS ID, q2.COL1 AS COL1, q2.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 4 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 5 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 6 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q39> label="q39" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 1 [ label=< q41> label="q41" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +}% +] + unnamed-1PEXPLAIN select id as W, col1 as X, col2 as Y from t1 union all select * from t1;$ +CZ +(08@SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2)#digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Union All
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS W, )" ]; + 2 [ label=<
Value Computation
MAP (q6.W AS W, q6.X AS X, q6.Y AS Y)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS W, )" ]; + 3 [ label=<
Value Computation
MAP (q2.ID AS W, q2.COL1 AS X, q2.COL2 AS Y)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS W, )" ]; + 4 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 5 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 6 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 7 [ label=<
Value Computation
MAP (q12.ID AS ID, q12.COL1 AS COL1, q12.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 8 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 9 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 10 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q27> label="q27" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q45> label="q45" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ label=< q27> label="q27" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 1 [ label=< q47> label="q47" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +}% +_ + unnamed-1REXPLAIN (select id as W, col1 as X, col2 as Y from t1) union all select * from t1;$ +䄻Z (0$8@SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2)#digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Union All
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS W, )" ]; + 2 [ label=<
Value Computation
MAP (q6.W AS W, q6.X AS X, q6.Y AS Y)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS W, )" ]; + 3 [ label=<
Value Computation
MAP (q2.ID AS W, q2.COL1 AS X, q2.COL2 AS Y)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS W, )" ]; + 4 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 5 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 6 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 7 [ label=<
Value Computation
MAP (q12.ID AS ID, q12.COL1 AS COL1, q12.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 8 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 9 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 10 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q27> label="q27" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q45> label="q45" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ label=< q27> label="q27" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 1 [ label=< q47> label="q47" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +}% +_ + unnamed-1REXPLAIN select id as W, col1 as X, col2 as Y from t1 union all (select * from t1);$ +Z (058@SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2)#digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Union All
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS W, )" ]; + 2 [ label=<
Value Computation
MAP (q6.W AS W, q6.X AS X, q6.Y AS Y)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS W, )" ]; + 3 [ label=<
Value Computation
MAP (q2.ID AS W, q2.COL1 AS X, q2.COL2 AS Y)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS W, )" ]; + 4 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 5 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 6 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 7 [ label=<
Value Computation
MAP (q12.ID AS ID, q12.COL1 AS COL1, q12.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 8 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 9 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 10 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q27> label="q27" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q45> label="q45" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ label=< q27> label="q27" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 1 [ label=< q47> label="q47" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +}% +a + unnamed-1TEXPLAIN (select id as W, col1 as X, col2 as Y from t1 union all (select * from t1));$ +̘Z Ѧ(0ڥ&8@SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2)#digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Union All
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS W, )" ]; + 2 [ label=<
Value Computation
MAP (q6.W AS W, q6.X AS X, q6.Y AS Y)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS W, )" ]; + 3 [ label=<
Value Computation
MAP (q2.ID AS W, q2.COL1 AS X, q2.COL2 AS Y)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS W, )" ]; + 4 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 5 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 6 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 7 [ label=<
Value Computation
MAP (q12.ID AS ID, q12.COL1 AS COL1, q12.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 8 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 9 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 10 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q27> label="q27" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q45> label="q45" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ label=< q27> label="q27" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 1 [ label=< q47> label="q47" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +}% +a + unnamed-1TEXPLAIN ((select id as W, col1 as X, col2 as Y from t1) union all select * from t1);$ +Z (0ҿ,8@SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2)#digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Union All
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS W, )" ]; + 2 [ label=<
Value Computation
MAP (q6.W AS W, q6.X AS X, q6.Y AS Y)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS W, )" ]; + 3 [ label=<
Value Computation
MAP (q2.ID AS W, q2.COL1 AS X, q2.COL2 AS Y)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS W, )" ]; + 4 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 5 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 6 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 7 [ label=<
Value Computation
MAP (q12.ID AS ID, q12.COL1 AS COL1, q12.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 8 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 9 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 10 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q27> label="q27" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q45> label="q45" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ label=< q27> label="q27" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 1 [ label=< q47> label="q47" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +}) +F + unnamed-19EXPLAIN select a, b from t3 union all select a, b from t4( + v (0;8@SCAN(<,>) | TFILTER T3 | MAP (_.A AS A, _.B AS B) | MAP (_.A AS A, promote(_.B AS DOUBLE) AS B) ⊎ SCAN(<,>) | TFILTER T4 | MAP (_.A AS A, _.B AS B) | MAP (promote(_.A AS DOUBLE) AS A, _.B AS B)&digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Union All
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(DOUBLE AS A, )" ]; + 2 [ label=<
Value Computation
MAP (q6.A AS A, promote(q6.B AS DOUBLE) AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS A, )" ]; + 3 [ label=<
Value Computation
MAP (q2.A AS A, q2.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS A, )" ]; + 4 [ label=<
Type Filter
WHERE record IS [T3]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 5 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 6 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 7 [ label=<
Value Computation
MAP (promote(q14.A AS DOUBLE) AS A, q14.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS A, )" ]; + 8 [ label=<
Value Computation
MAP (q10.A AS A, q10.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, )" ]; + 9 [ label=<
Type Filter
WHERE record IS [T4]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 10 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 11 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q55> label="q55" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q64> label="q64" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 8 [ label=< q10> label="q10" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ label=< q45> label="q45" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 11 -> 10 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 1 [ label=< q66> label="q66" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +}=  unnamed-1}EXPLAIN select sum(Y) as S from (select count(*) as Y from t3 where a < 10 group by a union all select count(*) from t4) as X< - - (.0H87@AISCAN(MV10 [[LESS_THAN promote(@c22 AS DOUBLE)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS Y) | MAP (_.Y AS Y) ⊎ SCAN(<,>) | TFILTER T4 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)9digraph G { +ꠒ (.0f87@AISCAN(MV10 [[LESS_THAN promote(@c22 AS DOUBLE)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS Y) | MAP (_.Y AS Y) ⊎ SCAN(<,>) | TFILTER T4 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)9digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -40,7 +349,7 @@ }L r unnamed-1eEXPLAIN select sum(Y) as S from (select count(*) as Y from t3 union all select count(*) from t1) as XK -  (,08?@SCAN(<,>) | TFILTER T3 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)Gdigraph G { +K ̕1(,08?@SCAN(<,>) | TFILTER T3 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)Gdigraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -83,4 +392,53 @@ r 19 -> 17 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 20 -> 18 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q26> label="q26" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +}G + + unnamed-1xEXPLAIN select col2 from t1 where exists (select a from t3 where col2 <= id union all select b from t4 where col2 <= id)F +V ;(3088@SCAN(<,>) | TFILTER T1 | FLATMAP q0 -> { SCAN(<,>) | TFILTER T3 | FILTER _.ID GREATER_THAN_OR_EQUALS q0.COL2 | MAP (_.A AS A) | MAP (_.A AS A) ⊎ SCAN(<,>) | TFILTER T4 | FILTER _.ID GREATER_THAN_OR_EQUALS q0.COL2 | MAP (_.B AS B) | MAP (_.B AS B) | DEFAULT NULL | FILTER _ NOT_NULL AS q1 RETURN (q0.COL2 AS COL2) }Ddigraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Nested Loop Join
FLATMAP (q2.COL2 AS COL2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS COL2)" ]; + 2 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 4 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 5 [ label=<
Predicate Filter
WHERE q22 NOT_NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS A)" ]; + 6 [ label=<
Value Computation
FIRST $q22 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS A)" ]; + 7 [ label=<
Union All
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(DOUBLE AS A)" ]; + 8 [ label=<
Value Computation
MAP (q8.A AS A)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS A)" ]; + 9 [ label=<
Value Computation
MAP (q14.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS B)" ]; + 10 [ label=<
Value Computation
MAP (q76.A AS A)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS A)" ]; + 11 [ label=<
Value Computation
MAP (q61.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS B)" ]; + 12 [ label=<
Predicate Filter
WHERE q6.ID GREATER_THAN_OR_EQUALS q2.COL2
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 13 [ label=<
Predicate Filter
WHERE q12.ID GREATER_THAN_OR_EQUALS q2.COL2
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 14 [ label=<
Type Filter
WHERE record IS [T3]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 15 [ label=<
Type Filter
WHERE record IS [T4]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 16 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 17 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 18 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 19 [ label=<
Primary Storage
record types: [T4, T5, T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q91> label="q91" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q22> label="q22" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q22> label="q22" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ label=< q86> label="q86" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 7 [ label=< q88> label="q88" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 8 [ label=< q8> label="q8" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 11 -> 9 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 12 -> 10 [ label=< q76> label="q76" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 13 -> 11 [ label=< q61> label="q61" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 14 -> 12 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 15 -> 13 [ label=< q12> label="q12" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 16 -> 14 [ label=< q72> label="q72" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 17 -> 15 [ label=< q57> label="q57" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 18 -> 16 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 19 -> 17 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 1 [ label=< q22> label="q22" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + { + rank=same; + rankDir=LR; + 2 -> 5 [ color="red" style="invis" ]; + } } \ No newline at end of file diff --git a/yaml-tests/src/test/resources/union-empty-tables.metrics.yaml b/yaml-tests/src/test/resources/union-empty-tables.metrics.yaml index 43306dbfe9..6cfa500c28 100644 --- a/yaml-tests/src/test/resources/union-empty-tables.metrics.yaml +++ b/yaml-tests/src/test/resources/union-empty-tables.metrics.yaml @@ -1,4 +1,153 @@ unnamed-1: +- query: EXPLAIN select sum(col1) as a, count(*) as b from t1 + explain: SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0, + count_star(*) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, coalesce_long(_._0._1, + promote(0l AS LONG)) AS B) + task_count: 263 + task_total_time_ms: 139 + transform_count: 87 + transform_time_ms: 92 + transform_yield_count: 15 + insert_time_ms: 7 + insert_new_count: 22 + insert_reused_count: 2 +- query: EXPLAIN select sum(a) as a, sum(b) as b from (select sum(col1) as a, count(*) + as b from t1 union all select sum(col1) as a, count(*) as b from t2) as x + explain: SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0, + count_star(*) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, coalesce_long(_._0._1, + promote(0l AS LONG)) AS B) ⊎ SCAN(<,>) | TFILTER T2 | MAP (_ AS _0) | AGG + (sum_l(_._0.COL1) AS _0, count_star(*) AS _1) | ON EMPTY NULL | MAP (_._0._0 + AS A, coalesce_long(_._0._1, promote(0l AS LONG)) AS B) | MAP (_ AS _0) | + AGG (sum_l(_._0.A) AS _0, sum_l(_._0.B) AS _1) | ON EMPTY NULL | MAP (_._0._0 + AS A, _._0._1 AS B) + task_count: 696 + task_total_time_ms: 24 + transform_count: 235 + transform_time_ms: 7 + transform_yield_count: 38 + insert_time_ms: 1 + insert_new_count: 61 + insert_reused_count: 5 +- query: EXPLAIN select col1, col2 from t1 union all select col1, col2 from t1 + explain: SCAN(<,>) | TFILTER T1 | MAP (_.COL1 AS COL1, _.COL2 AS COL2) ⊎ SCAN(<,>) + | TFILTER T1 | MAP (_.COL1 AS COL1, _.COL2 AS COL2) + task_count: 235 + task_total_time_ms: 10 + transform_count: 66 + transform_time_ms: 3 + transform_yield_count: 15 + insert_time_ms: 0 + insert_new_count: 19 + insert_reused_count: 3 +- query: EXPLAIN select * from t1 union all select * from t1; + explain: SCAN(<,>) | TFILTER T1 ⊎ SCAN(<,>) | TFILTER T1 + task_count: 210 + task_total_time_ms: 134 + transform_count: 64 + transform_time_ms: 92 + transform_yield_count: 15 + insert_time_ms: 6 + insert_new_count: 15 + insert_reused_count: 2 +- query: EXPLAIN select * from t1 union all select id, col1, col2 from t1; + explain: SCAN(<,>) | TFILTER T1 ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 + AS COL1, _.COL2 AS COL2) + task_count: 270 + task_total_time_ms: 140 + transform_count: 81 + transform_time_ms: 90 + transform_yield_count: 18 + insert_time_ms: 2 + insert_new_count: 22 + insert_reused_count: 1 +- query: EXPLAIN select id, col1, col2 from t1 union all select * from t1; + explain: SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2) + ⊎ SCAN(<,>) | TFILTER T1 + task_count: 295 + task_total_time_ms: 140 + transform_count: 83 + transform_time_ms: 92 + transform_yield_count: 18 + insert_time_ms: 6 + insert_new_count: 24 + insert_reused_count: 2 +- query: EXPLAIN select id as W, col1 as X, col2 as Y from t1 union all select * + from t1; + explain: SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | + MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS + ID, _.COL1 AS COL1, _.COL2 AS COL2) + task_count: 299 + task_total_time_ms: 141 + transform_count: 90 + transform_time_ms: 92 + transform_yield_count: 17 + insert_time_ms: 6 + insert_new_count: 22 + insert_reused_count: 3 +- query: EXPLAIN (select id as W, col1 as X, col2 as Y from t1) union all select + * from t1; + explain: SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | + MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS + ID, _.COL1 AS COL1, _.COL2 AS COL2) + task_count: 299 + task_total_time_ms: 9 + transform_count: 90 + transform_time_ms: 3 + transform_yield_count: 17 + insert_time_ms: 0 + insert_new_count: 22 + insert_reused_count: 3 +- query: EXPLAIN select id as W, col1 as X, col2 as Y from t1 union all (select + * from t1); + explain: SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | + MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS + ID, _.COL1 AS COL1, _.COL2 AS COL2) + task_count: 299 + task_total_time_ms: 9 + transform_count: 90 + transform_time_ms: 4 + transform_yield_count: 17 + insert_time_ms: 0 + insert_new_count: 22 + insert_reused_count: 3 +- query: EXPLAIN (select id as W, col1 as X, col2 as Y from t1 union all (select + * from t1)); + explain: SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | + MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS + ID, _.COL1 AS COL1, _.COL2 AS COL2) + task_count: 299 + task_total_time_ms: 8 + transform_count: 90 + transform_time_ms: 3 + transform_yield_count: 17 + insert_time_ms: 0 + insert_new_count: 22 + insert_reused_count: 3 +- query: EXPLAIN ((select id as W, col1 as X, col2 as Y from t1) union all select + * from t1); + explain: SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | + MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS + ID, _.COL1 AS COL1, _.COL2 AS COL2) + task_count: 299 + task_total_time_ms: 10 + transform_count: 90 + transform_time_ms: 3 + transform_yield_count: 17 + insert_time_ms: 0 + insert_new_count: 22 + insert_reused_count: 3 +- query: EXPLAIN select a, b from t3 union all select a, b from t4 + explain: SCAN(<,>) | TFILTER T3 | MAP (_.A AS A, _.B AS B) | MAP (_.A AS A, promote(_.B + AS DOUBLE) AS B) ⊎ SCAN(<,>) | TFILTER T4 | MAP (_.A AS A, _.B AS B) | MAP + (promote(_.A AS DOUBLE) AS A, _.B AS B) + task_count: 362 + task_total_time_ms: 24 + transform_count: 118 + transform_time_ms: 11 + transform_yield_count: 30 + insert_time_ms: 0 + insert_new_count: 25 + insert_reused_count: 2 - query: EXPLAIN select sum(Y) as S from (select count(*) as Y from t3 where a < 10 group by a union all select count(*) from t4) as X explain: 'AISCAN(MV10 [[LESS_THAN promote(@c22 AS DOUBLE)]] BY_GROUP -> [_0: KEY:[0], @@ -7,9 +156,9 @@ unnamed-1: promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)' task_count: 676 - task_total_time_ms: 21 + task_total_time_ms: 50 transform_count: 237 - transform_time_ms: 8 + transform_time_ms: 31 transform_yield_count: 46 insert_time_ms: 1 insert_new_count: 55 @@ -23,10 +172,25 @@ unnamed-1: _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S) task_count: 738 - task_total_time_ms: 19 + task_total_time_ms: 157 transform_count: 252 - transform_time_ms: 5 + transform_time_ms: 104 transform_yield_count: 44 - insert_time_ms: 2 + insert_time_ms: 10 insert_new_count: 63 insert_reused_count: 5 +- query: EXPLAIN select col2 from t1 where exists (select a from t3 where col2 <= + id union all select b from t4 where col2 <= id) + explain: SCAN(<,>) | TFILTER T1 | FLATMAP q0 -> { SCAN(<,>) | TFILTER T3 | FILTER + _.ID GREATER_THAN_OR_EQUALS q0.COL2 | MAP (_.A AS A) | MAP (_.A AS A) ⊎ SCAN(<,>) + | TFILTER T4 | FILTER _.ID GREATER_THAN_OR_EQUALS q0.COL2 | MAP (_.B AS B) + | MAP (_.B AS B) | DEFAULT NULL | FILTER _ NOT_NULL AS q1 RETURN (q0.COL2 + AS COL2) } + task_count: 727 + task_total_time_ms: 180 + transform_count: 231 + transform_time_ms: 124 + transform_yield_count: 51 + insert_time_ms: 7 + insert_new_count: 56 + insert_reused_count: 4 diff --git a/yaml-tests/src/test/resources/union-empty-tables.yamsql b/yaml-tests/src/test/resources/union-empty-tables.yamsql index 540b2e1dbe..982bcd76cf 100644 --- a/yaml-tests/src/test/resources/union-empty-tables.yamsql +++ b/yaml-tests/src/test/resources/union-empty-tables.yamsql @@ -30,50 +30,72 @@ test_block: tests: - - query: select sum(col1) as a, count(*) as b from t1 + - explain: "SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0, count_star(*) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, coalesce_long(_._0._1, promote(0l AS LONG)) AS B)" - unorderedResult: [{A: !null , B: 0}] - - query: select sum(a) as a, sum(b) as b from (select sum(col1) as a, count(*) as b from t1 union all select sum(col1) as a, count(*) as b from t2) as x + # Query does not work with force continuations before !current_version for a few reasons, including: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + # Previous behavior is hard to assert about, but upgrade flow to !current_version works as well as can be expected given the bugs. + - supported_version: !current_version + - explain: "SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0, count_star(*) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, coalesce_long(_._0._1, promote(0l AS LONG)) AS B) ⊎ SCAN(<,>) | TFILTER T2 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0, count_star(*) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, coalesce_long(_._0._1, promote(0l AS LONG)) AS B) | MAP (_ AS _0) | AGG (sum_l(_._0.A) AS _0, sum_l(_._0.B) AS _1) | ON EMPTY NULL | MAP (_._0._0 AS A, _._0._1 AS B)" - unorderedResult: [{A: !null , B: 0}] - - query: select col1, col2 from t1 union all select col1, col2 from t1 + - explain: "SCAN(<,>) | TFILTER T1 | MAP (_.COL1 AS COL1, _.COL2 AS COL2) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.COL1 AS COL1, _.COL2 AS COL2)" - unorderedResult: [] - - query: select * from t1 union all select * from t1; + - explain: "SCAN(<,>) | TFILTER T1 ⊎ SCAN(<,>) | TFILTER T1" - unorderedResult: [] - - query: select * from t1 union all select id, col1, col2 from t1; + - explain: "SCAN(<,>) | TFILTER T1 ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2)" - unorderedResult: [] - - query: select id, col1, col2 from t1 union all select * from t1; + - explain: "SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2) ⊎ SCAN(<,>) | TFILTER T1" - unorderedResult: [] - - query: select id as W, col1 as X, col2 as Y from t1 union all select * from t1; + - explain: "SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2)" - unorderedResult: [] - - query: (select id as W, col1 as X, col2 as Y from t1) union all select * from t1; + - explain: "SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2)" - unorderedResult: [] - - query: select id as W, col1 as X, col2 as Y from t1 union all (select * from t1); + - explain: "SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2)" - unorderedResult: [] - - query: (select id as W, col1 as X, col2 as Y from t1 union all (select * from t1)); + - explain: "SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2)" - unorderedResult: [] - - query: ((select id as W, col1 as X, col2 as Y from t1) union all select * from t1); + - explain: "SCAN(<,>) | TFILTER T1 | MAP (_.ID AS W, _.COL1 AS X, _.COL2 AS Y) | MAP (_.W AS W, _.X AS X, _.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_.ID AS ID, _.COL1 AS COL1, _.COL2 AS COL2)" - unorderedResult: [] - - query: select a, b from t3 union all select a, b from t4 + - explain: "SCAN(<,>) | TFILTER T3 | MAP (_.A AS A, _.B AS B) | MAP (_.A AS A, promote(_.B AS DOUBLE) AS B) ⊎ SCAN(<,>) | TFILTER T4 | MAP (_.A AS A, _.B AS B) | MAP (promote(_.A AS DOUBLE) AS A, _.B AS B)" - unorderedResult: [] - - query: select sum(Y) as S from (select count(*) as Y from t3 where a < 10 group by a union all select count(*) from t4) as X + # Query does not work with force continuations before !current_version for a few reasons, including: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + - supported_version: !current_version - explain: "AISCAN(MV10 [[LESS_THAN promote(@c22 AS DOUBLE)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS Y) | MAP (_.Y AS Y) ⊎ SCAN(<,>) | TFILTER T4 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)" - unorderedResult: [{0}] - - query: select sum(Y) as S from (select count(*) as Y from t3 union all select count(*) from t1) as X + # Query does not work with force continuations before !current_version for a few reasons, including: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + - supported_version: !current_version - explain: "SCAN(<,>) | TFILTER T3 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)" - unorderedResult: [{0}] - - query: select col2 from t1 where exists (select a from t3 where col2 <= id union all select b from t4 where col2 <= id) + # Query does not work with force continuations before !current_version for a few reasons, including: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + - supported_version: !current_version + - explain: "SCAN(<,>) | TFILTER T1 | FLATMAP q0 -> { SCAN(<,>) | TFILTER T3 | FILTER _.ID GREATER_THAN_OR_EQUALS q0.COL2 | MAP (_.A AS A) | MAP (_.A AS A) ⊎ SCAN(<,>) | TFILTER T4 | FILTER _.ID GREATER_THAN_OR_EQUALS q0.COL2 | MAP (_.B AS B) | MAP (_.B AS B) | DEFAULT NULL | FILTER _ NOT_NULL AS q1 RETURN (q0.COL2 AS COL2) }" - unorderedResult: [] - - query: select col1, col2 from t1 union all select col1 from t1 diff --git a/yaml-tests/yaml-tests.gradle b/yaml-tests/yaml-tests.gradle index 78ae11f487..ade002c5d2 100644 --- a/yaml-tests/yaml-tests.gradle +++ b/yaml-tests/yaml-tests.gradle @@ -96,8 +96,8 @@ ext.resolveOtherServer = { Set rejectedVersions -> 'classifier': 'all'], { version { - strictly '4.0.559.6' - // strictly '+' + // strictly '4.0.559.6' + strictly '+' if (rejectedVersions.size() > 0) { reject rejectedVersions.toArray(new String[0]) } @@ -141,7 +141,7 @@ static def getAttributesFromJar(File file) { ext.resolveManyServers = { -> Set selectedServers = new HashSet<>(); - return selectedServers + // return selectedServers Set rejectedVersions = new HashSet<>(); rejectedVersions.add('4.0.561.0') rejectedVersions.add('4.0.559.2') From e971ee83528bff424a29e8eeee47297ce3ff7caa Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Tue, 4 Mar 2025 19:27:25 +0000 Subject: [PATCH 52/62] Squashed commit of the following: commit c6b7cc0d8b06072ee9ccccc92788c2dd0be320b7 Author: Scott Dugas Date: Fri Feb 28 12:16:35 2025 -0500 Another test and referencing issue #3216 I figured out the proper behavior, and updated the comments when pattern is just an escape character. commit 545ba602346b221b152e261789ac59ade40d88c9 Author: Scott Dugas Date: Fri Feb 28 10:44:13 2025 -0500 Set supported_version for like.yamsql commit 63eb20f92f15a5a66aa112a6c694801791592a2b Author: Scott Dugas Date: Thu Feb 27 17:04:02 2025 -0500 Add some LIKE tests with single letter patterns This adds some tests of LIKE queries that have single letter patterns that actually match things. This is an effort to see if there are other oddities in this area. commit 582f49875d96b239610bd16bbc4213bdaca52bb7 Author: Scott Dugas Date: Thu Feb 27 17:03:15 2025 -0500 Improve error messages when failing to parse blocks I forgot to put my test_blocks in separate documents, and this helped me find my mistake. commit 9f8acdfdc3e326a03bec4516147362d2c0301cce Author: Scott Dugas Date: Thu Feb 27 16:03:51 2025 -0500 Fix continuation parsing for LIKE operators Previously, it would parse the query as the escape character, making continuations useless. i.e. `LIKE 'XYZ' ESCAPE 'XYZ'`, regardless of what the original query had for the escape character, if it had one. This Resolves: #3099 --- .../cascades/values/PatternForLikeValue.java | 2 +- .../plan/cascades/LikeOperatorValueTest.java | 41 ++++++++++++--- .../yamltests/CustomYamlConstructor.java | 5 ++ .../relational/yamltests/block/Block.java | 3 +- yaml-tests/src/test/resources/like.yamsql | 50 ++++++++++++++++++- 5 files changed, 89 insertions(+), 12 deletions(-) diff --git a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/values/PatternForLikeValue.java b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/values/PatternForLikeValue.java index 603766570a..e184f672ec 100644 --- a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/values/PatternForLikeValue.java +++ b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/values/PatternForLikeValue.java @@ -188,7 +188,7 @@ public PValue toValueProto(@Nonnull final PlanSerializationContext serialization public static PatternForLikeValue fromProto(@Nonnull final PlanSerializationContext serializationContext, @Nonnull final PPatternForLikeValue patternForLikeValueProto) { return new PatternForLikeValue(Value.fromValueProto(serializationContext, Objects.requireNonNull(patternForLikeValueProto.getPatternChild())), - Value.fromValueProto(serializationContext, Objects.requireNonNull(patternForLikeValueProto.getPatternChild()))); + Value.fromValueProto(serializationContext, Objects.requireNonNull(patternForLikeValueProto.getEscapeChild()))); } @Nonnull diff --git a/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/query/plan/cascades/LikeOperatorValueTest.java b/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/query/plan/cascades/LikeOperatorValueTest.java index 59cc073a80..3d87a6e26d 100644 --- a/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/query/plan/cascades/LikeOperatorValueTest.java +++ b/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/query/plan/cascades/LikeOperatorValueTest.java @@ -22,7 +22,10 @@ import com.apple.foundationdb.record.Bindings; import com.apple.foundationdb.record.EvaluationContext; +import com.apple.foundationdb.record.PlanHashable; +import com.apple.foundationdb.record.PlanSerializationContext; import com.apple.foundationdb.record.TestRecords7Proto; +import com.apple.foundationdb.record.planprotos.PLikeOperatorValue; import com.apple.foundationdb.record.query.plan.cascades.typing.Type; import com.apple.foundationdb.record.query.plan.cascades.typing.TypeRepository; import com.apple.foundationdb.record.query.plan.cascades.typing.Typed; @@ -33,6 +36,7 @@ import com.apple.foundationdb.record.query.plan.cascades.values.LikeOperatorValue; import com.apple.foundationdb.record.query.plan.cascades.values.Value; import com.apple.foundationdb.record.query.plan.plans.QueryResult; +import com.apple.foundationdb.record.query.plan.serialization.DefaultPlanSerializationRegistry; import com.google.common.collect.ImmutableList; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.extension.ExtensionContext; @@ -41,6 +45,7 @@ import org.junit.jupiter.params.provider.ArgumentsProvider; import org.junit.jupiter.params.provider.ArgumentsSource; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Optional; import java.util.stream.Stream; @@ -188,18 +193,38 @@ void testSemanticException(Value lhs, Value rhs, Value escapeChar) { } @ParameterizedTest - @SuppressWarnings({"rawtypes", "unchecked", "ConstantConditions"}) + @SuppressWarnings({"ConstantConditions"}) @ArgumentsSource(ValidInputArgumentsProvider.class) void testLike(String lhs, String rhs, final String escapeChar, Boolean result) { + final LikeOperatorValue value = createLikeOperatorValue(lhs, rhs, escapeChar); + Assertions.assertEquals(result, value.eval(null, evaluationContext)); + } + + @ParameterizedTest + @SuppressWarnings({"ConstantConditions"}) + @ArgumentsSource(ValidInputArgumentsProvider.class) + void testLikeSerialization(String lhs, String rhs, final String escapeChar, Boolean result) { + final LikeOperatorValue value = createLikeOperatorValue(lhs, rhs, escapeChar); + final PLikeOperatorValue proto = value.toProto( + new PlanSerializationContext(new DefaultPlanSerializationRegistry(), + PlanHashable.CURRENT_FOR_CONTINUATION)); + final LikeOperatorValue deserialized = LikeOperatorValue.fromProto(new PlanSerializationContext(new DefaultPlanSerializationRegistry(), + PlanHashable.CURRENT_FOR_CONTINUATION), proto); + Assertions.assertEquals(result, deserialized.eval(null, evaluationContext)); + } + + + @SuppressWarnings({"rawtypes", "unchecked", "ConstantConditions"}) + @Nonnull + private static LikeOperatorValue createLikeOperatorValue(final String lhs, final String rhs, final String escapeChar) { BuiltInFunction like = new LikeOperatorValue.LikeFn(); BuiltInFunction pattern = new PatternForLikeValue.PatternForLikeFn(); Typed value = like.encapsulate(Arrays.asList( - new LiteralValue<>(Type.primitiveType(Type.TypeCode.STRING), lhs), - pattern.encapsulate(Arrays.asList( - new LiteralValue<>(Type.primitiveType(Type.TypeCode.STRING), rhs), - new LiteralValue<>(Type.primitiveType(Type.TypeCode.STRING), escapeChar))))); - Assertions.assertTrue(value instanceof LikeOperatorValue); - Object actualValue = ((LikeOperatorValue)value).eval(null, evaluationContext); - Assertions.assertEquals(result, actualValue); + new LiteralValue<>(Type.primitiveType(Type.TypeCode.STRING), lhs), + pattern.encapsulate(Arrays.asList( + new LiteralValue<>(Type.primitiveType(Type.TypeCode.STRING), rhs), + new LiteralValue<>(Type.primitiveType(Type.TypeCode.STRING), escapeChar))))); + Assertions.assertInstanceOf(LikeOperatorValue.class, value); + return (LikeOperatorValue) value; } } diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/CustomYamlConstructor.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/CustomYamlConstructor.java index 1b3a801243..17c4dac38a 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/CustomYamlConstructor.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/CustomYamlConstructor.java @@ -132,6 +132,11 @@ public static LinedObject cast(@Nonnull Object obj, @Nonnull Supplier ms Assert.thatUnchecked(obj instanceof LinedObject, ErrorCode.INTERNAL_ERROR, msg); return (LinedObject) obj; } + + @Override + public String toString() { + return object + "@line:" + lineNumber; + } } private static class ConstructIgnore extends AbstractConstruct { diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/block/Block.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/block/Block.java index f1be808881..be6205406e 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/block/Block.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/block/Block.java @@ -53,7 +53,8 @@ public interface Block { */ static Block parse(@Nonnull Object document, int blockNumber, @Nonnull YamlExecutionContext executionContext) { final var blockObject = Matchers.map(document, "block"); - Assert.thatUnchecked(blockObject.size() == 1, "Illegal Format: A block is expected to be a map of size 1"); + Assert.thatUnchecked(blockObject.size() == 1, + "Illegal Format: A block is expected to be a map of size 1 (block: " + blockNumber + ") keys: " + blockObject.keySet()); final var entry = Matchers.firstEntry(blockObject, "block key-value"); final var linedObject = CustomYamlConstructor.LinedObject.cast(entry.getKey(), () -> "Invalid block key-value pair: " + entry); final var lineNumber = linedObject.getLineNumber(); diff --git a/yaml-tests/src/test/resources/like.yamsql b/yaml-tests/src/test/resources/like.yamsql index ab12895a6e..f3bdecfe25 100644 --- a/yaml-tests/src/test/resources/like.yamsql +++ b/yaml-tests/src/test/resources/like.yamsql @@ -17,9 +17,16 @@ # See the License for the specific language governing permissions and # limitations under the License. +--- +options: + # Prior to #3099 being fixed, every query that returned any data failed if there are continuations + # Without testing any continuations there's not a lot of value here to running with multi-server, + # So this is just being disabled entirely for older versions. + supported_version: !current_version # https://github.com/FoundationDB/fdb-record-layer/issues/3099 --- schema_template: create table A(a1 string, primary key(a1)) + create table B(b1 integer, b2 string, primary key(b1)) --- setup: steps: @@ -39,11 +46,49 @@ setup: ('{abcdefghijk}'), ('^$'), ('\\||%'); + - query: insert into B values + (1, 'Y'), + (2, 'Z'), + (3, 'A'), + (4, 'Z'), + (5, 'B'); --- -# TODO (Investigate `Missing binding for __const_CONSTANT` error with queries when using plan from cache) test_block: + # TODO (Investigate `Missing binding for __const_CONSTANT` error with queries when using plan from cache) preset: single_repetition_parallelized tests: + - + - query: select * from B WHERE B2 LIKE 'X' + - result: [] + - + - query: select * from B WHERE B2 LIKE 'Y' + - result: [{1, 'Y'}] + - + # Issue #3099 found that the pattern was being put in the escape part of the LIKE on continuation + # which for all the other queries, would result in an error that the escape should be of length 1. + # I added these queries to see if that issue would expose differently if the query was only one character, + # and it kind of did, it ended up exposing issue: https://github.com/FoundationDB/fdb-record-layer/issues/3216 + - query: select * from B WHERE B2 NOT LIKE 'Z' + - result: [{1, 'Y'}, {3, 'A'}, {5, 'B'}] + - + - query: select * from B WHERE B2 NOT LIKE 'Z' ESCAPE 'Z' + # This should error; see https://github.com/FoundationDB/fdb-record-layer/issues/3216 + - result: [{1, 'Y'}, {3, 'A'}, {5, 'B'}] + - + - query: select * from B WHERE B2 NOT LIKE '\' + # This should error; see https://github.com/FoundationDB/fdb-record-layer/issues/3216 + - result: [{1, 'Y'}, {2, 'Z'}, {3, 'A'}, {4, Z}, {5, 'B'}] + - + - query: select * from B WHERE B2 LIKE 'Z' + - result: [{2, 'Z'}, {4, 'Z'}] +--- +test_block: + # TODO (Investigate `Missing binding for __const_CONSTANT` error with queries when using plan from cache) + preset: single_repetition_parallelized + tests: + - + - query: select * from A WHERE A1 LIKE 'A' + - result: [] - - query: select * from A WHERE A1 LIKE 'abc' - result: [] @@ -152,5 +197,6 @@ test_block: {'学校'}, {'مدرسة'}, {'^$'}, - {'\\||%'} ] + {'\\||%'} + ] ... From eab73984dd4a8f15032569251e5ec31a28d01426 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Wed, 5 Mar 2025 12:48:33 +0000 Subject: [PATCH 53/62] tidy up a few test yamsqls --- .../relational/yamltests/YamlTestExtension.java | 2 +- .../aggregate-index-tests-count-empty.yamsql | 2 -- yaml-tests/src/test/resources/create-drop.yamsql | 14 ++++++-------- yaml-tests/src/test/resources/enum.yamsql | 7 +++---- yaml-tests/src/test/resources/functions.yamsql | 8 ++++---- yaml-tests/src/test/resources/insert-enum.yamsql | 6 +++--- .../test/resources/inserts-updates-deletes.yamsql | 8 ++++++-- .../test/resources/standard-tests-metadata.yamsql | 2 +- yaml-tests/src/test/resources/union.yamsql | 6 +++++- yaml-tests/yaml-tests.gradle | 6 +++--- 10 files changed, 32 insertions(+), 29 deletions(-) diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlTestExtension.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlTestExtension.java index ca04177308..1a6970b132 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlTestExtension.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlTestExtension.java @@ -67,7 +67,7 @@ public class YamlTestExtension implements TestTemplateInvocationContextProvider, @Override public void beforeAll(final ExtensionContext context) throws Exception { if (Boolean.parseBoolean(System.getProperty("tests.runQuick", "false"))) { - testConfigs = List.of(new ForceContinuations(new EmbeddedConfig())); + testConfigs = List.of(new EmbeddedConfig()); maintainConfigs = List.of(); } else { AtomicInteger serverPort = new AtomicInteger(1111); diff --git a/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql b/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql index 83f845c2cf..ef3b8f8fe2 100644 --- a/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql +++ b/yaml-tests/src/test/resources/aggregate-index-tests-count-empty.yamsql @@ -43,8 +43,6 @@ test_block: - result: [] - - query: select count(col1) from t1 - # FORCE_CONTINUATIONS does not work with versions before 4.1.4.0 due to limits not enforced "ON EMPTY" prior to https://github.com/FoundationDB/fdb-record-layer/pull/3092 - # Can remove once we no longer want to test versions prior to 4.1.4.0 - explain: "AISCAN(MV3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - initialVersionLessThan: 4.0.561.0 - result: [] diff --git a/yaml-tests/src/test/resources/create-drop.yamsql b/yaml-tests/src/test/resources/create-drop.yamsql index 4668557c36..62d92e7d0b 100644 --- a/yaml-tests/src/test/resources/create-drop.yamsql +++ b/yaml-tests/src/test/resources/create-drop.yamsql @@ -50,7 +50,6 @@ setup: - query: drop schema template if exists temp - query: drop database if exists /frl/DB - query: create schema template temp1 create table T1(a1 bigint, primary key(a1)) - --- test_block: connect: "jdbc:embed:/__SYS?schema=CATALOG" @@ -133,13 +132,12 @@ setup: - query: drop database if exists /frl/db --- test_block: - connect: "jdbc:embed:/__SYS?schema=CATALOG" - preset: single_repetition_ordered - tests: - - - - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' - - maxRows: 0 - - result: [{0}] + connect: "jdbc:embed:/__SYS?schema=CATALOG" + preset: single_repetition_ordered + tests: + - + - query: select count(*) from "DATABASES" where database_id = '/FRL/DB' + - result: [{0}] --- setup: connect: "jdbc:embed:/__SYS?schema=CATALOG" diff --git a/yaml-tests/src/test/resources/enum.yamsql b/yaml-tests/src/test/resources/enum.yamsql index 895907d89c..7776c64954 100644 --- a/yaml-tests/src/test/resources/enum.yamsql +++ b/yaml-tests/src/test/resources/enum.yamsql @@ -16,12 +16,11 @@ # 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. - -# 4.1-triage: [Ignored: Enum] enum support was not added to client until 4.1.6.0, none of these queries pass, all with: -# The comparand to a comparison expecting an argument of a primitive type, is invoked with an argument of a complex type, e.g. an array or a record. --- options: - supported_version: 4.1.6.0 + # Enum support was not added to client until 4.1.6.0, so prior to that version, none of these queries pass, all with: + # The comparand to a comparison expecting an argument of a primitive type, is invoked with an argument of a complex type, e.g. an array or a record. + supported_version: 4.1.6.0 --- schema_template: CREATE TYPE AS ENUM MOOD ( 'JOYFUL', 'HAPPY', 'RELAXED', 'INDIFFERENT', 'CONFUSED', 'SAD', 'ANXIOUS', 'ANGRY' ) diff --git a/yaml-tests/src/test/resources/functions.yamsql b/yaml-tests/src/test/resources/functions.yamsql index a7280f4d0a..d32e223cc8 100644 --- a/yaml-tests/src/test/resources/functions.yamsql +++ b/yaml-tests/src/test/resources/functions.yamsql @@ -128,10 +128,10 @@ test_block: - query: select coalesce(null, (1, 1.0, 'a', true)) from C - supported_version: !current_version # Force continuations does not on older versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3218 - unorderedResult: [ - {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, - {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, - {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, - {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}] + {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, + {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, + {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, + {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}] --- test_block: preset: single_repetition_ordered diff --git a/yaml-tests/src/test/resources/insert-enum.yamsql b/yaml-tests/src/test/resources/insert-enum.yamsql index ac61e5067d..cbb8927cbf 100644 --- a/yaml-tests/src/test/resources/insert-enum.yamsql +++ b/yaml-tests/src/test/resources/insert-enum.yamsql @@ -16,11 +16,11 @@ # 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. -# 4.1-triage: [Ignored: Enum] Enum support wasn't added until 4.1.6.0 All tests fail to insert enums with: -# Caused by: java.sql.SQLException: java.sql.Type=1111 not supported --- options: - supported_version: 4.1.6.0 + # Enum support wasn't added until 4.1.6.0. On older versions, all tests fail to insert enums with: + # Caused by: java.sql.SQLException: java.sql.Type=1111 not supported + supported_version: 4.1.6.0 --- schema_template: CREATE TYPE AS ENUM "WHATEVER" ( 'OWNING', 'WEAK', 'VALIDATING' ) diff --git a/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql b/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql index ecd35143c5..a24ff56084 100644 --- a/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql +++ b/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql @@ -106,7 +106,7 @@ test_block: { B1: 20, B2: 22, B3: { 6, 51 } }, { B1: 30, B2: 22, B3: { 7, 61 } } ] - - # Case where not all values are provided of A. Still works, since the columns for which no values are provided can be nullable. + # Case where not all values are provided of A. Fails as not all columns (specified in the query) can be matched - query: insert into A(A1, A2, A3) values (4); - initialVersionLessThan: 4.1.5.0 # Used to get an internal error prior to: https://github.com/FoundationDB/fdb-record-layer/pull/3070 @@ -114,7 +114,11 @@ test_block: - initialVersionAtLeast: 4.1.5.0 - error: "42601" - - # Case when the number of values is more than the number of columns specified. + # Case where not all values are provided of A. Fails as not all columns (from the schema template) can be matched + - query: insert into A values (4); + - error: "22000" + - + # Case when the number of values is more than the number of columns specified. - query: insert into A(A1, A2, A3) values (5, 6, 7, 8, 9); - initialVersionLessThan: 4.1.5.0 # Used to ignore extra column prior to: https://github.com/FoundationDB/fdb-record-layer/pull/3070 diff --git a/yaml-tests/src/test/resources/standard-tests-metadata.yamsql b/yaml-tests/src/test/resources/standard-tests-metadata.yamsql index 02379e8016..6ff6c15799 100644 --- a/yaml-tests/src/test/resources/standard-tests-metadata.yamsql +++ b/yaml-tests/src/test/resources/standard-tests-metadata.yamsql @@ -58,8 +58,8 @@ test_block: - result: [{ID: !l 5, !l 10, !l 5}] - - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; + - supported_version: !current_version - explain: "SCAN([EQUALS promote(@c23 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - maxRows: 0 - result: [{!l 1}] - # Copy of above query to simulate force continuations mode, which does not work prior to !current_version due to diff --git a/yaml-tests/src/test/resources/union.yamsql b/yaml-tests/src/test/resources/union.yamsql index e7d4cc104d..7967bc089e 100644 --- a/yaml-tests/src/test/resources/union.yamsql +++ b/yaml-tests/src/test/resources/union.yamsql @@ -165,11 +165,15 @@ test_block: - result: [{S: 2}] - - query: select sum(Y) as S from (select count(*) as Y from t3 union all select count(*) from t1) as X + # Does not work in force continuations mode on prior versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + # Hard to write asserts for on older versions, but no unexpected mixed mode issues when running with older versions - supported_version: !current_version - explain: "SCAN(<,>) | TFILTER T3 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS Y) | MAP (_.Y AS Y) ⊎ ISCAN(VI1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) | MAP (_ AS _0) | AGG (sum_l(_._0.Y) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS S)" - result: [{S: 5}] - - query: select col2 from t1 where exists (select a from t3 where col2 <= id union all select b from t4 where col2 <= id) + # Does not work in force continuations mode on prior versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 + # Hard to write asserts for on older versions, but no unexpected mixed mode issues when running with older versions - supported_version: !current_version - result: [{1}, {2}, {6}, {7}] - @@ -192,7 +196,7 @@ test_block: - result: [{0}] - # Copy of above query to simulate force_continuations before !current_version due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 - # Can remove once we no longer care about mixed mode with older versions + # Can remove (and remove `maxRows: 0` from above query) once we no longer care about mixed mode with older versions - query: select sum(Y) as S from (select count(*) as Y from t6 union all select count(*) from t7) as X - supported_version: 4.1.4.0 - maxRows: 1 diff --git a/yaml-tests/yaml-tests.gradle b/yaml-tests/yaml-tests.gradle index ade002c5d2..78ae11f487 100644 --- a/yaml-tests/yaml-tests.gradle +++ b/yaml-tests/yaml-tests.gradle @@ -96,8 +96,8 @@ ext.resolveOtherServer = { Set rejectedVersions -> 'classifier': 'all'], { version { - // strictly '4.0.559.6' - strictly '+' + strictly '4.0.559.6' + // strictly '+' if (rejectedVersions.size() > 0) { reject rejectedVersions.toArray(new String[0]) } @@ -141,7 +141,7 @@ static def getAttributesFromJar(File file) { ext.resolveManyServers = { -> Set selectedServers = new HashSet<>(); - // return selectedServers + return selectedServers Set rejectedVersions = new HashSet<>(); rejectedVersions.add('4.0.561.0') rejectedVersions.add('4.0.559.2') From 62d8e2aeab0bf1cf4787f974a08011b77647fa9c Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Wed, 5 Mar 2025 12:49:03 +0000 Subject: [PATCH 54/62] remove file also deleted on main --- .../yamltests/server/CodeVersion.java | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/CodeVersion.java diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/CodeVersion.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/CodeVersion.java deleted file mode 100644 index 08a4ba21bb..0000000000 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/CodeVersion.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * CodeVersion.java - * - * This source file is part of the FoundationDB open source project - * - * Copyright 2015-2025 Apple Inc. and the FoundationDB project authors - * - * Licensed 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. - */ - -package com.apple.foundationdb.relational.yamltests.server; - -/** - * Marker interface representing a code version. - */ -public interface CodeVersion extends Comparable { -} From c68d72be5716dba11c539cc7db51343ea2770ac6 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Wed, 5 Mar 2025 14:37:06 +0000 Subject: [PATCH 55/62] fix style error --- .../foundationdb/relational/yamltests/command/QueryExecutor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java index 97a8ec107e..5cd160478d 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java @@ -55,6 +55,7 @@ public class QueryExecutor { private static final Logger logger = LogManager.getLogger(QueryExecutor.class); private static final int FORCED_MAX_ROWS = 1; // The maxRows number to use when we are forcing it on the test private static final int MAX_CONTINUATIONS_ALLOWED = 100; + @SuppressWarnings("PMD.AvoidUsingHardCodedIP") // This is not an IP address private static final SemanticVersion STRICT_ASSERTIONS_CUTOFF = SemanticVersion.parse("4.1.9.0"); @Nonnull From 69cb4f41ae3c5b2024300d296443c3b4099fbb09 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Wed, 5 Mar 2025 14:37:47 +0000 Subject: [PATCH 56/62] pull latest release for external server instead of 4.0.559.6 --- yaml-tests/yaml-tests.gradle | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/yaml-tests/yaml-tests.gradle b/yaml-tests/yaml-tests.gradle index 78ae11f487..4fad273dcc 100644 --- a/yaml-tests/yaml-tests.gradle +++ b/yaml-tests/yaml-tests.gradle @@ -96,8 +96,7 @@ ext.resolveOtherServer = { Set rejectedVersions -> 'classifier': 'all'], { version { - strictly '4.0.559.6' - // strictly '+' + strictly '+' if (rejectedVersions.size() > 0) { reject rejectedVersions.toArray(new String[0]) } @@ -141,10 +140,7 @@ static def getAttributesFromJar(File file) { ext.resolveManyServers = { -> Set selectedServers = new HashSet<>(); - return selectedServers Set rejectedVersions = new HashSet<>(); - rejectedVersions.add('4.0.561.0') - rejectedVersions.add('4.0.559.2') while (selectedServers.size() < 50) { def serverFile = resolveOtherServer(rejectedVersions) def attributes = getAttributesFromJar(serverFile) From 50d83e44fecdb82164291b4136df27de60958095 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Wed, 5 Mar 2025 14:41:00 +0000 Subject: [PATCH 57/62] revert change that was only necessary to support ForceContinuations(Embedded) --- .../yamltests/command/QueryExecutor.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java index 5cd160478d..2774b295f2 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java @@ -148,15 +148,13 @@ private Object executeStatementAndCheckCacheIfNeeded(@Nonnull Statement s, final preMetricCollector.getCountsForCounter(RelationalMetric.RelationalCount.PLAN_CACHE_TERTIARY_HIT) : 0; final var toReturn = executeStatementAndCheckForceContinuations(s, statementHasQuery, queryString, connection, maxRows); final var postMetricCollector = connection.getMetricCollector(); - if (postMetricCollector != null) { - final var postValue = postMetricCollector.hasCounter(RelationalMetric.RelationalCount.PLAN_CACHE_TERTIARY_HIT) ? - postMetricCollector.getCountsForCounter(RelationalMetric.RelationalCount.PLAN_CACHE_TERTIARY_HIT) : 0; - final var planFound = preMetricCollector != postMetricCollector ? postValue == 1 : postValue == preValue + 1; - if (!planFound) { - reportTestFailure("‼️ Expected to retrieve the plan from the cache at line " + lineNumber); - } else { - logger.debug("🎁 Retrieved the plan from the cache!"); - } + final var postValue = postMetricCollector.hasCounter(RelationalMetric.RelationalCount.PLAN_CACHE_TERTIARY_HIT) ? + postMetricCollector.getCountsForCounter(RelationalMetric.RelationalCount.PLAN_CACHE_TERTIARY_HIT) : 0; + final var planFound = preMetricCollector != postMetricCollector ? postValue == 1 : postValue == preValue + 1; + if (!planFound) { + reportTestFailure("‼️ Expected to retrieve the plan from the cache at line " + lineNumber); + } else { + logger.debug("🎁 Retrieved the plan from the cache!"); } return toReturn; } From 6cbe6722c03c57dfc44daca2328ed2f92ccb1887 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Thu, 6 Mar 2025 17:56:11 +0000 Subject: [PATCH 58/62] add logging when ignoring beginning continuation chekc --- .../yamltests/command/QueryExecutor.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java index 2774b295f2..4e5e05bb8c 100644 --- a/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java +++ b/yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/command/QueryExecutor.java @@ -109,11 +109,8 @@ public Continuation execute(@Nonnull YamlConnection connection, @Nullable Contin if (continuation == null) { // no continuation - start the query execution from the beginning return executeQuery(connection, config, currentQuery, checkCache, maxRows); - } else if (continuation.atBeginning()) { + } else if (checkBeginningContinuation(continuation, connection)) { // Continuation cannot be at beginning if it was returned from a query - if (STRICT_ASSERTIONS_CUTOFF.lesserVersions(connection.getVersions()).isEmpty()) { - reportTestFailure("Received continuation shouldn't be at beginning"); - } return ContinuationImpl.END; } else { // Have a continuation - continue @@ -268,10 +265,7 @@ private Object executeStatementWithForcedContinuations(final @Nonnull Statement Continuation continuation = resultSet.getContinuation(); int count = 0; while (!continuation.atEnd()) { - if (continuation.atBeginning()) { - if (STRICT_ASSERTIONS_CUTOFF.lesserVersions(connection.getVersions()).isEmpty()) { - reportTestFailure("Received continuation shouldn't be at beginning"); - } + if (checkBeginningContinuation(continuation, connection)) { continuation = ContinuationImpl.END; break; } @@ -302,6 +296,20 @@ private Object executeStatementWithForcedContinuations(final @Nonnull Statement } } + private boolean checkBeginningContinuation(Continuation continuation, YamlConnection connection) { + if (continuation.atBeginning()) { + if (STRICT_ASSERTIONS_CUTOFF.lesserVersions(connection.getVersions()).isEmpty()) { + reportTestFailure("Received continuation shouldn't be at beginning"); + } + if (logger.isInfoEnabled()) { + logger.info("ignoring beginning continuation check for query '{}' at line {} (connection: {})", + query, lineNumber, connection.getVersions()); + } + return true; + } + return false; + } + private static Object executeStatement(@Nonnull Statement s, final boolean statementHasQuery, @Nonnull String q) throws SQLException { final var execResult = statementHasQuery ? ((PreparedStatement) s).execute() : s.execute(q); return execResult ? s.getResultSet() : s.getUpdateCount(); From c81c23c9950ca9a4c017841a90fac60a3b5b4e81 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Thu, 6 Mar 2025 18:14:24 +0000 Subject: [PATCH 59/62] update aggregate-empty-table.yamsql * Removes setting of `single_repetition_ordered` * Adds additional explains for more queries * Removes force_continuations exclusions where possible --- .../aggregate-empty-table.metrics.binpb | 606 +++++++++++++++--- .../aggregate-empty-table.metrics.yaml | 530 +++++++++++---- .../resources/aggregate-empty-table.yamsql | 58 +- 3 files changed, 932 insertions(+), 262 deletions(-) diff --git a/yaml-tests/src/test/resources/aggregate-empty-table.metrics.binpb b/yaml-tests/src/test/resources/aggregate-empty-table.metrics.binpb index 599fc2adbf..7d82373796 100644 --- a/yaml-tests/src/test/resources/aggregate-empty-table.metrics.binpb +++ b/yaml-tests/src/test/resources/aggregate-empty-table.metrics.binpb @@ -1,7 +1,7 @@  9 agg-empty-table-tests EXPLAIN select count(*) from T1; -۸W Г(0,8@SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +W ϔ(0"8@SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -18,10 +18,10 @@ 6 -> 5 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} H -agg-empty-table-tests/EXPLAIN select count(*) from T1 where col1 = 0; -j ~(08@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests/EXPLAIN select count(*) from T1 where col1 = 0; +вj ח(0/8@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -43,7 +43,7 @@ H } H agg-empty-table-tests/EXPLAIN select count(*) from T1 where col1 > 0; -j ϵ(0-8@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +ɏj (088@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -62,10 +62,10 @@ H 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} 9 -agg-empty-table-tests EXPLAIN select count(*) from T2; -  ν(20߷W8+@AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests EXPLAIN select count(*) from T2; + (20Ʀ8+@AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -78,10 +78,11 @@ H 4 -> 3 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} H -agg-empty-table-tests/EXPLAIN select count(*) from T2 where col1 = 0; - (<0ޥt81@AISCAN(T2_I2 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests/EXPLAIN select count(*) from T2 where col1 = 0; + + (<081@AISCAN(T2_I2 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -97,7 +98,7 @@ H } H agg-empty-table-tests/EXPLAIN select count(*) from T2 where col1 > 0; -  (.098@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +Š (.0b8@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -119,7 +120,8 @@ H } G agg-empty-table-tests.EXPLAIN select count(*) from T2 group by col1; -a (*0ɾ8 @MAISCAN(T2_I2 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) +ܶ +a (*0 8 @MAISCAN(T2_I2 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -132,8 +134,7 @@ digraph G { } V agg-empty-table-tests=EXPLAIN select count(*) from T2 where col1 = 0 group by col1; -倱a 曫 -(*08 @hAISCAN(T2_I2 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) + a (*08 @hAISCAN(T2_I2 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -146,7 +147,7 @@ digraph G { } V agg-empty-table-tests=EXPLAIN select count(*) from T2 where col1 > 0 group by col1; -a (*08 @pAISCAN(T2_I2 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) +ĭ a վ(*08 @pAISCAN(T2_I2 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -156,10 +157,10 @@ digraph G { 3 [ label=<
Index
T2_I2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} 9 -agg-empty-table-tests EXPLAIN select count(*) from T3; -D ((,0ۻ8K@ISCAN(T3_I2 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests EXPLAIN select count(*) from T3; + (,0U8K@ISCAN(T3_I2 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -177,7 +178,7 @@ digraph G { } H agg-empty-table-tests/EXPLAIN select count(*) from T3 where col1 = 0; - (208g@ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +ӏ (20ޟ8g@ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -195,7 +196,7 @@ H } H agg-empty-table-tests/EXPLAIN select count(*) from T3 where col1 > 0; -߀  (508l@ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +M /(508l@ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -213,7 +214,7 @@ H } G agg-empty-table-tests.EXPLAIN select count(*) from T3 group by col1; -蚌H ʼ(08@mISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { +;H Ҳ((0}8@mISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -229,7 +230,7 @@ G } V agg-empty-table-tests=EXPLAIN select count(*) from T3 where col1 = 0 group by col1; -a (0Q8 @ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { +Ȣa (0ר8 @ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -242,10 +243,10 @@ V 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} V -agg-empty-table-tests=EXPLAIN select count(*) from T3 where col1 > 0 group by col1; ->a '(08 @ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { +agg-empty-table-tests=EXPLAIN select count(*) from T3 where col1 > 0 group by col1; +a (0ڧ8 @ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -261,7 +262,7 @@ V } < agg-empty-table-tests#EXPLAIN select count(col2) from T1; -̦;W Ӯ%(0و8@SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +˯<W '(08@SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -281,7 +282,7 @@ V } K agg-empty-table-tests2EXPLAIN select count(col2) from T1 where col1 = 0; -ؕj (0Ԁ%8@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +j (008@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -303,7 +304,7 @@ K } K agg-empty-table-tests2EXPLAIN select count(col2) from T1 where col1 > 0; -j (018@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +쉄j (028@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -322,10 +323,10 @@ K 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} < -agg-empty-table-tests#EXPLAIN select count(col2) from T2; - (208+@AISCAN(T2_I3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests#EXPLAIN select count(col2) from T2; +п  (20[8+@AISCAN(T2_I3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -341,7 +342,7 @@ K } K agg-empty-table-tests2EXPLAIN select count(col2) from T2 where col1 = 0; - ъ(<0㧄81@AISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + ʒ(<0ూ81@AISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -357,7 +358,7 @@ K } K agg-empty-table-tests2EXPLAIN select count(col2) from T2 where col1 > 0; -ⶖ ս(.08@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +  Ѷ(.0)8@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -379,7 +380,7 @@ K } J agg-empty-table-tests1EXPLAIN select count(col2) from T2 group by col1; -6a '(*0/8 @MAISCAN(T2_I4 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) +՜8a +(*0&8 @MAISCAN(T2_I4 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -392,7 +393,7 @@ digraph G { } Y agg-empty-table-tests@EXPLAIN select count(col2) from T2 where col1 = 0 group by col1; -ιa (*0 8 @hAISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) +ކa (*0 8 @hAISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -405,7 +406,7 @@ digraph G { } Y agg-empty-table-tests@EXPLAIN select count(col2) from T2 where col1 > 0 group by col1; -ެa (*08 @pAISCAN(T2_I4 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) +Ҩ a (*068 @pAISCAN(T2_I4 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -415,10 +416,10 @@ digraph G { 3 [ label=<
Index
T2_I4
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} < -agg-empty-table-tests#EXPLAIN select count(col2) from T3; - ²(,0N8K@ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests#EXPLAIN select count(col2) from T3; +  (,0ᤐ8K@ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -433,10 +434,11 @@ digraph G { 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} K -agg-empty-table-tests2EXPLAIN select count(col2) from T3 where col1 = 0; - (208g@ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests2EXPLAIN select count(col2) from T3 where col1 = 0; + + (20U8g@ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -451,10 +453,11 @@ K 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} K -agg-empty-table-tests2EXPLAIN select count(col2) from T3 where col1 > 0; -  ǽ(508l@ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +agg-empty-table-tests2EXPLAIN select count(col2) from T3 where col1 > 0; + + (50s8l@ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -472,7 +475,8 @@ K } J agg-empty-table-tests1EXPLAIN select count(col2) from T3 group by col1; -ۅH Ͷ(08@pISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { + +H (0n8@pISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -488,7 +492,7 @@ J } Y agg-empty-table-tests@EXPLAIN select count(col2) from T3 where col1 = 0 group by col1; -a (0Ο8 @ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { +ʝa (0ի8 @ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -504,8 +508,7 @@ Y } Y agg-empty-table-tests@EXPLAIN select count(col2) from T3 where col1 > 0 group by col1; -Ԅ -a (0P8 @ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { +ψ a (0"8 @ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -521,7 +524,7 @@ Y } : agg-empty-table-tests!EXPLAIN select sum(col1) from T1; -W ߨ(0:8@kSCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +ᣲW ȸ(078@kSCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -538,10 +541,10 @@ Y 6 -> 5 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} I -agg-empty-table-tests0EXPLAIN select sum(col1) from T1 where col1 = 0; -j ԋ(08@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +agg-empty-table-tests0EXPLAIN select sum(col1) from T1 where col1 = 0; +j 绩(08@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -560,10 +563,10 @@ I 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} I -agg-empty-table-tests0EXPLAIN select sum(col1) from T1 where col2 = 0; -Ζj 楃(098@SCAN(<,>) | TFILTER T1 | FILTER _.COL2 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +agg-empty-table-tests0EXPLAIN select sum(col1) from T1 where col2 = 0; +j v(08@SCAN(<,>) | TFILTER T1 | FILTER _.COL2 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -585,7 +588,7 @@ I } I agg-empty-table-tests0EXPLAIN select sum(col1) from T1 where col1 > 0; -ʉj (028@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +j 覯(0,8@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -607,7 +610,7 @@ I } I agg-empty-table-tests0EXPLAIN select sum(col1) from T1 where col2 > 0; -j ˚(0?8@SCAN(<,>) | TFILTER T1 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +j (0-8@SCAN(<,>) | TFILTER T1 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -626,10 +629,10 @@ I 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} : -agg-empty-table-tests!EXPLAIN select sum(col1) from T2; -ʐ (2098+@cAISCAN(T2_I5 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +agg-empty-table-tests!EXPLAIN select sum(col1) from T2; +E ߃1(20Ĕ8+@cAISCAN(T2_I5 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -645,7 +648,7 @@ I } I agg-empty-table-tests0EXPLAIN select sum(col1) from T2 where col1 = 0; - ѵ(.0A8@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +  (.0 8@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -664,10 +667,10 @@ I 7 -> 6 [ label=< q73> label="q73" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} I -agg-empty-table-tests0EXPLAIN select sum(col1) from T2 where col2 = 0; - (<0V81@AISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +agg-empty-table-tests0EXPLAIN select sum(col1) from T2 where col2 = 0; + (<081@AISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -683,7 +686,7 @@ I } I agg-empty-table-tests0EXPLAIN select sum(col1) from T2 where col1 > 0; -߭ (.098@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + ܰ(.0&8@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -705,8 +708,7 @@ I } I agg-empty-table-tests0EXPLAIN select sum(col1) from T2 where col2 > 0; - - (.0+8@SCAN(<,>) | TFILTER T2 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +ʿ (.0ȼJ8@SCAN(<,>) | TFILTER T2 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -728,7 +730,7 @@ I } W agg-empty-table-tests>EXPLAIN select sum(col1) from T2 where col2 = 0 group by col2; -a (*08 @hAISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) +ߒ a (*0 8 @hAISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -741,7 +743,7 @@ digraph G { } W agg-empty-table-tests>EXPLAIN select sum(col1) from T2 where col2 > 0 group by col2; -Ãa (*0 8 @pAISCAN(T2_I6 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) + a (*0Ϛ8 @pAISCAN(T2_I6 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0) digraph G { fontname=courier; rankdir=BT; @@ -751,10 +753,10 @@ digraph G { 3 [ label=<
Index
T2_I6
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} : -agg-empty-table-tests!EXPLAIN select sum(col1) from T3; -  (,08K@eISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +agg-empty-table-tests!EXPLAIN select sum(col1) from T3; +  (,0{8K@eISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -772,7 +774,7 @@ digraph G { } I agg-empty-table-tests0EXPLAIN select sum(col1) from T3 where col1 = 0; - (20^8g@ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + ȳ(20V8g@ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -790,7 +792,7 @@ I } I agg-empty-table-tests0EXPLAIN select sum(col1) from T3 where col2 = 0; -خ (208g@ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + դ(20ߊ8g@ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -808,7 +810,7 @@ I } I agg-empty-table-tests0EXPLAIN select sum(col1) from T3 where col1 > 0; -  (508l@ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +  (508l@ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -826,7 +828,7 @@ I } I agg-empty-table-tests0EXPLAIN select sum(col1) from T3 where col2 > 0; -E )(508l@ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { +L ɜ.(508l@ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -841,10 +843,10 @@ I 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} W -agg-empty-table-tests>EXPLAIN select sum(col1) from T3 where col1 = 0 group by col2; -?_ )(0䱧8@ISCAN(T3_I2 <,>) | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { +agg-empty-table-tests>EXPLAIN select sum(col1) from T3 where col1 = 0 group by col2; +_ ׺(08@ISCAN(T3_I2 <,>) | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -862,7 +864,8 @@ W } W agg-empty-table-tests>EXPLAIN select sum(col1) from T3 where col2 = 0 group by col2; -a (08 @ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { + +a (08 @ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -875,10 +878,10 @@ W 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} W -agg-empty-table-tests>EXPLAIN select sum(col1) from T3 where col1 > 0 group by col2; ->_ )(0ɪ8@ISCAN(T3_I2 <,>) | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { +agg-empty-table-tests>EXPLAIN select sum(col1) from T3 where col1 > 0 group by col2; +_ (0Ҋ8@ISCAN(T3_I2 <,>) | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -896,7 +899,7 @@ W } W agg-empty-table-tests>EXPLAIN select sum(col1) from T3 where col2 > 0 group by col2; - a (0:8 @ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { +빎a (08 @ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -912,7 +915,7 @@ W } M )agg-empty-table-tests-after-modifications EXPLAIN select count(*) from T1; -۸W Г(0,8@SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +W ϔ(0"8@SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -929,10 +932,10 @@ M 6 -> 5 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} \ -)agg-empty-table-tests-after-modifications/EXPLAIN select count(*) from T1 where col1 = 0; -j ~(08@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +)agg-empty-table-tests-after-modifications/EXPLAIN select count(*) from T1 where col1 = 0; +вj ח(0/8@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -954,7 +957,7 @@ M } \ )agg-empty-table-tests-after-modifications/EXPLAIN select count(*) from T1 where col1 > 0; -j ϵ(0-8@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +ɏj (088@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -973,10 +976,10 @@ M 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -} +} M -)agg-empty-table-tests-after-modifications EXPLAIN select count(*) from T2; -  ν(20߷W8+@AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { +)agg-empty-table-tests-after-modifications EXPLAIN select count(*) from T2; + (20Ʀ8+@AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { fontname=courier; rankdir=BT; splines=polyline; @@ -989,4 +992,419 @@ M 4 -> 3 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +P +)agg-empty-table-tests-after-modifications#EXPLAIN select count(col2) from T2; +п  (20[8+@AISCAN(T2_I3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Value Computation
MAP (q4 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Index Scan
scan type: BY_GROUP
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 5 [ label=<
Index
T2_I3
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +_ +)agg-empty-table-tests-after-modifications2EXPLAIN select count(col2) from T2 where col1 = 0; + ʒ(<0ూ81@AISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Value Computation
MAP ((q4._1 AS _0) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Index Scan
scan type: BY_GROUP
comparisons: [EQUALS promote(@c11 AS LONG)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, )" ]; + 5 [ label=<
Index
T2_I4
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +_ +)agg-empty-table-tests-after-modifications2EXPLAIN select count(col2) from T2 where col1 > 0; +  Ѷ(.0)8@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count(q86._0.COL2) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q77 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Predicate Filter
WHERE q2.COL1 GREATER_THAN promote(@c11 AS LONG)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Type Filter
WHERE record IS [T2]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Primary Storage
record types: [T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q86> label="q86" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q77> label="q77" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q73> label="q73" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +P +)agg-empty-table-tests-after-modifications#EXPLAIN select count(col2) from T3; +  (,0ᤐ8K@ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count(q59._0.COL2) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Index
T3_I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q59> label="q59" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +_ +)agg-empty-table-tests-after-modifications2EXPLAIN select count(col2) from T3 where col1 = 0; + + (20U8g@ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count(q78._0.COL2) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Index Scan
comparisons: [EQUALS promote(@c11 AS LONG)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Index
T3_I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q78> label="q78" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +_ +)agg-empty-table-tests-after-modifications2EXPLAIN select count(col2) from T3 where col1 > 0; + + (50s8l@ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (coalesce_long(q6._0._0, promote(0l AS LONG)) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (count(q78._0.COL2) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Index Scan
comparisons: [[GREATER_THAN promote(@c11 AS LONG)]]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Index
T3_I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q78> label="q78" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +^ +)agg-empty-table-tests-after-modifications1EXPLAIN select count(col2) from T3 group by col1; + +H (0n8@pISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._1._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Streaming Aggregate
COLLECT (count(q40._0.COL2) AS _0)
GROUP BY (q40._0.COL1 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0, )" ]; + 3 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 4 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 5 [ label=<
Index
T3_I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q40> label="q40" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +m +)agg-empty-table-tests-after-modifications@EXPLAIN select count(col2) from T3 where col1 = 0 group by col1; +ʝa (0ի8 @ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._1._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Streaming Aggregate
COLLECT (count(q48._0.COL2) AS _0)
GROUP BY (q48._0.COL1 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0, )" ]; + 3 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 4 [ label=<
Index Scan
comparisons: [EQUALS promote(@c11 AS LONG)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 5 [ label=<
Index
T3_I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q48> label="q48" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +m +)agg-empty-table-tests-after-modifications@EXPLAIN select count(col2) from T3 where col1 > 0 group by col1; +ψ a (0"8 @ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._1._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Streaming Aggregate
COLLECT (count(q48._0.COL2) AS _0)
GROUP BY (q48._0.COL1 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0, )" ]; + 3 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 4 [ label=<
Index Scan
comparisons: [[GREATER_THAN promote(@c11 AS LONG)]]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 5 [ label=<
Index
T3_I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q48> label="q48" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +N +)agg-empty-table-tests-after-modifications!EXPLAIN select sum(col1) from T1; +ᣲW ȸ(078@kSCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q27._0.COL1) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 7 [ label=<
Primary Storage
record types: [T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q27> label="q27" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +] +)agg-empty-table-tests-after-modifications0EXPLAIN select sum(col1) from T1 where col1 = 0; +j 绩(08@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q32._0.COL1) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q23 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Predicate Filter
WHERE q2.COL1 EQUALS promote(@c11 AS LONG)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Primary Storage
record types: [T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q32> label="q32" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +] +)agg-empty-table-tests-after-modifications0EXPLAIN select sum(col1) from T1 where col2 = 0; +j v(08@SCAN(<,>) | TFILTER T1 | FILTER _.COL2 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q32._0.COL1) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q23 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Predicate Filter
WHERE q2.COL2 EQUALS promote(@c11 AS LONG)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Primary Storage
record types: [T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q32> label="q32" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +] +)agg-empty-table-tests-after-modifications0EXPLAIN select sum(col1) from T1 where col1 > 0; +j 覯(0,8@SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q32._0.COL1) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q23 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Predicate Filter
WHERE q2.COL1 GREATER_THAN promote(@c11 AS LONG)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Primary Storage
record types: [T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q32> label="q32" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +] +)agg-empty-table-tests-after-modifications0EXPLAIN select sum(col1) from T1 where col2 > 0; +j (0-8@SCAN(<,>) | TFILTER T1 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q32._0.COL1) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q23 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Predicate Filter
WHERE q2.COL2 GREATER_THAN promote(@c11 AS LONG)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Type Filter
WHERE record IS [T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Primary Storage
record types: [T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q32> label="q32" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q23> label="q23" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q19> label="q19" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +N +)agg-empty-table-tests-after-modifications!EXPLAIN select sum(col1) from T2; +E ߃1(20Ĕ8+@cAISCAN(T2_I5 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Value Computation
MAP (q4 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Index Scan
scan type: BY_GROUP
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 5 [ label=<
Index
T2_I5
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +] +)agg-empty-table-tests-after-modifications0EXPLAIN select sum(col1) from T2 where col2 = 0; + (<081@AISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Value Computation
MAP ((q4._1 AS _0) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Index Scan
scan type: BY_GROUP
comparisons: [EQUALS promote(@c11 AS LONG)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, )" ]; + 5 [ label=<
Index
T2_I6
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +] +)agg-empty-table-tests-after-modifications0EXPLAIN select sum(col1) from T2 where col1 > 0; + ܰ(.0&8@SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q86._0.COL1) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q77 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Predicate Filter
WHERE q2.COL1 GREATER_THAN promote(@c11 AS LONG)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Type Filter
WHERE record IS [T2]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Primary Storage
record types: [T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q86> label="q86" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q77> label="q77" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q73> label="q73" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +] +)agg-empty-table-tests-after-modifications0EXPLAIN select sum(col1) from T2 where col2 > 0; +ʿ (.0ȼJ8@SCAN(<,>) | TFILTER T2 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q86._0.COL1) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q77 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Predicate Filter
WHERE q2.COL2 GREATER_THAN promote(@c11 AS LONG)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Type Filter
WHERE record IS [T2]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 7 [ label=<
Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 8 [ label=<
Primary Storage
record types: [T1, T2, T3]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(RECORD)" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q86> label="q86" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q77> label="q77" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q73> label="q73" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +] +)agg-empty-table-tests-after-modifications0EXPLAIN select sum(col1) from T3 where col1 = 0; + ȳ(20V8g@ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q78._0.COL1) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Index Scan
comparisons: [EQUALS promote(@c11 AS LONG)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Index
T3_I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q78> label="q78" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +] +)agg-empty-table-tests-after-modifications0EXPLAIN select sum(col1) from T3 where col2 = 0; + դ(20ߊ8g@ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q80._0.COL1) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Index Scan
comparisons: [EQUALS promote(@c11 AS LONG)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Index
T3_I2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q80> label="q80" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +] +)agg-empty-table-tests-after-modifications0EXPLAIN select sum(col1) from T3 where col1 > 0; +  (508l@ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q78._0.COL1) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Index Scan
comparisons: [[GREATER_THAN promote(@c11 AS LONG)]]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Index
T3_I1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q78> label="q78" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +} +] +)agg-empty-table-tests-after-modifications0EXPLAIN select sum(col1) from T3 where col2 > 0; +L ɜ.(508l@ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)digraph G { + fontname=courier; + rankdir=BT; + splines=polyline; + 1 [ label=<
Value Computation
MAP (q6._0._0 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 2 [ label=<
Value Computation
$q6 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 3 [ label=<
Streaming Aggregate
COLLECT (sum_l(q80._0.COL1) AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0 AS _0)" ]; + 4 [ label=<
Value Computation
MAP (q2 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, AS _0)" ]; + 5 [ label=<
Index Scan
comparisons: [[GREATER_THAN promote(@c11 AS LONG)]]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 6 [ label=<
Index
T3_I2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, )" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q80> label="q80" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; } \ No newline at end of file diff --git a/yaml-tests/src/test/resources/aggregate-empty-table.metrics.yaml b/yaml-tests/src/test/resources/aggregate-empty-table.metrics.yaml index 606e9c3ad5..beb48f13a9 100644 --- a/yaml-tests/src/test/resources/aggregate-empty-table.metrics.yaml +++ b/yaml-tests/src/test/resources/aggregate-empty-table.metrics.yaml @@ -3,7 +3,7 @@ agg-empty-table-tests: explain: SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 263 - task_total_time_ms: 8 + task_total_time_ms: 6 transform_count: 87 transform_time_ms: 2 transform_yield_count: 15 @@ -15,9 +15,9 @@ agg-empty-table-tests: MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 335 - task_total_time_ms: 6 + task_total_time_ms: 11 transform_count: 106 - transform_time_ms: 2 + transform_time_ms: 4 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -27,9 +27,9 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 335 - task_total_time_ms: 11 + task_total_time_ms: 12 transform_count: 106 - transform_time_ms: 5 + transform_time_ms: 6 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -38,11 +38,11 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)' task_count: 450 - task_total_time_ms: 24 + task_total_time_ms: 35 transform_count: 158 - transform_time_ms: 15 + transform_time_ms: 25 transform_yield_count: 50 - insert_time_ms: 1 + insert_time_ms: 2 insert_new_count: 43 insert_reused_count: 4 - query: EXPLAIN select count(*) from T2 where col1 = 0; @@ -50,11 +50,11 @@ agg-empty-table-tests: _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)' task_count: 538 - task_total_time_ms: 37 + task_total_time_ms: 22 transform_count: 182 - transform_time_ms: 25 + transform_time_ms: 13 transform_yield_count: 60 - insert_time_ms: 1 + insert_time_ms: 3 insert_new_count: 49 insert_reused_count: 4 - query: EXPLAIN select count(*) from T2 where col1 > 0; @@ -62,20 +62,20 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 393 - task_total_time_ms: 25 + task_total_time_ms: 44 transform_count: 135 - transform_time_ms: 18 + transform_time_ms: 34 transform_yield_count: 46 - insert_time_ms: 0 + insert_time_ms: 1 insert_new_count: 28 insert_reused_count: 2 - query: EXPLAIN select count(*) from T2 group by col1; explain: 'AISCAN(T2_I2 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 10 + task_total_time_ms: 21 transform_count: 97 - transform_time_ms: 7 + transform_time_ms: 16 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -84,9 +84,9 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I2 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 30 + task_total_time_ms: 26 transform_count: 97 - transform_time_ms: 21 + transform_time_ms: 18 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -95,9 +95,9 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I2 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 9 + task_total_time_ms: 23 transform_count: 97 - transform_time_ms: 6 + transform_time_ms: 17 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -106,11 +106,11 @@ agg-empty-table-tests: explain: ISCAN(T3_I2 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 509 - task_total_time_ms: 143 + task_total_time_ms: 16 transform_count: 151 - transform_time_ms: 85 + transform_time_ms: 6 transform_yield_count: 44 - insert_time_ms: 9 + insert_time_ms: 1 insert_new_count: 75 insert_reused_count: 6 - query: EXPLAIN select count(*) from T3 where col1 = 0; @@ -118,9 +118,9 @@ agg-empty-table-tests: AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 730 - task_total_time_ms: 29 + task_total_time_ms: 44 transform_count: 215 - transform_time_ms: 10 + transform_time_ms: 15 transform_yield_count: 50 insert_time_ms: 2 insert_new_count: 103 @@ -130,55 +130,55 @@ agg-empty-table-tests: AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 757 - task_total_time_ms: 27 + task_total_time_ms: 161 transform_count: 218 - transform_time_ms: 7 + transform_time_ms: 99 transform_yield_count: 53 - insert_time_ms: 2 + insert_time_ms: 10 insert_new_count: 108 insert_reused_count: 5 - query: EXPLAIN select count(*) from T3 group by col1; explain: ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0) task_count: 220 - task_total_time_ms: 6 + task_total_time_ms: 125 transform_count: 72 - transform_time_ms: 3 + transform_time_ms: 84 transform_yield_count: 26 - insert_time_ms: 0 + insert_time_ms: 2 insert_new_count: 18 insert_reused_count: 2 - query: EXPLAIN select count(*) from T3 where col1 = 0 group by col1; explain: ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0) task_count: 317 - task_total_time_ms: 33 + task_total_time_ms: 13 transform_count: 97 - transform_time_ms: 13 + transform_time_ms: 4 transform_yield_count: 30 - insert_time_ms: 1 + insert_time_ms: 0 insert_new_count: 32 insert_reused_count: 1 - query: EXPLAIN select count(*) from T3 where col1 > 0 group by col1; explain: ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count_star(*) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0) task_count: 317 - task_total_time_ms: 131 + task_total_time_ms: 16 transform_count: 97 - transform_time_ms: 83 + transform_time_ms: 7 transform_yield_count: 30 - insert_time_ms: 2 + insert_time_ms: 0 insert_new_count: 32 insert_reused_count: 1 - query: EXPLAIN select count(col2) from T1; explain: SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 263 - task_total_time_ms: 124 + task_total_time_ms: 126 transform_count: 87 - transform_time_ms: 78 + transform_time_ms: 83 transform_yield_count: 15 - insert_time_ms: 6 + insert_time_ms: 5 insert_new_count: 22 insert_reused_count: 2 - query: EXPLAIN select count(col2) from T1 where col1 = 0; @@ -186,9 +186,9 @@ agg-empty-table-tests: MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 335 - task_total_time_ms: 8 + task_total_time_ms: 13 transform_count: 106 - transform_time_ms: 2 + transform_time_ms: 5 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -198,9 +198,9 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 335 - task_total_time_ms: 10 + task_total_time_ms: 12 transform_count: 106 - transform_time_ms: 3 + transform_time_ms: 4 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -209,11 +209,11 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)' task_count: 450 - task_total_time_ms: 18 + task_total_time_ms: 19 transform_count: 158 - transform_time_ms: 9 + transform_time_ms: 10 transform_yield_count: 50 - insert_time_ms: 2 + insert_time_ms: 1 insert_new_count: 43 insert_reused_count: 4 - query: EXPLAIN select count(col2) from T2 where col1 = 0; @@ -221,11 +221,11 @@ agg-empty-table-tests: _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)' task_count: 538 - task_total_time_ms: 49 + task_total_time_ms: 52 transform_count: 182 - transform_time_ms: 31 + transform_time_ms: 35 transform_yield_count: 60 - insert_time_ms: 6 + insert_time_ms: 2 insert_new_count: 49 insert_reused_count: 4 - query: EXPLAIN select count(col2) from T2 where col1 > 0; @@ -233,9 +233,9 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 393 - task_total_time_ms: 12 + task_total_time_ms: 20 transform_count: 135 - transform_time_ms: 9 + transform_time_ms: 15 transform_yield_count: 46 insert_time_ms: 0 insert_new_count: 28 @@ -244,9 +244,9 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I4 <,> BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 114 + task_total_time_ms: 118 transform_count: 97 - transform_time_ms: 83 + transform_time_ms: 91 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -255,9 +255,9 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 13 + task_total_time_ms: 17 transform_count: 97 - transform_time_ms: 8 + transform_time_ms: 11 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -266,9 +266,9 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I4 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 17 + task_total_time_ms: 23 transform_count: 97 - transform_time_ms: 11 + transform_time_ms: 16 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -277,11 +277,11 @@ agg-empty-table-tests: explain: ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 509 - task_total_time_ms: 14 + task_total_time_ms: 23 transform_count: 151 - transform_time_ms: 5 + transform_time_ms: 9 transform_yield_count: 44 - insert_time_ms: 1 + insert_time_ms: 2 insert_new_count: 75 insert_reused_count: 6 - query: EXPLAIN select count(col2) from T3 where col1 = 0; @@ -289,11 +289,11 @@ agg-empty-table-tests: AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 730 - task_total_time_ms: 40 + task_total_time_ms: 20 transform_count: 215 - transform_time_ms: 13 + transform_time_ms: 7 transform_yield_count: 50 - insert_time_ms: 3 + insert_time_ms: 1 insert_new_count: 103 insert_reused_count: 5 - query: EXPLAIN select count(col2) from T3 where col1 > 0; @@ -301,29 +301,29 @@ agg-empty-table-tests: AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 757 - task_total_time_ms: 24 + task_total_time_ms: 22 transform_count: 218 transform_time_ms: 7 transform_yield_count: 53 - insert_time_ms: 2 + insert_time_ms: 1 insert_new_count: 108 insert_reused_count: 5 - query: EXPLAIN select count(col2) from T3 group by col1; explain: ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0) task_count: 220 - task_total_time_ms: 12 + task_total_time_ms: 21 transform_count: 72 - transform_time_ms: 3 + transform_time_ms: 11 transform_yield_count: 26 - insert_time_ms: 0 + insert_time_ms: 1 insert_new_count: 18 insert_reused_count: 2 - query: EXPLAIN select count(col2) from T3 where col1 = 0 group by col1; explain: ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0) task_count: 317 - task_total_time_ms: 7 + task_total_time_ms: 12 transform_count: 97 transform_time_ms: 3 transform_yield_count: 30 @@ -335,20 +335,20 @@ agg-empty-table-tests: AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0) task_count: 317 - task_total_time_ms: 21 + task_total_time_ms: 19 transform_count: 97 - transform_time_ms: 7 + transform_time_ms: 8 transform_yield_count: 30 - insert_time_ms: 1 + insert_time_ms: 0 insert_new_count: 32 insert_reused_count: 1 - query: EXPLAIN select sum(col1) from T1; explain: SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 263 - task_total_time_ms: 7 + task_total_time_ms: 11 transform_count: 87 - transform_time_ms: 2 + transform_time_ms: 5 transform_yield_count: 15 insert_time_ms: 0 insert_new_count: 22 @@ -358,11 +358,11 @@ agg-empty-table-tests: MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 335 - task_total_time_ms: 6 + task_total_time_ms: 16 transform_count: 106 - transform_time_ms: 2 + transform_time_ms: 4 transform_yield_count: 17 - insert_time_ms: 0 + insert_time_ms: 2 insert_new_count: 28 insert_reused_count: 2 - query: EXPLAIN select sum(col1) from T1 where col2 = 0; @@ -370,9 +370,9 @@ agg-empty-table-tests: MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 335 - task_total_time_ms: 12 + task_total_time_ms: 5 transform_count: 106 - transform_time_ms: 4 + transform_time_ms: 1 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -382,9 +382,9 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 335 - task_total_time_ms: 10 + task_total_time_ms: 7 transform_count: 106 - transform_time_ms: 3 + transform_time_ms: 2 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -394,22 +394,22 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 335 - task_total_time_ms: 14 + task_total_time_ms: 10 transform_count: 106 - transform_time_ms: 6 + transform_time_ms: 3 transform_yield_count: 17 - insert_time_ms: 1 + insert_time_ms: 0 insert_new_count: 28 insert_reused_count: 2 - query: EXPLAIN select sum(col1) from T2; explain: 'AISCAN(T2_I5 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)' task_count: 450 - task_total_time_ms: 17 + task_total_time_ms: 145 transform_count: 158 - transform_time_ms: 10 + transform_time_ms: 102 transform_yield_count: 50 - insert_time_ms: 0 + insert_time_ms: 6 insert_new_count: 43 insert_reused_count: 4 - query: EXPLAIN select sum(col1) from T2 where col1 = 0; @@ -417,11 +417,11 @@ agg-empty-table-tests: MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 393 - task_total_time_ms: 39 + task_total_time_ms: 27 transform_count: 135 - transform_time_ms: 30 + transform_time_ms: 14 transform_yield_count: 46 - insert_time_ms: 1 + insert_time_ms: 0 insert_new_count: 28 insert_reused_count: 2 - query: EXPLAIN select sum(col1) from T2 where col2 = 0; @@ -429,11 +429,11 @@ agg-empty-table-tests: _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)' task_count: 538 - task_total_time_ms: 34 + task_total_time_ms: 54 transform_count: 182 - transform_time_ms: 23 + transform_time_ms: 32 transform_yield_count: 60 - insert_time_ms: 1 + insert_time_ms: 3 insert_new_count: 49 insert_reused_count: 4 - query: EXPLAIN select sum(col1) from T2 where col1 > 0; @@ -441,9 +441,9 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 393 - task_total_time_ms: 17 + task_total_time_ms: 18 transform_count: 135 - transform_time_ms: 11 + transform_time_ms: 14 transform_yield_count: 46 insert_time_ms: 0 insert_new_count: 28 @@ -453,20 +453,20 @@ agg-empty-table-tests: | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 393 - task_total_time_ms: 21 + task_total_time_ms: 36 transform_count: 135 - transform_time_ms: 15 + transform_time_ms: 29 transform_yield_count: 46 - insert_time_ms: 0 + insert_time_ms: 1 insert_new_count: 28 insert_reused_count: 2 - query: EXPLAIN select sum(col1) from T2 where col2 = 0 group by col2; explain: 'AISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 17 + task_total_time_ms: 19 transform_count: 97 - transform_time_ms: 12 + transform_time_ms: 13 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -475,9 +475,9 @@ agg-empty-table-tests: explain: 'AISCAN(T2_I6 [[GREATER_THAN promote(@c11 AS LONG)]] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP (_._1 AS _0)' task_count: 259 - task_total_time_ms: 15 + task_total_time_ms: 20 transform_count: 97 - transform_time_ms: 9 + transform_time_ms: 15 transform_yield_count: 42 insert_time_ms: 0 insert_new_count: 12 @@ -486,20 +486,20 @@ agg-empty-table-tests: explain: ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 509 - task_total_time_ms: 26 + task_total_time_ms: 23 transform_count: 151 transform_time_ms: 10 transform_yield_count: 44 - insert_time_ms: 3 + insert_time_ms: 2 insert_new_count: 75 insert_reused_count: 6 - query: EXPLAIN select sum(col1) from T3 where col1 = 0; explain: ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 730 - task_total_time_ms: 18 + task_total_time_ms: 17 transform_count: 215 - transform_time_ms: 6 + transform_time_ms: 5 transform_yield_count: 50 insert_time_ms: 1 insert_new_count: 103 @@ -508,33 +508,33 @@ agg-empty-table-tests: explain: ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 730 - task_total_time_ms: 40 + task_total_time_ms: 36 transform_count: 215 - transform_time_ms: 14 + transform_time_ms: 8 transform_yield_count: 50 - insert_time_ms: 3 + insert_time_ms: 2 insert_new_count: 103 insert_reused_count: 5 - query: EXPLAIN select sum(col1) from T3 where col1 > 0; explain: ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 757 - task_total_time_ms: 28 + task_total_time_ms: 24 transform_count: 218 - transform_time_ms: 7 + transform_time_ms: 8 transform_yield_count: 53 - insert_time_ms: 2 + insert_time_ms: 3 insert_new_count: 108 insert_reused_count: 5 - query: EXPLAIN select sum(col1) from T3 where col2 > 0; explain: ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) task_count: 757 - task_total_time_ms: 145 + task_total_time_ms: 160 transform_count: 218 - transform_time_ms: 86 + transform_time_ms: 96 transform_yield_count: 53 - insert_time_ms: 8 + insert_time_ms: 9 insert_new_count: 108 insert_reused_count: 5 - query: EXPLAIN select sum(col1) from T3 where col1 = 0 group by col2; @@ -542,20 +542,20 @@ agg-empty-table-tests: AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0) task_count: 299 - task_total_time_ms: 133 + task_total_time_ms: 10 transform_count: 95 - transform_time_ms: 86 + transform_time_ms: 4 transform_yield_count: 29 - insert_time_ms: 2 + insert_time_ms: 0 insert_new_count: 28 insert_reused_count: 2 - query: EXPLAIN select sum(col1) from T3 where col2 = 0 group by col2; explain: ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0) task_count: 317 - task_total_time_ms: 14 + task_total_time_ms: 22 transform_count: 97 - transform_time_ms: 5 + transform_time_ms: 9 transform_yield_count: 30 insert_time_ms: 0 insert_new_count: 32 @@ -565,11 +565,11 @@ agg-empty-table-tests: MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0) task_count: 299 - task_total_time_ms: 131 + task_total_time_ms: 13 transform_count: 95 - transform_time_ms: 87 + transform_time_ms: 6 transform_yield_count: 29 - insert_time_ms: 2 + insert_time_ms: 0 insert_new_count: 28 insert_reused_count: 2 - query: EXPLAIN select sum(col1) from T3 where col2 > 0 group by col2; @@ -577,9 +577,9 @@ agg-empty-table-tests: AGG (sum_l(_._0.COL1) AS _0) GROUP BY (_._0.COL2 AS _0) | MAP (_._1._0 AS _0) task_count: 317 - task_total_time_ms: 19 + task_total_time_ms: 10 transform_count: 97 - transform_time_ms: 6 + transform_time_ms: 5 transform_yield_count: 30 insert_time_ms: 0 insert_new_count: 32 @@ -589,7 +589,7 @@ agg-empty-table-tests-after-modifications: explain: SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 263 - task_total_time_ms: 8 + task_total_time_ms: 6 transform_count: 87 transform_time_ms: 2 transform_yield_count: 15 @@ -601,9 +601,9 @@ agg-empty-table-tests-after-modifications: MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 335 - task_total_time_ms: 6 + task_total_time_ms: 11 transform_count: 106 - transform_time_ms: 2 + transform_time_ms: 4 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -613,9 +613,9 @@ agg-empty-table-tests-after-modifications: | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) task_count: 335 - task_total_time_ms: 11 + task_total_time_ms: 12 transform_count: 106 - transform_time_ms: 5 + transform_time_ms: 6 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -624,10 +624,276 @@ agg-empty-table-tests-after-modifications: explain: 'AISCAN(T2_I1 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)' task_count: 450 - task_total_time_ms: 24 + task_total_time_ms: 35 + transform_count: 158 + transform_time_ms: 25 + transform_yield_count: 50 + insert_time_ms: 2 + insert_new_count: 43 + insert_reused_count: 4 +- query: EXPLAIN select count(col2) from T2; + explain: 'AISCAN(T2_I3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY + NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)' + task_count: 450 + task_total_time_ms: 19 transform_count: 158 + transform_time_ms: 10 + transform_yield_count: 50 + insert_time_ms: 1 + insert_new_count: 43 + insert_reused_count: 4 +- query: EXPLAIN select count(col2) from T2 where col1 = 0; + explain: 'AISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], + _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, + promote(0l AS LONG)) AS _0)' + task_count: 538 + task_total_time_ms: 52 + transform_count: 182 + transform_time_ms: 35 + transform_yield_count: 60 + insert_time_ms: 2 + insert_new_count: 49 + insert_reused_count: 4 +- query: EXPLAIN select count(col2) from T2 where col1 > 0; + explain: SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) + | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, + promote(0l AS LONG)) AS _0) + task_count: 393 + task_total_time_ms: 20 + transform_count: 135 transform_time_ms: 15 + transform_yield_count: 46 + insert_time_ms: 0 + insert_new_count: 28 + insert_reused_count: 2 +- query: EXPLAIN select count(col2) from T3; + explain: ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON + EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0) + task_count: 509 + task_total_time_ms: 23 + transform_count: 151 + transform_time_ms: 9 + transform_yield_count: 44 + insert_time_ms: 2 + insert_new_count: 75 + insert_reused_count: 6 +- query: EXPLAIN select count(col2) from T3 where col1 = 0; + explain: ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) + AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) + AS _0) + task_count: 730 + task_total_time_ms: 20 + transform_count: 215 + transform_time_ms: 7 transform_yield_count: 50 insert_time_ms: 1 + insert_new_count: 103 + insert_reused_count: 5 +- query: EXPLAIN select count(col2) from T3 where col1 > 0; + explain: ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | + AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, + promote(0l AS LONG)) AS _0) + task_count: 757 + task_total_time_ms: 22 + transform_count: 218 + transform_time_ms: 7 + transform_yield_count: 53 + insert_time_ms: 1 + insert_new_count: 108 + insert_reused_count: 5 +- query: EXPLAIN select count(col2) from T3 group by col1; + explain: ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP + BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0) + task_count: 220 + task_total_time_ms: 21 + transform_count: 72 + transform_time_ms: 11 + transform_yield_count: 26 + insert_time_ms: 1 + insert_new_count: 18 + insert_reused_count: 2 +- query: EXPLAIN select count(col2) from T3 where col1 = 0 group by col1; + explain: ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) + AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0) + task_count: 317 + task_total_time_ms: 12 + transform_count: 97 + transform_time_ms: 3 + transform_yield_count: 30 + insert_time_ms: 0 + insert_new_count: 32 + insert_reused_count: 1 +- query: EXPLAIN select count(col2) from T3 where col1 > 0 group by col1; + explain: ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | + AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS + _0) + task_count: 317 + task_total_time_ms: 19 + transform_count: 97 + transform_time_ms: 8 + transform_yield_count: 30 + insert_time_ms: 0 + insert_new_count: 32 + insert_reused_count: 1 +- query: EXPLAIN select sum(col1) from T1; + explain: SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) + | ON EMPTY NULL | MAP (_._0._0 AS _0) + task_count: 263 + task_total_time_ms: 11 + transform_count: 87 + transform_time_ms: 5 + transform_yield_count: 15 + insert_time_ms: 0 + insert_new_count: 22 + insert_reused_count: 2 +- query: EXPLAIN select sum(col1) from T1 where col1 = 0; + explain: SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | + MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 + AS _0) + task_count: 335 + task_total_time_ms: 16 + transform_count: 106 + transform_time_ms: 4 + transform_yield_count: 17 + insert_time_ms: 2 + insert_new_count: 28 + insert_reused_count: 2 +- query: EXPLAIN select sum(col1) from T1 where col2 = 0; + explain: SCAN(<,>) | TFILTER T1 | FILTER _.COL2 EQUALS promote(@c11 AS LONG) | + MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 + AS _0) + task_count: 335 + task_total_time_ms: 5 + transform_count: 106 + transform_time_ms: 1 + transform_yield_count: 17 + insert_time_ms: 0 + insert_new_count: 28 + insert_reused_count: 2 +- query: EXPLAIN select sum(col1) from T1 where col1 > 0; + explain: SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) + | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 + AS _0) + task_count: 335 + task_total_time_ms: 7 + transform_count: 106 + transform_time_ms: 2 + transform_yield_count: 17 + insert_time_ms: 0 + insert_new_count: 28 + insert_reused_count: 2 +- query: EXPLAIN select sum(col1) from T1 where col2 > 0; + explain: SCAN(<,>) | TFILTER T1 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) + | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 + AS _0) + task_count: 335 + task_total_time_ms: 10 + transform_count: 106 + transform_time_ms: 3 + transform_yield_count: 17 + insert_time_ms: 0 + insert_new_count: 28 + insert_reused_count: 2 +- query: EXPLAIN select sum(col1) from T2; + explain: 'AISCAN(T2_I5 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY + NULL | MAP (_._0._0 AS _0)' + task_count: 450 + task_total_time_ms: 145 + transform_count: 158 + transform_time_ms: 102 + transform_yield_count: 50 + insert_time_ms: 6 insert_new_count: 43 insert_reused_count: 4 +- query: EXPLAIN select sum(col1) from T2 where col2 = 0; + explain: 'AISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], + _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (_._0._0 + AS _0)' + task_count: 538 + task_total_time_ms: 54 + transform_count: 182 + transform_time_ms: 32 + transform_yield_count: 60 + insert_time_ms: 3 + insert_new_count: 49 + insert_reused_count: 4 +- query: EXPLAIN select sum(col1) from T2 where col1 > 0; + explain: SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) + | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 + AS _0) + task_count: 393 + task_total_time_ms: 18 + transform_count: 135 + transform_time_ms: 14 + transform_yield_count: 46 + insert_time_ms: 0 + insert_new_count: 28 + insert_reused_count: 2 +- query: EXPLAIN select sum(col1) from T2 where col2 > 0; + explain: SCAN(<,>) | TFILTER T2 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) + | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 + AS _0) + task_count: 393 + task_total_time_ms: 36 + transform_count: 135 + transform_time_ms: 29 + transform_yield_count: 46 + insert_time_ms: 1 + insert_new_count: 28 + insert_reused_count: 2 +- query: EXPLAIN select sum(col1) from T2 where col2 > 0; + explain: SCAN(<,>) | TFILTER T2 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) + | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 + AS _0) + task_count: 393 + task_total_time_ms: 36 + transform_count: 135 + transform_time_ms: 29 + transform_yield_count: 46 + insert_time_ms: 1 + insert_new_count: 28 + insert_reused_count: 2 +- query: EXPLAIN select sum(col1) from T3 where col1 = 0; + explain: ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) + AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) + task_count: 730 + task_total_time_ms: 17 + transform_count: 215 + transform_time_ms: 5 + transform_yield_count: 50 + insert_time_ms: 1 + insert_new_count: 103 + insert_reused_count: 5 +- query: EXPLAIN select sum(col1) from T3 where col2 = 0; + explain: ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) + AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) + task_count: 730 + task_total_time_ms: 36 + transform_count: 215 + transform_time_ms: 8 + transform_yield_count: 50 + insert_time_ms: 2 + insert_new_count: 103 + insert_reused_count: 5 +- query: EXPLAIN select sum(col1) from T3 where col1 > 0; + explain: ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | + AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) + task_count: 757 + task_total_time_ms: 24 + transform_count: 218 + transform_time_ms: 8 + transform_yield_count: 53 + insert_time_ms: 3 + insert_new_count: 108 + insert_reused_count: 5 +- query: EXPLAIN select sum(col1) from T3 where col2 > 0; + explain: ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | + AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0) + task_count: 757 + task_total_time_ms: 160 + transform_count: 218 + transform_time_ms: 96 + transform_yield_count: 53 + insert_time_ms: 9 + insert_new_count: 108 + insert_reused_count: 5 diff --git a/yaml-tests/src/test/resources/aggregate-empty-table.yamsql b/yaml-tests/src/test/resources/aggregate-empty-table.yamsql index 7f320a4925..cedb6985a0 100644 --- a/yaml-tests/src/test/resources/aggregate-empty-table.yamsql +++ b/yaml-tests/src/test/resources/aggregate-empty-table.yamsql @@ -405,18 +405,18 @@ test_block: - error: "0AF00" - - query: select count(col2) from T2; + - explain: "AISCAN(T2_I3 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 - maxRows: 0 - result: [{0}] - - query: select count(col2) from T2 where col1 = 0; + - explain: "AISCAN(T2_I4 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - result: [{0}] - - query: select count(col2) from T2 where col1 > 0; - # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. - # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 - - maxRows: 0 + - explain: "SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - result: [{0}] # - # # TODO ([POST] count index returns 0 instead of nothing when running on a table that was cleared) @@ -431,48 +431,47 @@ test_block: # - result: [] - - query: select count(col2) from T3; + - explain: "ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - result: [{0}] - - query: select count(col2) from T3 where col1 = 0; + - explain: "ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - result: [{0}] - - query: select count(col2) from T3 where col1 > 0; + - explain: "ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - result: [{0}] - - query: select count(col2) from T3 group by col1; + - explain: "ISCAN(T3_I1 <,>) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)" - result: [] - - query: select count(col2) from T3 where col1 = 0 group by col1; + - explain: "ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)" - result: [] - - query: select count(col2) from T3 where col1 > 0 group by col1; + - explain: "ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (count(_._0.COL2) AS _0) GROUP BY (_._0.COL1 AS _0) | MAP (_._1._0 AS _0)" - result: [] - - query: select sum(col1) from T1; - # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. - # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 - - maxRows: 0 + - explain: "SCAN(<,>) | TFILTER T1 | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - result: [{!null _}] - - query: select sum(col1) from T1 where col1 = 0; - # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. - # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 - - maxRows: 0 + - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - result: [{!null _}] - - query: select sum(col1) from T1 where col2 = 0; - # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. - # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 - - maxRows: 0 + - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL2 EQUALS promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - result: [{!null _}] - - query: select sum(col1) from T1 where col1 > 0; + - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - result: [{!null _}] - - query: select sum(col1) from T1 where col2 > 0; - # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. - # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 - - maxRows: 0 + - explain: "SCAN(<,>) | TFILTER T1 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - result: [{!null _}] - # TODO (enhance SUM aggregate index to disambiguate null results and 0 results) @@ -483,6 +482,7 @@ test_block: - query: select sum(col1) from T2; # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 + - explain: "AISCAN(T2_I5 <,> BY_GROUP -> [_0: VALUE:[0]]) | MAP (_ AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - maxRows: 0 - result: [{0}] - @@ -490,21 +490,15 @@ test_block: - result: [{!null _}] - - query: select sum(col1) from T2 where col2 = 0; - # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. - # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 - - maxRows: 0 + - explain: "AISCAN(T2_I6 [EQUALS promote(@c11 AS LONG)] BY_GROUP -> [_0: KEY:[0], _1: VALUE:[0]]) | MAP ((_._1 AS _0) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - result: [{!null _}] - - query: select sum(col1) from T2 where col1 > 0; - # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. - # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 - - maxRows: 0 + - explain: "SCAN(<,>) | TFILTER T2 | FILTER _.COL1 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - result: [{!null _}] - - query: select sum(col1) from T2 where col2 > 0; - # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. - # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 - - maxRows: 0 + - explain: "SCAN(<,>) | TFILTER T2 | FILTER _.COL2 GREATER_THAN promote(@c11 AS LONG) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - result: [{!null _}] - - query: select sum(col1) from T2 where col1 = 0 group by col2; @@ -524,27 +518,19 @@ test_block: - result: [{!null _}] - - query: select sum(col1) from T3 where col1 = 0; - # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. - # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 - - maxRows: 0 + - explain: "ISCAN(T3_I1 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - result: [{!null _}] - - query: select sum(col1) from T3 where col2 = 0; - # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. - # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 - - maxRows: 0 + - explain: "ISCAN(T3_I2 [EQUALS promote(@c11 AS LONG)]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - result: [{!null _}] - - query: select sum(col1) from T3 where col1 > 0; - # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. - # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 - - maxRows: 0 + - explain: "ISCAN(T3_I1 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - result: [{!null _}] - - query: select sum(col1) from T3 where col2 > 0; - # Cannot support FORCE_CONTINUATIONS due to non-empty aggregate scan returning a begin continuation. - # See: https://github.com/FoundationDB/fdb-record-layer/issues/3206 - - maxRows: 0 + - explain: "ISCAN(T3_I2 [[GREATER_THAN promote(@c11 AS LONG)]]) | MAP (_ AS _0) | AGG (sum_l(_._0.COL1) AS _0) | ON EMPTY NULL | MAP (_._0._0 AS _0)" - result: [{!null _}] - - query: select sum(col1) from T3 where col1 = 0 group by col2; From d0a3b74df2ccac3ac5a27bfb33d5e29d9f13b84a Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Thu, 6 Mar 2025 18:57:48 +0000 Subject: [PATCH 60/62] update YAML in response to comments --- .../test/resources/bitmap-aggregate-index.yamsql | 15 +-------------- yaml-tests/src/test/resources/functions.yamsql | 4 ++-- .../src/test/resources/standard-tests.yamsql | 1 - 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql b/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql index b71a63ef1e..80a4569c32 100644 --- a/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql +++ b/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql @@ -85,19 +85,6 @@ test_block: - result: [{BITMAP: xStartsWith_1250'060000c', 'OFFSET':0}] - result: [{BITMAP: xStartsWith_1250'02', 'OFFSET':10000}] - result: [] - - - - query: SELECT bitmap_construct_agg(bitmap_bit_position(id)) as bitmap, bitmap_bucket_offset(id) as offset FROM T2 GROUP BY bitmap_bucket_offset(id) - - maxRows: 1 - # Older versions used to skip over a result here due to an off-by-one error (see: https://github.com/foundationdb/fdb-record-layer/pull/3112) - # Retain this test of older behavior to allow for continuation testing with older versions - # This test can be removed when we no longer care about testing compatibility with older versions - - initialVersionLessThan: !current_version - - result: [{BITMAP: xStartsWith_1250'060000c', 'OFFSET':0}] - - result: [] - - initialVersionAtLeast: !current_version - - result: [{BITMAP: xStartsWith_1250'060000c', 'OFFSET':0}] - - result: [{BITMAP: xStartsWith_1250'02', 'OFFSET':10000}] - - result: [] - - query: SELECT bitmap_construct_agg(bitmap_bit_position(id)) as bitmap, category, bitmap_bucket_offset(id) as offset FROM T2 GROUP BY category, bitmap_bucket_offset(id) - supported_version: !current_version @@ -106,7 +93,7 @@ test_block: {BITMAP: xStartsWith_1250'02', 'CATEGORY': 'hello', 'OFFSET':10000}, {BITMAP: xStartsWith_1250'0400008', 'CATEGORY': 'world', 'OFFSET':0}] - - # Copy of the previous but query, but disable force_continuation. + # Copy of the previous query, but disable force_continuations. # This doesn't work before !current_version because of: https://github.com/FoundationDB/fdb-record-layer/issues/3097 # It's hard to write a test assertion that follows the expected behavior across multiple upgrades, # but it can end up skipping values when resuming from a continuation diff --git a/yaml-tests/src/test/resources/functions.yamsql b/yaml-tests/src/test/resources/functions.yamsql index d32e223cc8..c13cdbc7d4 100644 --- a/yaml-tests/src/test/resources/functions.yamsql +++ b/yaml-tests/src/test/resources/functions.yamsql @@ -94,7 +94,7 @@ test_block: - result: [{_0: 1.0, _1: 1.0}] - - query: select coalesce(null, null, 5), coalesce(null, 1, null), coalesce(null, a1, a8) from A - - supported_version: !current_version # Force continuations does not on older versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3218 + - supported_version: !current_version # Force continuations does not work on older versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3218 - result: [{_0: 5, _1: 1, _2: 1.0}] - - query: select b1, b2, coalesce(b1, b2, 42) from B @@ -126,7 +126,7 @@ test_block: {!null _}] - - query: select coalesce(null, (1, 1.0, 'a', true)) from C - - supported_version: !current_version # Force continuations does not on older versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3218 + - supported_version: !current_version # Force continuations does not work on older versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3218 - unorderedResult: [ {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, {{ _0: 1, _1: 1.0, _2: 'a', _3: true}}, diff --git a/yaml-tests/src/test/resources/standard-tests.yamsql b/yaml-tests/src/test/resources/standard-tests.yamsql index 806a8e00a7..cc3a55c0ab 100644 --- a/yaml-tests/src/test/resources/standard-tests.yamsql +++ b/yaml-tests/src/test/resources/standard-tests.yamsql @@ -91,7 +91,6 @@ test_block: - query: select count(*) from (select * from (select * from (select * from T1 where ID = 5) as x) as y) as z; - supported_version: !current_version - explain: "COVERING(I1 <,> -> [COL1: KEY[0], ID: KEY[2]]) | FILTER _.ID EQUALS promote(@c23 AS LONG) | FETCH | MAP (_ AS _0) | AGG (count_star(*) AS _0) | ON EMPTY NULL | MAP (coalesce_long(_._0._0, promote(0l AS LONG)) AS _0)" - - maxRows: 0 - result: [{!l 1}] - # Copy of above query to simulate force continuations mode, which does not work prior to !current_version due to From 01a1c06865099aac0bb902c838038e9b548618ac Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Fri, 7 Mar 2025 10:49:33 +0000 Subject: [PATCH 61/62] Remove single_repetition_ordered Co-authored-by: Scott Dugas --- yaml-tests/src/test/resources/aggregate-empty-table.yamsql | 1 - 1 file changed, 1 deletion(-) diff --git a/yaml-tests/src/test/resources/aggregate-empty-table.yamsql b/yaml-tests/src/test/resources/aggregate-empty-table.yamsql index cedb6985a0..ab0c3c5044 100644 --- a/yaml-tests/src/test/resources/aggregate-empty-table.yamsql +++ b/yaml-tests/src/test/resources/aggregate-empty-table.yamsql @@ -308,7 +308,6 @@ test_block: --- test_block: name: agg-empty-table-tests-after-modifications - preset: single_repetition_ordered tests: - - query: select count(*) from T1; From d708c2ddb7afe5923afe58d760f2d921b7a16238 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Fri, 7 Mar 2025 15:43:41 +0000 Subject: [PATCH 62/62] fix error and add uplevel test for one union.yamsql query --- yaml-tests/src/test/resources/union.yamsql | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/yaml-tests/src/test/resources/union.yamsql b/yaml-tests/src/test/resources/union.yamsql index 7967bc089e..d99187d969 100644 --- a/yaml-tests/src/test/resources/union.yamsql +++ b/yaml-tests/src/test/resources/union.yamsql @@ -172,10 +172,21 @@ test_block: - result: [{S: 5}] - - query: select col2 from t1 where exists (select a from t3 where col2 <= id union all select b from t4 where col2 <= id) - # Does not work in force continuations mode on prior versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3096 - # Hard to write asserts for on older versions, but no unexpected mixed mode issues when running with older versions + # Does not work in force continuations mode on prior versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3219 - supported_version: !current_version - result: [{1}, {2}, {6}, {7}] + - + # Copy of previous query that simulates force_continuations mode for versions less than !current_version. + # Can remove once we no longer care about the upgrade path there. + - query: select col2 from t1 where exists (select a from t3 where col2 <= id union all select b from t4 where col2 <= id) + - maxRows: 1 + - initialVersionLessThan: !current_version + - result: [{1}] + - result: [{2}] + - error: 'XXXXX' + - initialVersionAtLeast: !current_version + # If the second version is < !current_version, then the second response is a failure (as seen in other branch). + # If the second version is >= !current_version, then this is handled by the previous query. - - query: select col1, col2 from t1 union all select col1 from t1 - error: "42F64"