[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 <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Vijay Sarathy <vijay.sarathy@couchbase.com>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
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 3409621..be21673 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 @@
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 @@
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 @@
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 @@
if (!conf.isGenerateJobSpec()) {
if (isQuery || isLoad) {
- generateOptimizedLogicalPlan(plan, output.config().getPlanFormat(), isExplainOnly);
+ generateOptimizedLogicalPlan(plan, output.config().getPlanFormat(), cboMode);
}
return null;
}
@@ -337,7 +338,7 @@
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 1cc8fbc..95d29da 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 c1522a6..6faed2f 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 c1522a6..6faed2f 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|