Impala Public Jenkins has submitted this change and it was merged. ( 
https://gerrit.cloudera.org/25213 )

Change subject: IMPALA-15633/IMPALA-15634: Fix LIKE and folded string push down 
to Iceberg
......................................................................

IMPALA-15633/IMPALA-15634: Fix LIKE and folded string push down to Iceberg

IcebergPredicateConverter had several problems:
- 'ab_' became startsWith('ab') and was marked fully converted, so
  scans on identity partitions, SHOW FILES and DROP PARTITION used it
  as an exact filter.
- NOT was applied to relaxed expressions, e.g. NOT (s LIKE 'a%b')
  became NOT startsWith(s, 'a').
- Backslashes in LIKE patterns were not handled like in the backend.
- LIKE under NOT or OR crashed planning on NULL partition values in
  Iceberg's ResidualEvaluator.
- Constant folded string literals were unescaped again, and non UTF-8
  literals made the query fail.
- In partition statements, LIKE on a partition transform was applied
  to the source column.

This patch:
- Converts LIKE patterns like LikePredicate::OptimizeConstantPatternMatch()
  does: patterns without wildcards and 'prefix%' patterns are matched
  verbatim, other patterns follow the regex escaping rules.
- Doesn't push down LIKE under NOT or OR, or NOT of partially converted
  predicates. LIKE under OR no longer prunes partitions.
- Reads string literals as StringLiteral.toThrift() sends them to the
  backend, and doesn't push down non UTF-8 strings. Iceberg column
  default values had the same problem and are fixed too.
- Builds LIKE predicates on the partition transform term.
- Fixes LikePredicate.computeEvalCost() for non UTF-8 patterns.

Testing:
- Added unit tests to IcebergPredicateConverterTest.
- Added TestIcebergStringPushDown, which compares pushed down LIKE,
  NOT LIKE, LIKE under OR and folded string predicates with the
  backend's results on partition and non-partition columns, and tests
  SHOW FILES and DROP PARTITION.
- Updated iceberg-like-pushdown.test and iceberg-v3-default-values.test.

Change-Id: I69d178f63914c88650d546f46cec2ac34077dc2a
Assisted-by: Claude Opus 5.5 (Cursor)
Reviewed-on: https://gerrit.cloudera.org/25213
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
M be/src/exprs/like-predicate.h
M fe/src/main/java/org/apache/impala/analysis/ColumnDef.java
M fe/src/main/java/org/apache/impala/analysis/LikePredicate.java
M fe/src/main/java/org/apache/impala/analysis/StringLiteral.java
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/util/IcebergSchemaConverter.java
M fe/src/test/java/org/apache/impala/common/IcebergPredicateConverterTest.java
M 
testdata/workloads/functional-query/queries/QueryTest/iceberg-like-pushdown.test
M 
testdata/workloads/functional-query/queries/QueryTest/iceberg-null-partition-predicates.test
M 
testdata/workloads/functional-query/queries/QueryTest/iceberg-v3-default-values.test
M tests/query_test/test_iceberg.py
12 files changed, 681 insertions(+), 180 deletions(-)

Approvals:
  Impala Public Jenkins: Looks good to me, approved; Verified

--
To view, visit https://gerrit.cloudera.org/25213
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I69d178f63914c88650d546f46cec2ac34077dc2a
Gerrit-Change-Number: 25213
Gerrit-PatchSet: 5
Gerrit-Owner: Arnab Karmakar <[email protected]>
Gerrit-Reviewer: Arnab Karmakar <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>

Reply via email to