Skip to content

Decompose row constructor equality with constants to enable zone map pruning - #24709

Open
gulugulubing wants to merge 1 commit into
duckdb:mainfrom
gulugulubing:23594-tuple-comparison-pushdown-v2
Open

Decompose row constructor equality with constants to enable zone map pruning#24709
gulugulubing wants to merge 1 commit into
duckdb:mainfrom
gulugulubing:23594-tuple-comparison-pushdown-v2

Conversation

@gulugulubing

Copy link
Copy Markdown
Contributor

Fixes #23594

  • Adds ConstantRowComparisonSimplificationRule, which decomposes top-level filter equality between a row constructor and a folded row constant (e.g. WHERE (id, b) = (42, 2)) into scalar equalities (id = 42 AND b = 2), so that the existing filter pushdown and zone map pruning machinery applies to such comparisons
  • Handles bind-time type alignment: operands are compared in the aligned field type, so (a, b) = (42, 1.5) decomposes to a = 42 AND b = 2
  • The rule only fires for row-constructor-vs-constant comparisons: row-vs-row comparisons are left to the existing RowComparisonSimplificationRule, and non-equality operators are untouched
  • Tests: new test/sql/filter/test_tuple_comparison_pushdown.test, skipped in the disable_optimizer config since pruning requires the optimizer

@duckdb-draftbot
duckdb-draftbot marked this pull request as draft August 11, 2026 23:14
@gulugulubing
gulugulubing marked this pull request as ready for review August 11, 2026 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tuple doesn't leverage pruning

1 participant