[FLINK-40116][state] Support more predicates for filter pushdown during savepoint scan#28711
Draft
soin08 wants to merge 2 commits into
Draft
[FLINK-40116][state] Support more predicates for filter pushdown during savepoint scan#28711soin08 wants to merge 2 commits into
soin08 wants to merge 2 commits into
Conversation
Collaborator
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.
What is the purpose of the change
This pull request improves filter pushdown logic in the
savepointTable API connector by supporting more predicates:At the current stage I've implemented this approach and added 2 new filters
ExclusionKeyFilterPlanandConjunctionKeyFilterPlan, to demonstrate.Brief change log
TO DISCUSS:
Currently filters live in the package
org.apache.flink.state.api.filter. Users of DataStream API can importSavepointKeyFilterand create a new filter withSavepointKeyFilter.exact(),SavepointKeyFilter.range(), or implement their own filter.savepointconnector in the Table API also uses these filters to prune input splits and / or optimize state reading by excluding reading state for the keys the user didn't request.Inside
SavepointKeyFilter, only.test()and.getExactKeys()methods are used during the execution of the job. The rest of the methods, such asgetLowerBound(),getUpperBound()andintersect()are only used during the planning phase.In the future, more planning-state-only methods will be added to this interface. I think it will be a better design if we only leave user-facing methods inside this interface (
.test()and.getExactKeys()), since those are the only ones needed for the runtime.Proposition:
SavepointKeyFilterPlan implements SavepointKeyFilterwhich will be used only by the Table API. It will contain all the methods needed for filter resolution:intersect(),getLowerBound(),getUpperBound(). When we want to support more filters, we will add methods toSavepointKeyFilterPlaninstead of the user-facingSavepointKeyFilter.SavepointKeyFilterbecomes simple, no need to explain in the docs that some methods are only used internally by the table apiSavepointKeyFilter.empty(), since it will no longer make senseExactKeyFilterandRangeKeyFilterbecome common predefined filters to be used with the DataStream API, Table API no longer depends on themRangeKeyFilterno longer needsgetUpperBoundandgetLowerBound, soBoundInfoclass becomes internal to the Table API.Expected result:
A downside:
SavepointKeyFilterPlan, they need to duplicate logic for range filter and exact filter. Alternatively,ExactKeyFilterPlancan instantiateExactKeyFilterand delegate to it its.test()andgetExactKeys. Same forRangeKeyFilterPlan.Verifying this change
This change is coveted by existing and new tests: TODO
Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR
Generated-by: Claude