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

stigahuang 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 3c40919f6 IMPALA-11739: Skip pushing down BinaryPredicate with 
NullLiteral for Iceberg tables
3c40919f6 is described below

commit 3c40919f6e922ef827a4ae8fbc82cb0898de73fd
Author: gaoxq <[email protected]>
AuthorDate: Mon Nov 21 20:08:23 2022 +0800

    IMPALA-11739: Skip pushing down BinaryPredicate with NullLiteral for 
Iceberg tables
    
    When iceberg partitioning column filter not NULL or equal NULL, it
    throws a ClassCastException. For example: "ERROR: ClassCastException:
    org.apache.impala.analysis. NullLiteral cannot be cast to
    org.apache.impala.analysis.StringLiteral".
    
    Testing:
      - Add 'col=NULL' and 'col!=NULL' queries in iceberg-query.test.
    
    Change-Id: Id6c50978ebac2590622027a239db03f56b082de3
    Reviewed-on: http://gerrit.cloudera.org:8080/19270
    Reviewed-by: <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
    Reviewed-by: Zoltan Borok-Nagy <[email protected]>
---
 .../org/apache/impala/planner/IcebergScanPlanner.java    |  5 +++++
 .../queries/QueryTest/iceberg-query.test                 | 16 ++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/fe/src/main/java/org/apache/impala/planner/IcebergScanPlanner.java 
b/fe/src/main/java/org/apache/impala/planner/IcebergScanPlanner.java
index 087e3234c..fbbce6455 100644
--- a/fe/src/main/java/org/apache/impala/planner/IcebergScanPlanner.java
+++ b/fe/src/main/java/org/apache/impala/planner/IcebergScanPlanner.java
@@ -556,6 +556,11 @@ public class IcebergScanPlanner {
       return null;
     }
 
+    // Cannot push BinaryPredicate with null literal values
+    if (Expr.IS_NULL_LITERAL.apply(literal)) {
+      return null;
+    }
+
     Object value = getIcebergValue(ref, literal);
     if (value == null) {
       return null;
diff --git 
a/testdata/workloads/functional-query/queries/QueryTest/iceberg-query.test 
b/testdata/workloads/functional-query/queries/QueryTest/iceberg-query.test
index 29e57b702..ef6cdbfe8 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/iceberg-query.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/iceberg-query.test
@@ -312,6 +312,22 @@ int,string,string
 4,'Alex','view'
 ====
 ---- QUERY
+# Test filter NULL
+SELECT * from iceberg_partitioned_orc_external
+where action = NULL
+---- TYPES
+int,string,string
+---- RESULTS
+====
+---- QUERY
+# Test filter !=NULL
+SELECT * from iceberg_partitioned_orc_external
+where action != NULL
+---- TYPES
+int,string,string
+---- RESULTS
+====
+---- QUERY
 SHOW PARTITIONS iceberg_partitioned_orc_external
 ---- TYPES
 string,bigint,bigint

Reply via email to