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

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

commit e427ad3c3f5a36aacf107e8535963aaf0725a924
Author: Fang-Yu Rao <[email protected]>
AuthorDate: Fri Feb 28 10:05:04 2025 -0800

    IMPALA-13716 (Addendum): Simplify the call site of createSingleNodePlan()
    
    IMPALA-13716 added an input argument to createSingleNodePlan() that
    requires the caller to provide a List of TupleIsNullPredicate. Since
    this List depends only on the given PlanNode, this patch adds a
    method that computes this List when it is not provided by the caller,
    which simplifies the call site as well.
    
    This patch also moves getTupleIsNullPreds() to AnalyticPlanner.java
    because it is only used in AnalyticPlanner.java. We make the method
    a static one because it's not specific to an instance of
    AnalyticPlanner.java.
    
    Change-Id: Ie10361f15db4c0eb2cf5ff5f4d0a28c612b1a930
    Reviewed-on: http://gerrit.cloudera.org:8080/22564
    Tested-by: Impala Public Jenkins <[email protected]>
    Reviewed-by: Riza Suminto <[email protected]>
---
 .../java/org/apache/impala/planner/AnalyticPlanner.java | 17 +++++++++++++++++
 .../org/apache/impala/planner/SingleNodePlanner.java    | 11 +----------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/fe/src/main/java/org/apache/impala/planner/AnalyticPlanner.java 
b/fe/src/main/java/org/apache/impala/planner/AnalyticPlanner.java
index c6f54101e..5da7597a3 100644
--- a/fe/src/main/java/org/apache/impala/planner/AnalyticPlanner.java
+++ b/fe/src/main/java/org/apache/impala/planner/AnalyticPlanner.java
@@ -159,6 +159,23 @@ public class AnalyticPlanner {
     return root.addConjunctsToNode(ctx_, analyzer_, tids, substAnalyticConjs);
   }
 
+  /**
+   * Provided for a caller that does not supply a List of TupleIsNullPredicate.
+   */
+  public PlanNode createSingleNodePlan(PlanNode root,
+      List<Expr> groupingExprs, List<Expr> inputPartitionExprs) throws 
ImpalaException {
+    return createSingleNodePlan(root, groupingExprs, inputPartitionExprs,
+        getTupleIsNullPreds(root));
+  }
+
+  private static List<TupleIsNullPredicate> getTupleIsNullPreds(PlanNode 
planNode) {
+    if (planNode.getOutputSmap() == null) {
+      return new ArrayList<>();
+    }
+    return TupleIsNullPredicate.getUniqueBoundTupleIsNullPredicates(
+        planNode.getOutputSmap().getRhs(), planNode.getTupleIds());
+  }
+
   /**
    * Update selectivity of conjuncts in 'substAnalyticConjs' to reflect those 
that
    * were pushed to a partitioned top-n.
diff --git a/fe/src/main/java/org/apache/impala/planner/SingleNodePlanner.java 
b/fe/src/main/java/org/apache/impala/planner/SingleNodePlanner.java
index c73b9b85f..0a5ad5986 100644
--- a/fe/src/main/java/org/apache/impala/planner/SingleNodePlanner.java
+++ b/fe/src/main/java/org/apache/impala/planner/SingleNodePlanner.java
@@ -296,8 +296,7 @@ public class SingleNodePlanner {
 
         List<Expr> inputPartitionExprs = new ArrayList<>();
         root = analyticPlanner.createSingleNodePlan(
-            root, groupingExprs, inputPartitionExprs,
-            getTupleIsNullPreds(root));
+            root, groupingExprs, inputPartitionExprs);
         if (multiAggInfo != null && !inputPartitionExprs.isEmpty()
             && multiAggInfo.getMaterializedAggClasses().size() == 1) {
           // analytic computation will benefit from a partition on 
inputPartitionExprs
@@ -2360,12 +2359,4 @@ public class SingleNodePlanner {
     }
     return result;
   }
-
-  private List<TupleIsNullPredicate> getTupleIsNullPreds(PlanNode planNode) {
-    if (planNode.getOutputSmap() == null) {
-      return new ArrayList<>();
-    }
-    return TupleIsNullPredicate.getUniqueBoundTupleIsNullPredicates(
-        planNode.getOutputSmap().getRhs(), planNode.getTupleIds());
-  }
 }

Reply via email to