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


The following commit(s) were added to refs/heads/master by this push:
     new a74ca6b02 IMPALA-11766: In buildBinaryStatsPredicate, an Expr needs to 
be cloned
a74ca6b02 is described below

commit a74ca6b025a5d3ee98caacca09239aea22aa41d6
Author: Steve Carlin <[email protected]>
AuthorDate: Wed Nov 30 16:07:30 2022 -0800

    IMPALA-11766: In buildBinaryStatsPredicate, an Expr needs to be cloned
    
    The following code in buildBinaryStatsPredicate has a potential bug:
    
        // Obtain the rhs expr of the input predicate
        Expr constExpr = inputPred.getChild(1);
        ...
        BinaryPredicate statsPred = new BinaryPredicate(op, slot, constExpr);
    
    The constExpr is mutable and the "new BinaryPredicate" can change
    the object. If it does, it could have an adverse effect on inputPred.
    
    Change-Id: I959f1ded63baba884391cbf23d7e59316838c8ef
    Reviewed-on: http://gerrit.cloudera.org:8080/19291
    Tested-by: Impala Public Jenkins <[email protected]>
    Reviewed-by: Daniel Becker <[email protected]>
    Reviewed-by: Michael Smith <[email protected]>
---
 fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java 
b/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java
index 35cdddc4c..cb663e432 100644
--- a/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java
+++ b/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java
@@ -547,7 +547,7 @@ public class HdfsScanNode extends ScanNode {
   private void buildBinaryStatsPredicate(Analyzer analyzer, SlotRef inputSlot,
       BinaryPredicate inputPred, BinaryPredicate.Operator op) {
     // Obtain the rhs expr of the input predicate
-    Expr constExpr = inputPred.getChild(1);
+    Expr constExpr = inputPred.getChild(1).clone();
     Preconditions.checkState(constExpr.isConstant());
 
     // Make a new slot descriptor, which adds it to the tuple descriptor.

Reply via email to