[FLINK-39421] Metadata filter push-down for table sources#27913
Open
jnh5y wants to merge 1 commit intoapache:masterfrom
Open
[FLINK-39421] Metadata filter push-down for table sources#27913jnh5y wants to merge 1 commit intoapache:masterfrom
jnh5y wants to merge 1 commit intoapache:masterfrom
Conversation
Add dedicated metadata filter push-down path through SupportsReadingMetadata. Metadata predicates are classified separately from physical predicates and pushed via applyMetadataFilters() with a dedicated MetadataFilterResult type. MetadataFilterPushDownSpec stores a pre-translated predicateRowType using metadata key names (not SQL aliases), making the serialized spec self-contained without needing a column-to-key mapping. Generated-by: Claude Code (claude-opus-4-6) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2b6f73d to
f96af04
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add dedicated metadata filter push-down path through SupportsReadingMetadata. Metadata predicates are classified separately from physical predicates and pushed via applyMetadataFilters() with a dedicated MetadataFilterResult type.
MetadataFilterPushDownSpec stores a pre-translated predicateRowType using metadata key names (not SQL aliases), making the serialized spec self-contained without needing a column-to-key mapping.
Generated-by: Claude Code (claude-opus-4-6)
What is the purpose of the change
Predicates on metadata columns (e.g., Kafka
offset,timestamp,partition) cannot be pushed through the existingSupportsFilterPushDownpath becauseFilterPushDownSpec's serializedRexInputRefindices break during compiled plan restoration whenProjectPushDownSpecnarrows the row type. This PR adds a dedicated metadata filter push-down path that solves the serialization problem and enables metadata-aware source optimizations. See FLIP-574 for the full design.Brief change log
SupportsReadingMetadatawithsupportsMetadataFilterPushDown()andapplyMetadataFilters()default methods and aMetadataFilterResulttypeMetadataFilterPushDownSpecthat snapshots the predicate row type at optimization time, using metadata key names (not SQL aliases)PushFilterIntoTableSourceScanRuleto classify predicates as physical, metadata, or mixed, with a two-path push-down flowVerifying this change
This change added tests and can be verified as follows:
MetadataFilterInReadingMetadataTestwith 6 planner rule tests: basic push-down, opt-out when unsupported, aliased metadata keys, mixed physical+metadata separation, partial acceptance, and interaction with projection push-downDynamicTableSourceSpecSerdeTestforMetadataFilterPushDownSpecDoes this pull request potentially affect one of the following parts:
@Public(Evolving): yes — new default methods on@PublicEvolvinginterfaceSupportsReadingMetadataDocumentation