Zoltan Borok-Nagy has submitted this change and it was merged. ( 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) Reviewed-on: http://gerrit.cloudera.org:8080/25200 Reviewed-by: Noemi Pap-Takacs <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- 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(-) Approvals: Noemi Pap-Takacs: Looks good to me, approved Impala Public Jenkins: Verified -- 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: merged Gerrit-Change-Id: I4eeb24cd16f8a0f2279d8a52e6d26d477410b6a5 Gerrit-Change-Number: 25200 Gerrit-PatchSet: 2 Gerrit-Owner: Zoltan Borok-Nagy <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Noemi Pap-Takacs <[email protected]> Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>
