This is an automated email from the ASF dual-hosted git repository. alsuliman pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/asterixdb.git
commit 2e4f212ce265759abe1770e41236f6154c92d4db Author: Vijay Sarathy <[email protected]> AuthorDate: Tue Feb 21 18:04:32 2023 -0800 [ASTERIXDB-3114]COMP] Do not show cost if CBO is turned off. Change-Id: Ife7af4d402098a0f83b4f1f01eac645fb8448035 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17392 Integration-Tests: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Reviewed-by: Vijay Sarathy <[email protected]> Reviewed-by: Ali Alsuliman <[email protected]> --- .../apache/asterix/api/common/APIFramework.java | 17 ++++++------ .../api/compileonly/compileonly.2.regexjson | 1 + .../single_dataset_with_index.13.plan | 32 +++++++++++----------- .../single_dataset_with_index.8.plan | 32 +++++++++++----------- 4 files changed, 42 insertions(+), 40 deletions(-) diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java index 3409621d47..be21673b33 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java @@ -215,16 +215,12 @@ public class APIFramework { ILogicalPlan plan = isLoad ? t.translateLoad(statement) : t.translate(query, outputDatasetName, statement, resultMetadata); - if ((isQuery || isLoad) && !conf.is(SessionConfig.FORMAT_ONLY_PHYSICAL_OPS) - && conf.is(SessionConfig.OOB_LOGICAL_PLAN)) { - generateLogicalPlan(plan, output.config().getPlanFormat(), isExplainOnly); - } ICcApplicationContext ccAppContext = metadataProvider.getApplicationContext(); CompilerProperties compilerProperties = ccAppContext.getCompilerProperties(); Map<String, Object> querySpecificConfig = validateConfig(metadataProvider.getConfig(), sourceLoc); final PhysicalOptimizationConfig physOptConf = OptimizationConfUtil.createPhysicalOptimizationConf(compilerProperties, querySpecificConfig, sourceLoc); - + boolean cboMode = physOptConf.getCBOMode() || physOptConf.getCBOTestMode(); HeuristicCompilerFactoryBuilder builder = new HeuristicCompilerFactoryBuilder(OptimizationContextFactory.INSTANCE); builder.setPhysicalOptimizationConfig(physOptConf); @@ -242,6 +238,11 @@ public class APIFramework { builder.setWarningCollector(warningCollector); builder.setMaxWarnings(conf.getMaxWarnings()); + if ((isQuery || isLoad) && !conf.is(SessionConfig.FORMAT_ONLY_PHYSICAL_OPS) + && conf.is(SessionConfig.OOB_LOGICAL_PLAN)) { + generateLogicalPlan(plan, output.config().getPlanFormat(), cboMode); + } + int parallelism = getParallelism((String) querySpecificConfig.get(CompilerProperties.COMPILER_PARALLELISM_KEY), compilerProperties.getParallelism()); AlgebricksAbsolutePartitionConstraint computationLocations = @@ -277,7 +278,7 @@ public class APIFramework { output.out().write(buf.toString()); } else { if (isQuery || isLoad) { - generateOptimizedLogicalPlan(plan, output.config().getPlanFormat(), isExplainOnly); + generateOptimizedLogicalPlan(plan, output.config().getPlanFormat(), cboMode); } } } @@ -312,7 +313,7 @@ public class APIFramework { if (!conf.isGenerateJobSpec()) { if (isQuery || isLoad) { - generateOptimizedLogicalPlan(plan, output.config().getPlanFormat(), isExplainOnly); + generateOptimizedLogicalPlan(plan, output.config().getPlanFormat(), cboMode); } return null; } @@ -337,7 +338,7 @@ public class APIFramework { if (conf.is(SessionConfig.OOB_OPTIMIZED_LOGICAL_PLAN) || isExplainOnly) { if (isQuery || isLoad) { - generateOptimizedLogicalPlan(plan, output.config().getPlanFormat(), isExplainOnly); + generateOptimizedLogicalPlan(plan, output.config().getPlanFormat(), cboMode); } } diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/compileonly/compileonly.2.regexjson b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/compileonly/compileonly.2.regexjson index 1cc8fbc0bb..95d29dad3c 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/compileonly/compileonly.2.regexjson +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/compileonly/compileonly.2.regexjson @@ -4,6 +4,7 @@ "expressions":"R{.*}", "operatorId":"R{.*}", "execution-mode":"R{.*}", + "optimizer-estimates":"R{.*}", "inputs":"R{.*}" } } diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/rebalance/single_dataset_with_index/single_dataset_with_index.13.plan b/asterixdb/asterix-app/src/test/resources/runtimets/results/rebalance/single_dataset_with_index/single_dataset_with_index.13.plan index c1522a6057..6faed2fde1 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/rebalance/single_dataset_with_index/single_dataset_with_index.13.plan +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/rebalance/single_dataset_with_index/single_dataset_with_index.13.plan @@ -1,32 +1,32 @@ -distribute result [$$l] [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] +distribute result [$$l] -- DISTRIBUTE_RESULT |PARTITIONED| - exchange [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + exchange -- ONE_TO_ONE_EXCHANGE |PARTITIONED| - project ([$$l]) [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + project ([$$l]) -- STREAM_PROJECT |PARTITIONED| - exchange [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + exchange -- SORT_MERGE_EXCHANGE [$$16(ASC), $$17(ASC) ] |PARTITIONED| - select (eq($$l.getField(10), "1994-01-20")) [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + select (eq($$l.getField(10), "1994-01-20")) -- STREAM_SELECT |PARTITIONED| - exchange [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + exchange -- ONE_TO_ONE_EXCHANGE |PARTITIONED| - unnest-map [$$16, $$17, $$l] <- index-search("LineItem", 0, "tpch", "LineItem", false, false, 2, $$24, $$25, 2, $$24, $$25, true, true, true) [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + unnest-map [$$16, $$17, $$l] <- index-search("LineItem", 0, "tpch", "LineItem", false, false, 2, $$24, $$25, 2, $$24, $$25, true, true, true) -- BTREE_SEARCH |PARTITIONED| - exchange [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + exchange -- ONE_TO_ONE_EXCHANGE |PARTITIONED| - order (ASC, $$24) (ASC, $$25) [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + order (ASC, $$24) (ASC, $$25) -- STABLE_SORT [$$24(ASC), $$25(ASC)] |PARTITIONED| - exchange [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + exchange -- ONE_TO_ONE_EXCHANGE |PARTITIONED| - project ([$$24, $$25]) [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + project ([$$24, $$25]) -- STREAM_PROJECT |PARTITIONED| - exchange [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + exchange -- ONE_TO_ONE_EXCHANGE |PARTITIONED| - unnest-map [$$23, $$24, $$25] <- index-search("lineitem_shipdateIx", 0, "tpch", "LineItem", false, false, 1, $$21, 1, $$22, true, true, true) [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + unnest-map [$$23, $$24, $$25] <- index-search("lineitem_shipdateIx", 0, "tpch", "LineItem", false, false, 1, $$21, 1, $$22, true, true, true) -- BTREE_SEARCH |PARTITIONED| - exchange [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + exchange -- ONE_TO_ONE_EXCHANGE |PARTITIONED| - assign [$$21, $$22] <- ["1994-01-20", "1994-01-20"] [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + assign [$$21, $$22] <- ["1994-01-20", "1994-01-20"] -- ASSIGN |PARTITIONED| - empty-tuple-source [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + empty-tuple-source -- EMPTY_TUPLE_SOURCE |PARTITIONED| diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/rebalance/single_dataset_with_index/single_dataset_with_index.8.plan b/asterixdb/asterix-app/src/test/resources/runtimets/results/rebalance/single_dataset_with_index/single_dataset_with_index.8.plan index c1522a6057..6faed2fde1 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/rebalance/single_dataset_with_index/single_dataset_with_index.8.plan +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/rebalance/single_dataset_with_index/single_dataset_with_index.8.plan @@ -1,32 +1,32 @@ -distribute result [$$l] [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] +distribute result [$$l] -- DISTRIBUTE_RESULT |PARTITIONED| - exchange [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + exchange -- ONE_TO_ONE_EXCHANGE |PARTITIONED| - project ([$$l]) [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + project ([$$l]) -- STREAM_PROJECT |PARTITIONED| - exchange [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + exchange -- SORT_MERGE_EXCHANGE [$$16(ASC), $$17(ASC) ] |PARTITIONED| - select (eq($$l.getField(10), "1994-01-20")) [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + select (eq($$l.getField(10), "1994-01-20")) -- STREAM_SELECT |PARTITIONED| - exchange [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + exchange -- ONE_TO_ONE_EXCHANGE |PARTITIONED| - unnest-map [$$16, $$17, $$l] <- index-search("LineItem", 0, "tpch", "LineItem", false, false, 2, $$24, $$25, 2, $$24, $$25, true, true, true) [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + unnest-map [$$16, $$17, $$l] <- index-search("LineItem", 0, "tpch", "LineItem", false, false, 2, $$24, $$25, 2, $$24, $$25, true, true, true) -- BTREE_SEARCH |PARTITIONED| - exchange [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + exchange -- ONE_TO_ONE_EXCHANGE |PARTITIONED| - order (ASC, $$24) (ASC, $$25) [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + order (ASC, $$24) (ASC, $$25) -- STABLE_SORT [$$24(ASC), $$25(ASC)] |PARTITIONED| - exchange [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + exchange -- ONE_TO_ONE_EXCHANGE |PARTITIONED| - project ([$$24, $$25]) [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + project ([$$24, $$25]) -- STREAM_PROJECT |PARTITIONED| - exchange [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + exchange -- ONE_TO_ONE_EXCHANGE |PARTITIONED| - unnest-map [$$23, $$24, $$25] <- index-search("lineitem_shipdateIx", 0, "tpch", "LineItem", false, false, 1, $$21, 1, $$22, true, true, true) [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + unnest-map [$$23, $$24, $$25] <- index-search("lineitem_shipdateIx", 0, "tpch", "LineItem", false, false, 1, $$21, 1, $$22, true, true, true) -- BTREE_SEARCH |PARTITIONED| - exchange [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + exchange -- ONE_TO_ONE_EXCHANGE |PARTITIONED| - assign [$$21, $$22] <- ["1994-01-20", "1994-01-20"] [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + assign [$$21, $$22] <- ["1994-01-20", "1994-01-20"] -- ASSIGN |PARTITIONED| - empty-tuple-source [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] + empty-tuple-source -- EMPTY_TUPLE_SOURCE |PARTITIONED|
