[SPARK-38932][SQL] Datasource v2 support report distinct keys #36253
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 changes were proposed in this pull request?
SupportsReportDistinctKeys
for datasource v2reportDistinctKeysSet
inLeafNode
reportDistinctKeysSet
in datasource v2 relationreportDistinctKeysSet
atDistinctKeysVisitor
Why are the changes needed?
Datasource v2 can be used to connect to some databases who support unique key.
Spark catalyst optimizer support do further optimization through distinct keys. So it can improve the performance if the Scan reports its distinct keys to Spark.
We already have several optimizer rules for distinct keys, for example:
We also have some prs which is in progress related distinct keys, for example:
Does this PR introduce any user-facing change?
yes, a new interface added for developer
How was this patch tested?
add test