[FE] Prune InPredicate bound to distribution column. #6031
Closed
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.
Proposed changes
Prune OlapScanNode's conjuncts according the tablets to be scanned, it only support prune InPredicate.
Details
Suppose there is a table named
table_a
,table_a
's distribution column isk1
, bucket num is 2.tablet_0
contains data withk1 in (0, 2)
,tablet_1
contains data withk1 in (1, 3)
.when executing the following query:
select * from table_a where k1 in (0, 1, 2, 3)
. Suppose there are two OlapScanNode in the execution plan,scan_node_0
andscan_node_1
are responsible for scanningtablet_0
andtablet_1
respectively. Then each sacn_node's conjuncts arek1 in (0, 1, 2, 3)
.However, considering the situation of the tablets scanned by OlapScanNode, it is actually possible to prune the InPredicate of the
scan_node_0
tok1 in (0, 2)
and the InPredicate of thescan_node_1
tok1 in (1, 3)
.By prune InPredicate, we can reduce the number of ScanKeys in OlapScanNode and improve the performance of data scanning, especially when InPredicate contains a large number of elements.
Types of changes
Checklist
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...