This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 408d0c2d44 [ASTERIXDB-3665]: Skip empty-sample check when cboTestMode 
flag is enabled
408d0c2d44 is described below

commit 408d0c2d443765d5cfdb65789c9f8b15f698a550
Author: Janhavi Tripurwar <[email protected]>
AuthorDate: Wed Dec 17 00:26:01 2025 +0530

    [ASTERIXDB-3665]: Skip empty-sample check when cboTestMode flag is enabled
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    - Skip empty-sample check when cboTestMode flag is enabled
    - Move some methods to OperatorUtils for better accessibility.
    
    Ext-ref: MB-68941
    
    Change-Id: I120a825823198fbc0e7704d32a7720be01b3c689
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20685
    Integration-Tests: Jenkins <[email protected]>
    Tested-by: Jenkins <[email protected]>
    Tested-by: Janhavi Tripurwar <[email protected]>
    Reviewed-by: Ali Alsuliman <[email protected]>
---
 .../asterix/optimizer/rules/cbo/EnumerateJoinsRule.java | 15 ++-------------
 .../asterix/optimizer/rules/cbo/OperatorUtils.java      | 17 +++++++++++++++--
 2 files changed, 17 insertions(+), 15 deletions(-)

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 66009e4dac..d57f52ebc6 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.plan.ALogicalPlanImpl;
 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 class EnumerateJoinsRule implements 
IAlgebraicRewriteRule {
     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 class EnumerateJoinsRule implements 
IAlgebraicRewriteRule {
         }
     }
 
-    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 4d341f52f5..321603d039 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.AssignOperat
 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 @@ public class OperatorUtils {
         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 @@ public class OperatorUtils {
                 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;
             }

Reply via email to