>From Janhavi Tripurwar <[email protected]>:
Janhavi Tripurwar has uploaded this change for review. (
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20685?usp=email )
Change subject: [ASTERIXDB-3665]: Skip empty sample check in cboTestMode
......................................................................
[ASTERIXDB-3665]: Skip empty sample check in cboTestMode
Change-Id: I120a825823198fbc0e7704d32a7720be01b3c689
---
M
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EnumerateJoinsRule.java
M
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/OperatorUtils.java
2 files changed, 17 insertions(+), 15 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/85/20685/1
diff --git
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EnumerateJoinsRule.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EnumerateJoinsRule.java
index 66009e4..d57f52e 100644
---
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EnumerateJoinsRule.java
+++
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EnumerateJoinsRule.java
@@ -74,7 +74,6 @@
import
org.apache.hyracks.algebricks.core.algebra.prettyprint.IPlanPrettyPrinter;
import
org.apache.hyracks.algebricks.core.algebra.util.OperatorManipulationUtil;
import org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
-import
org.apache.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig;
import org.apache.hyracks.api.exceptions.ErrorCode;
import org.apache.hyracks.api.exceptions.IWarningCollector;
import org.apache.hyracks.api.exceptions.Warning;
@@ -155,8 +154,8 @@
public boolean rewritePre(Mutable<ILogicalOperator> opRef,
IOptimizationContext context)
throws AlgebricksException {
- boolean cboMode = getCBOMode(context);
- boolean cboTestMode = getCBOTestMode(context);
+ boolean cboMode = OperatorUtils.getCBOMode(context);
+ boolean cboTestMode = OperatorUtils.getCBOTestMode(context);
if (!(cboMode || cboTestMode)) {
return false;
@@ -886,16 +885,6 @@
}
}
- public static boolean getCBOMode(IOptimizationContext context) {
- PhysicalOptimizationConfig physOptConfig =
context.getPhysicalOptimizationConfig();
- return physOptConfig.getCBOMode();
- }
-
- public static boolean getCBOTestMode(IOptimizationContext context) {
- PhysicalOptimizationConfig physOptConfig =
context.getPhysicalOptimizationConfig();
- return physOptConfig.getCBOTestMode();
- }
-
/**
* Should not see any kind of joins here. store the emptyTupeSourceOp and
DataSource operators.
* Each leaf input will normally have both, but sometimes only
emptyTupeSourceOp will be present (in lists)
diff --git
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/OperatorUtils.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/OperatorUtils.java
index 4d341f5..321603d 100644
---
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/OperatorUtils.java
+++
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/OperatorUtils.java
@@ -52,6 +52,7 @@
import
org.apache.hyracks.algebricks.core.algebra.operators.logical.DataSourceScanOperator;
import
org.apache.hyracks.algebricks.core.algebra.operators.logical.DistinctOperator;
import
org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator;
+import
org.apache.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig;
import org.apache.hyracks.api.exceptions.SourceLocation;
public class OperatorUtils {
@@ -363,9 +364,20 @@
return doAllDataSourcesHaveSamples(leafInputs, context, true);
}
+ public static boolean getCBOMode(IOptimizationContext context) {
+ PhysicalOptimizationConfig physOptConfig =
context.getPhysicalOptimizationConfig();
+ return physOptConfig.getCBOMode();
+ }
+
+ public static boolean getCBOTestMode(IOptimizationContext context) {
+ PhysicalOptimizationConfig physOptConfig =
context.getPhysicalOptimizationConfig();
+ return physOptConfig.getCBOTestMode();
+ }
+
// check to see if every dataset has a sample. If not, CBO code cannot
run. A warning message must be issued as well.
public static boolean doAllDataSourcesHaveSamples(List<AbstractLeafInput>
leafInputs, IOptimizationContext context,
boolean handle) throws AlgebricksException {
+ boolean cboTestMode = getCBOTestMode(context);
if (!handle) {
return false;
}
@@ -381,9 +393,10 @@
return false;
}
Index.SampleIndexDetails idxDetails = (Index.SampleIndexDetails)
index.getIndexDetails();
- double origDatasetCard = idxDetails.getSourceCardinality();
// empty samples
- if (origDatasetCard == 0) {
+ double origDatasetCard = idxDetails.getSourceCardinality();
+ // Skip empty sample check in cboTestMode so tests can run range
map computation
+ if (origDatasetCard == 0 && !cboTestMode) {
ExceptionUtil.warnEmptySamples(origDatasetCard,
scanOp.getSourceLocation(), context);
return false;
}
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20685?usp=email
To unsubscribe, or for help writing mail filters, visit
https://asterix-gerrit.ics.uci.edu/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120a825823198fbc0e7704d32a7720be01b3c689
Gerrit-Change-Number: 20685
Gerrit-PatchSet: 1
Gerrit-Owner: Janhavi Tripurwar <[email protected]>