Zoltan Borok-Nagy has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/25200


Change subject: IMPALA-15643: Iceberg predicates must not match NULL partitions
......................................................................

IMPALA-15643: Iceberg predicates must not match NULL partitions

Iceberg orders NULL values before any other value, so it evaluates
predicates like p < 5, p != 5, p NOT IN (5, 7) and NOT (p = 5) as true
for NULL values. In Impala they are NULL for NULL values, so the row
doesn't match. The scanner doesn't evaluate the predicates that Iceberg
fully evaluated on the partition values, so queries returned the rows
of NULL partitions, and ALTER TABLE DROP PARTITION dropped them. LIKE,
NOT LIKE, and IN and NOT IN with several values on a string partition
column with a NULL partition failed with a NullPointerException in
Iceberg if the NULL partition wasn't pruned.

IcebergPredicateConverter now pushes the negations of the converted
expression down to the predicates, which is equivalent in Impala's
three valued logic, and adds 'IS NOT NULL' to the predicates that would
match NULL values on nullable columns that are sources of partition
fields. IN and NOT IN with several string values are converted to ORs
of = and ANDs of != for such columns. LIKE and NOT LIKE are only
converted for them if the expression can't be true for NULL values, so
Iceberg prunes the NULL partitions before it evaluates them.
Other columns are not affected, because Iceberg keeps the predicates
on them in the residuals, so the scanner evaluates them.

Predicate subsetting now maps the predicates in the residuals back to
the Impala conjuncts they were translated from, so conjuncts with an
added 'IS NOT NULL' can still be skipped. The predicates are mapped by
their string form, like the residuals, because the same predicate can
occur in several conjuncts.

Testing:
 - Added EE tests for scans, SHOW FILES, SHOW PARTITIONS and DROP
   PARTITION with NULL partitions of identity and transform partition
   fields, and for subsetting with equal residuals.
 - Updated tests that expected NULL partitions for != and NOT IN, and
   planner tests where more conjuncts are skipped.

Change-Id: I4eeb24cd16f8a0f2279d8a52e6d26d477410b6a5
Assisted-by: Claude Opus 5.5 (Claude Code)
---
M 
fe/src/main/java/org/apache/impala/common/IcebergPartitionPredicateConverter.java
M fe/src/main/java/org/apache/impala/common/IcebergPredicateConverter.java
M fe/src/main/java/org/apache/impala/planner/IcebergScanPlanner.java
M fe/src/main/java/org/apache/impala/util/IcebergUtil.java
M 
java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaHdfsScanRel.java
M 
testdata/workloads/functional-planner/queries/PlannerTest/iceberg-predicates.test
A 
testdata/workloads/functional-query/queries/QueryTest/iceberg-null-partition-predicates.test
M 
testdata/workloads/functional-query/queries/QueryTest/iceberg-predicate-subsetting.test
M testdata/workloads/functional-query/queries/QueryTest/iceberg-uuid-type.test
M tests/query_test/test_iceberg.py
10 files changed, 514 insertions(+), 18 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/00/25200/1
--
To view, visit http://gerrit.cloudera.org:8080/25200
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4eeb24cd16f8a0f2279d8a52e6d26d477410b6a5
Gerrit-Change-Number: 25200
Gerrit-PatchSet: 1
Gerrit-Owner: Zoltan Borok-Nagy <[email protected]>
Gerrit-Reviewer: Noemi Pap-Takacs <[email protected]>

Reply via email to