Skip to content

API, Core, Spark: Add CONTAINS and NOT_CONTAINS expressions - #17906

Draft
shiva-imc wants to merge 1 commit into
apache:mainfrom
shiva-imc:contains-expressions
Draft

API, Core, Spark: Add CONTAINS and NOT_CONTAINS expressions#17906
shiva-imc wants to merge 1 commit into
apache:mainfrom
shiva-imc:contains-expressions

Conversation

@shiva-imc

@shiva-imc shiva-imc commented Aug 31, 2026

Copy link
Copy Markdown

Add CONTAINS / NOT_CONTAINS (substring match on string terms) to the expression API, alongside the existing STARTS_WITH / NOT_STARTS_WITH.

Spark emits a DSv2 CONTAINS predicate for the contains() function, but Iceberg has no matching operation, so the predicate is dropped at SparkV2Filters and any operation that could otherwise be answered from metadata falls back to row-level scans. The motivating case: DELETE FROM t WHERE contains(part_col, 'x') on an identity-partitioned column is decidable exactly from partition values, but today plans as a full copy-on-write scan-and-rewrite. With this change it plans as a metadata-only delete.

Spark emits a DSv2 CONTAINS predicate for contains() but Iceberg
has no matching operation, so predicates decidable from partition
values fall back to row-level scans. Evaluation is exact where
complete values exist and conservative from truncated bounds,
mirroring STARTS_WITH.
@shiva-imc
shiva-imc force-pushed the contains-expressions branch from a4c83aa to 2093fdd Compare August 31, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant