Arnab Karmakar has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/25213


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

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)
---
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-v3-default-values.test
M tests/query_test/test_iceberg.py
11 files changed, 678 insertions(+), 174 deletions(-)



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I69d178f63914c88650d546f46cec2ac34077dc2a
Gerrit-Change-Number: 25213
Gerrit-PatchSet: 1
Gerrit-Owner: Arnab Karmakar <[email protected]>

Reply via email to