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 0dd37d9525..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 @@ -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; @@ -53,6 +55,8 @@ 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 private final String query; @@ -105,10 +109,9 @@ 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 - reportTestFailure("Received continuation shouldn't be at beginning"); - return null; + return ContinuationImpl.END; } else { // Have a continuation - continue return executeContinuation(connection, continuation, config, currentQuery, maxRows); @@ -143,7 +146,7 @@ private Object executeStatementAndCheckCacheIfNeeded(@Nonnull Statement s, final 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; + 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); @@ -262,8 +265,9 @@ private Object executeStatementWithForcedContinuations(final @Nonnull Statement Continuation continuation = resultSet.getContinuation(); int count = 0; while (!continuation.atEnd()) { - if (continuation.atBeginning()) { - reportTestFailure("Received continuation shouldn't be at beginning"); + if (checkBeginningContinuation(continuation, connection)) { + continuation = ContinuationImpl.END; + break; } try (var s2 = prepareContinuationStatement(connection, continuation, FORCED_MAX_ROWS)) { resultSet = (RelationalResultSet)executeStatement(s2, true, queryString); @@ -273,7 +277,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, "Result has more rows than maxRows allowed"); + 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 ++ @@ -290,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(); diff --git a/yaml-tests/src/test/java/YamlIntegrationTests.java b/yaml-tests/src/test/java/YamlIntegrationTests.java index 98465d68f8..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; @@ -39,43 +38,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"); } @@ -102,8 +89,6 @@ public void joinTests(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 subqueryTests(YamlTest.Runner runner) throws Exception { runner.runYamsql("subquery-tests.yamsql"); } @@ -130,8 +115,6 @@ public void aggregateIndexTests(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 aggregateEmptyTable(YamlTest.Runner runner) throws Exception { runner.runYamsql("aggregate-empty-table.yamsql"); } @@ -192,8 +175,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"); } @@ -204,8 +185,6 @@ 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"); } @@ -221,8 +200,6 @@ void functions(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 createDrop(YamlTest.Runner runner) throws Exception { runner.runYamsql("create-drop.yamsql"); } @@ -248,15 +225,11 @@ 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"); } @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/aggregate-empty-table.metrics.binpb b/yaml-tests/src/test/resources/aggregate-empty-table.metrics.binpb index e30012173e..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 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; @@ -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 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 { +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;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 { +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; - ڒ(<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 { +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; -Ԣ (.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 { +Š (.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 ۮ(*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 +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; @@ -145,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; @@ -158,7 +160,7 @@ digraph G { } 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 { + (,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; @@ -173,10 +175,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; +ӏ (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; @@ -191,11 +193,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; +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 (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 Ҳ((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 (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 (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,11 +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 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 (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; @@ -259,10 +259,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 '(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; @@ -279,10 +279,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 (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; @@ -301,10 +301,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 (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; @@ -326,7 +326,7 @@ K } < 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 { +п  (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; @@ -339,10 +339,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 +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; @@ -380,8 +380,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) +՜8a +(*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 +393,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 +406,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 (*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; @@ -417,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; - (,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 { +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; @@ -438,7 +437,8 @@ digraph G { } 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 { + + (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; @@ -456,8 +456,8 @@ K } 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 { + + (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; @@ -475,7 +475,8 @@ 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 (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; @@ -491,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; @@ -507,7 +508,7 @@ 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 (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; @@ -520,10 +521,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 ȸ(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; @@ -540,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; @@ -562,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 (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 { +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; @@ -584,10 +585,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 覯(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; @@ -606,10 +607,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; @@ -628,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; - (20,8+@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; @@ -647,7 +648,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 { +  (.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; @@ -666,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; -  Ց(<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 { +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; @@ -685,8 +686,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 { + ܰ(.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; @@ -708,7 +708,7 @@ 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ȼ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; @@ -730,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; @@ -743,7 +743,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; @@ -756,7 +756,7 @@ digraph G { } : 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 { +  (,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; @@ -774,8 +774,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 { + ȳ(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,10 +789,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; + դ(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,10 +807,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 +825,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; +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; @@ -847,7 +846,7 @@ I } 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 { +_ ׺(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; @@ -865,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; @@ -881,7 +881,7 @@ W } 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 { +_ (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 +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,4 +912,499 @@ 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 ח(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; + 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 (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; + 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Ʀ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; + 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" ]; +} +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 8b4a810f0a..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,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: 6 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: 11 transform_count: 106 - transform_time_ms: 1 + 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: 9 + task_total_time_ms: 12 transform_count: 106 - transform_time_ms: 2 + 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: 17 + task_total_time_ms: 35 transform_count: 158 - transform_time_ms: 10 + transform_time_ms: 25 transform_yield_count: 50 - insert_time_ms: 0 + 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: 57 + task_total_time_ms: 22 transform_count: 182 - transform_time_ms: 31 + 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: 15 + task_total_time_ms: 44 transform_count: 135 - transform_time_ms: 10 + 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: 6 + task_total_time_ms: 21 transform_count: 97 - transform_time_ms: 4 + 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: 15 + task_total_time_ms: 26 transform_count: 97 - transform_time_ms: 10 + 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: 15 + task_total_time_ms: 23 transform_count: 97 - transform_time_ms: 10 + 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: 8 + task_total_time_ms: 16 transform_count: 151 - transform_time_ms: 3 + transform_time_ms: 6 transform_yield_count: 44 - insert_time_ms: 0 + insert_time_ms: 1 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: 44 transform_count: 215 - transform_time_ms: 4 + transform_time_ms: 15 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,31 +130,31 @@ 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: 161 transform_count: 218 - transform_time_ms: 6 + transform_time_ms: 99 transform_yield_count: 53 - insert_time_ms: 1 + 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: 5 + task_total_time_ms: 125 transform_count: 72 - transform_time_ms: 2 + 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: 15 + task_total_time_ms: 13 transform_count: 97 - transform_time_ms: 10 + transform_time_ms: 4 transform_yield_count: 30 insert_time_ms: 0 insert_new_count: 32 @@ -163,9 +163,9 @@ agg-empty-table-tests: 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: 16 transform_count: 97 - transform_time_ms: 1 + transform_time_ms: 7 transform_yield_count: 30 insert_time_ms: 0 insert_new_count: 32 @@ -174,11 +174,11 @@ agg-empty-table-tests: 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: 126 transform_count: 87 - transform_time_ms: 1 + transform_time_ms: 83 transform_yield_count: 15 - insert_time_ms: 0 + 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: 3 + task_total_time_ms: 13 transform_count: 106 - transform_time_ms: 1 + 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: 7 + 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 @@ -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: 19 transform_count: 158 transform_time_ms: 10 transform_yield_count: 50 - insert_time_ms: 0 + 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: 17 + task_total_time_ms: 52 transform_count: 182 - transform_time_ms: 11 + transform_time_ms: 35 transform_yield_count: 60 - insert_time_ms: 0 + insert_time_ms: 2 insert_new_count: 49 insert_reused_count: 4 - query: EXPLAIN select count(col2) from T2 where col1 > 0; @@ -235,7 +235,7 @@ agg-empty-table-tests: task_count: 393 task_total_time_ms: 20 transform_count: 135 - transform_time_ms: 14 + 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: 22 + task_total_time_ms: 118 transform_count: 97 - transform_time_ms: 16 + transform_time_ms: 91 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: 23 transform_count: 97 - transform_time_ms: 10 + 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: 16 + 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,7 +289,7 @@ 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: 20 transform_count: 215 transform_time_ms: 7 transform_yield_count: 50 @@ -303,7 +303,7 @@ agg-empty-table-tests: task_count: 757 task_total_time_ms: 22 transform_count: 218 - transform_time_ms: 5 + transform_time_ms: 7 transform_yield_count: 53 insert_time_ms: 1 insert_new_count: 108 @@ -312,18 +312,18 @@ agg-empty-table-tests: 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: 21 transform_count: 72 - transform_time_ms: 2 + 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: 11 + task_total_time_ms: 12 transform_count: 97 transform_time_ms: 3 transform_yield_count: 30 @@ -335,9 +335,9 @@ 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: 19 transform_count: 97 - transform_time_ms: 3 + transform_time_ms: 8 transform_yield_count: 30 insert_time_ms: 0 insert_new_count: 32 @@ -346,9 +346,9 @@ agg-empty-table-tests: 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: 1 + 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: 24 + 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: 8 + task_total_time_ms: 5 transform_count: 106 - transform_time_ms: 2 + transform_time_ms: 1 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -384,7 +384,7 @@ agg-empty-table-tests: task_count: 335 task_total_time_ms: 7 transform_count: 106 - transform_time_ms: 1 + transform_time_ms: 2 transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 28 @@ -394,9 +394,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 @@ -405,11 +405,11 @@ agg-empty-table-tests: 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: 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,9 +417,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: 14 + task_total_time_ms: 27 transform_count: 135 - transform_time_ms: 10 + transform_time_ms: 14 transform_yield_count: 46 insert_time_ms: 0 insert_new_count: 28 @@ -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: 25 + task_total_time_ms: 54 transform_count: 182 - transform_time_ms: 17 + 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: 22 + task_total_time_ms: 18 transform_count: 135 - transform_time_ms: 16 + 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: 18 + task_total_time_ms: 36 transform_count: 135 - transform_time_ms: 13 + 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: 12 + task_total_time_ms: 19 transform_count: 97 - transform_time_ms: 6 + 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: 8 + task_total_time_ms: 20 transform_count: 97 - transform_time_ms: 6 + 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: 16 + task_total_time_ms: 23 transform_count: 151 - transform_time_ms: 5 + transform_time_ms: 10 transform_yield_count: 44 - insert_time_ms: 1 + 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: 22 + task_total_time_ms: 17 transform_count: 215 - transform_time_ms: 4 + 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: 19 + task_total_time_ms: 36 transform_count: 215 - transform_time_ms: 3 + transform_time_ms: 8 transform_yield_count: 50 - insert_time_ms: 1 + 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: 12 + task_total_time_ms: 24 transform_count: 218 - transform_time_ms: 3 + transform_time_ms: 8 transform_yield_count: 53 - insert_time_ms: 0 + 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: 12 + task_total_time_ms: 160 transform_count: 218 - transform_time_ms: 3 + transform_time_ms: 96 transform_yield_count: 53 - insert_time_ms: 0 + 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,9 +542,9 @@ 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: 10 transform_count: 95 - transform_time_ms: 3 + transform_time_ms: 4 transform_yield_count: 29 insert_time_ms: 0 insert_new_count: 28 @@ -553,9 +553,9 @@ agg-empty-table-tests: 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: 4 + transform_time_ms: 9 transform_yield_count: 30 insert_time_ms: 0 insert_new_count: 32 @@ -565,9 +565,9 @@ 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: 13 transform_count: 95 - transform_time_ms: 4 + transform_time_ms: 6 transform_yield_count: 29 insert_time_ms: 0 insert_new_count: 28 @@ -577,10 +577,323 @@ 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: 10 transform_count: 97 + transform_time_ms: 5 + 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: 6 + 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: 11 + transform_count: 106 + transform_time_ms: 4 + 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: 12 + transform_count: 106 + transform_time_ms: 6 + 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: 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 4c887db405..ab0c3c5044 100644 --- a/yaml-tests/src/test/resources/aggregate-empty-table.yamsql +++ b/yaml-tests/src/test/resources/aggregate-empty-table.yamsql @@ -36,11 +36,8 @@ 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}] - - 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)" @@ -195,11 +192,8 @@ 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 _}] - - 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)" @@ -317,12 +311,15 @@ test_block: 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)" - 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; @@ -341,6 +338,10 @@ test_block: - error: "0AF00" - - 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; @@ -403,12 +404,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; + - 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) @@ -423,36 +430,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; + - 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; + - 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; + - 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; + - 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) @@ -461,18 +479,25 @@ test_block: # - 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; + # 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}] - - query: select sum(col1) from T2 where col1 = 0; - 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 _}] - - 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 _}] - - 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 _}] - - query: select sum(col1) from T2 where col1 = 0 group by col2; @@ -492,15 +517,19 @@ test_block: - 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 _}] - - 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 _}] - - 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 _}] - - 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 _}] - - query: select sum(col1) from T3 where col1 = 0 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 8cd73dcfdb..80a4569c32 100644 --- a/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql +++ b/yaml-tests/src/test/resources/bitmap-aggregate-index.yamsql @@ -92,4 +92,15 @@ test_block: - 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 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 + - 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/src/test/resources/boolean.yamsql b/yaml-tests/src/test/resources/boolean.yamsql index 639c71a787..9602367cdb 100644 --- a/yaml-tests/src/test/resources/boolean.yamsql +++ b/yaml-tests/src/test/resources/boolean.yamsql @@ -96,7 +96,7 @@ test_block: - result: [ { false }, { false }, { false } ] - - query: select B AND NULL from lb - - supported_version: !current_version # This fails when running with continuations against older versions + - supported_version: !current_version # This fails when running with continuations against older versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3218 - result: [ { !null }, { false }, { !null } ] - - query: select B OR TRUE from lb @@ -106,7 +106,7 @@ test_block: - result: [ { true }, { false }, { !null } ] - - query: select B OR NULL from lb - - supported_version: !current_version # This fails when running with continuations against older versions + - supported_version: !current_version # This fails when running with continuations against older versions due to: https://github.com/FoundationDB/fdb-record-layer/issues/3218 - result: [ { true }, { !null }, { !null } ] - - query: select NOT B from lb 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 a2d87f0a75..4b9ec7208b 100644 --- a/yaml-tests/src/test/resources/catalog.yamsql +++ b/yaml-tests/src/test/resources/catalog.yamsql @@ -61,6 +61,8 @@ 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 = '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? @@ -70,6 +72,8 @@ 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 = '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? 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 66aa7a0838..62d92e7d0b 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" @@ -50,6 +57,7 @@ test_block: 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: @@ -89,6 +97,7 @@ test_block: 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: @@ -154,6 +163,7 @@ test_block: 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: diff --git a/yaml-tests/src/test/resources/enum.yamsql b/yaml-tests/src/test/resources/enum.yamsql index 06391e715b..7776c64954 100644 --- a/yaml-tests/src/test/resources/enum.yamsql +++ b/yaml-tests/src/test/resources/enum.yamsql @@ -18,7 +18,9 @@ # limitations under the License. --- 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/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 f981d28a48..c4a8f202f7 100644 --- a/yaml-tests/src/test/resources/field-index-tests-proto.yamsql +++ b/yaml-tests/src/test/resources/field-index-tests-proto.yamsql @@ -58,16 +58,61 @@ test_block: - 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; + - 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 _}] - - query: select sum(COL1) from "MyTable"; + - 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}] + - 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: 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}, diff --git a/yaml-tests/src/test/resources/functions.yamsql b/yaml-tests/src/test/resources/functions.yamsql index eefc393e29..c13cdbc7d4 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 _}] @@ -92,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 # literal null in plan hash + - 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 @@ -124,7 +126,7 @@ test_block: {!null _}] - - query: select coalesce(null, (1, 1.0, 'a', true)) from C - - supported_version: !current_version # literal null in plan hash + - 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/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 60058c02b3..dc9a32aea0 100644 --- a/yaml-tests/src/test/resources/groupby-tests.yamsql +++ b/yaml-tests/src/test/resources/groupby-tests.yamsql @@ -59,16 +59,49 @@ test_block: tests: - - 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}] - - - query: select max(q.s) from nested group by r.v.z as GRP having GRP > 120 + # 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 - 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 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 + - 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 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 + - initialVersionLessThan: !current_version + - result: [{5}] + - result: [{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; @@ -121,29 +154,127 @@ test_block: - result: [{!l 10}, {!l 20}] - - 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 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 + - 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 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 + - 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 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 + - 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 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 + - 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 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 + - 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 - - 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 + - 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 + # 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 + - 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 - # 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" @@ -152,16 +283,69 @@ test_block: - error: "42803" - - 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}] + - 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}] + - 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}] + - + # 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}] @@ -173,16 +357,64 @@ test_block: - 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; + # 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 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 + - 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 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 + - + - 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}] + - + # 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" diff --git a/yaml-tests/src/test/resources/insert-enum.yamsql b/yaml-tests/src/test/resources/insert-enum.yamsql index dcb1eccc60..cbb8927cbf 100644 --- a/yaml-tests/src/test/resources/insert-enum.yamsql +++ b/yaml-tests/src/test/resources/insert-enum.yamsql @@ -18,7 +18,9 @@ # limitations under the License. --- 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 3bd6ea1818..a24ff56084 100644 --- a/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql +++ b/yaml-tests/src/test/resources/inserts-updates-deletes.yamsql @@ -106,32 +106,45 @@ 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); - - supported_version: 4.1.6.0 + - 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 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); - - supported_version: 4.1.6.0 + - 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); - - 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 + - + # 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 - - supported_version: 4.1.6.0 - result: [{ A1: 6, A2: !null , A3: 7 }] ... 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 1856319115..56c49c1b65 100644 --- a/yaml-tests/src/test/resources/null-operator-tests.yamsql +++ b/yaml-tests/src/test/resources/null-operator-tests.yamsql @@ -47,7 +47,22 @@ test_block: - result: [] - - query: select count(*) from (select * from (select * from T1) as x where ID is not null) as y; - - 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}] 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 6c205e5af7..5e1f59847a 100644 --- a/yaml-tests/src/test/resources/primary-key-tests.yamsql +++ b/yaml-tests/src/test/resources/primary-key-tests.yamsql @@ -33,7 +33,22 @@ test_block: - error: "23505" - - query: SELECT COUNT(*) FROM T1 + - 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), diff --git a/yaml-tests/src/test/resources/recursive-cte.yamsql b/yaml-tests/src/test/resources/recursive-cte.yamsql index 0a8c782fd3..0a8ed60bb7 100644 --- a/yaml-tests/src/test/resources/recursive-cte.yamsql +++ b/yaml-tests/src/test/resources/recursive-cte.yamsql @@ -80,7 +80,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}] @@ -101,7 +100,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/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 f3ae27077b..6ff6c15799 100644 --- a/yaml-tests/src/test/resources/standard-tests-metadata.yamsql +++ b/yaml-tests/src/test/resources/standard-tests-metadata.yamsql @@ -58,7 +58,22 @@ 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)" - 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.metrics.binpb b/yaml-tests/src/test/resources/standard-tests-proto.metrics.binpb new file mode 100644 index 0000000000..cb21c4fc4e Binary files /dev/null and b/yaml-tests/src/test/resources/standard-tests-proto.metrics.binpb differ 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 6a64724c6c..c989673cfe 100644 --- a/yaml-tests/src/test/resources/standard-tests-proto.yamsql +++ b/yaml-tests/src/test/resources/standard-tests-proto.yamsql @@ -51,15 +51,33 @@ 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}] - - 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)" - 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: 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 ab57f612de..cc3a55c0ab 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,14 +81,32 @@ 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}] - - 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)" - 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}] ... 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 03c8dbdd4f..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,17 +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) + - 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) + - 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) + - 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) + - 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 ... 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/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 319cfb8833..d99187d969 100644 --- a/yaml-tests/src/test/resources/union.yamsql +++ b/yaml-tests/src/test/resources/union.yamsql @@ -58,6 +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 + # 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 @@ -155,15 +158,35 @@ 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 + # 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 + # 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/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" @@ -176,8 +199,23 @@ 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)" + - 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 (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 + - initialVersionLessThan: !current_version + - result: [{0}] + - result: [{!null _}] + - result: [{0}] # ad infinitum + - initialVersionAtLeast: !current_version + - result: [{0}] + - result: [] ...