Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Fix mv partition prune failed when partition column predicate with function #46786

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

kaijianding
Copy link
Contributor

@kaijianding kaijianding commented Jun 7, 2024

Why I'm doing:

What I'm doing:

Fixes #46785

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.3
    • 3.2
    • 3.1
    • 3.0
    • 2.5

Copy link

sonarcloud bot commented Aug 7, 2024

Copy link

github-actions bot commented Aug 7, 2024

[FE Incremental Coverage Report]

pass : 2 / 2 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/sql/optimizer/rewrite/OptOlapPartitionPruner.java 2 2 100.00% []

Copy link

github-actions bot commented Aug 7, 2024

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@@ -408,6 +409,8 @@ private static boolean isNeedFurtherPrune(List<Long> candidatePartitions, Logica
return (FunctionSet.DATE_TRUNC.equalsIgnoreCase(functionName)
|| FunctionSet.TIME_SLICE.equalsIgnoreCase(functionName))
&& !exprPartitionInfo.getIdToRange(true).containsKey(candidatePartitions.get(0));
} else if (partitionExpr.size() == 1 && partitionExpr.get(0) instanceof SlotRef) {
return !exprPartitionInfo.getIdToRange(true).containsKey(candidatePartitions.get(0));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we handle all partition exprs? eg: date_trunc/str2date/cast?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pr is to make partition prune behavior consisitent to base table and mv, eg: date_format can be used to prune partition to base table, but not to mv.

Currently, it's consistent for base table and mv on these 3 functions:

  1. date_trunc can apply partition prune to base table and mv
  2. str2date can't apply partition prune to base table and mv
  3. cast can't apply partition prune to base table and mv

We can add partition prune support to str2date/cast in another pr.

Copy link
Contributor

@LiShuMing LiShuMing Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got your meaning. So this pr only optimizes partition pruning with slot ref partitions.

@packy92 packy92 merged commit 77a35fd into StarRocks:main Aug 8, 2024
57 checks passed
Copy link

github-actions bot commented Aug 8, 2024

@Mergifyio backport branch-3.3

@github-actions github-actions bot removed the 3.3 label Aug 8, 2024
Copy link
Contributor

mergify bot commented Aug 8, 2024

backport branch-3.3

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Aug 8, 2024
…e with function (#46786)

Signed-off-by: kaijian.ding <[email protected]>
(cherry picked from commit 77a35fd)
@kaijianding kaijianding deleted the mv_prune branch August 8, 2024 12:04
wanpengfei-git pushed a commit that referenced this pull request Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mv partition prune failed when partition column predicate with function
3 participants