LIKE predicate pushdown feature
Impala pushes eligible SQL LIKE predicates on Iceberg tables to
Iceberg expressions for file and partition pruning.
The Iceberg specification supports expression-based filtering through manifest statistics.
Impala translates eligible LIKE predicates to Iceberg
startsWith() and equal() expressions during query
planning. This enables Iceberg to skip files and partitions that cannot contain matching
rows.
You need not run this optimization with new SQL syntax or table properties. Impala applies it
automatically when the LIKE pattern is eligible for pushdown.
Direct predicate pushdown
For patterns where wildcard behavior is straightforward, Impala translates the
LIKE predicate directly to an Iceberg expression:
SQL LIKE pattern |
Iceberg expression |
|---|---|
LIKE 'abc%' |
startsWith('abc') |
LIKE 'pre_fix%' |
startsWith('pre') |
LIKE 'exact' |
equal('exact') |
LIKE 'asd\%' |
equal('asd%') |
Relaxed predicate pushdown
For complex patterns that contain literal content after a wildcard (for example,
LIKE 'prefix%suffix' or LIKE 'd%d'), Impala uses a
two-phase approach:
- Impala pushes a relaxed prefix predicate to Iceberg (for example,
startsWith('prefix')) for coarse-grained file and partition pruning. - Impala retains the full
LIKEpredicate and evaluates it on the surviving rows to return correct results.
Limitations
Impala cannot push down LIKE patterns that start with a wildcard, such as
LIKE '%suffix' or LIKE '_prefix', because there is no
leading literal prefix to translate.
For ALTER TABLE … DROP PARTITION and SHOW FILES IN …
PARTITION, Impala supports simple prefix LIKE patterns (for
example, s LIKE 'd%'). Patterns with literal content after a wildcard are
rejected to prevent unintended partition operations. For example, DROP PARTITION (s
LIKE 'd%d') returns an error similar to the following:
AnalysisException: Predicate 's LIKE 'd%d'' can only be partially converted to Iceberg expression
Impala example
-- Direct pushdown: prefix pattern on a partitioned column
SELECT count(*) FROM ice_part WHERE action LIKE 'c%';
-- Relaxed pushdown: literal content after wildcard
SELECT s FROM ice_tbl WHERE s LIKE 'test%value';
