-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
expression: avoid Order By
constant expression error when plan cache is enabled
#16261
Conversation
Codecov Report
@@ Coverage Diff @@
## master #16261 +/- ##
===========================================
Coverage 80.6437% 80.6437%
===========================================
Files 506 506
Lines 138441 138441
===========================================
Hits 111644 111644
Misses 18193 18193
Partials 8604 8604 |
should we also cherry-pick this bugfix to release-2.1, release-3.0 and release-3.1? |
@zz-jason plan cache is not GA for those branches, so we don't need cherry-picks for them? |
Users may use plan cache in these old releases. If they met this bug and not willing to upgrade the cluster to release-4.0, maybe they can update there cluster to the latest version in the corresponding release branch. |
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
@eurekaka merge failed. |
/run-unit-test |
2 similar comments
/run-unit-test |
/run-unit-test |
cherry pick to release-3.0 in PR #16673 |
cherry pick to release-3.1 in PR #16674 |
cherry pick to release-4.0 in PR #16675 |
Should |
Signed-off-by: sre-bot <[email protected]>
Signed-off-by: sre-bot <[email protected]>
Signed-off-by: sre-bot <[email protected]> Co-authored-by: Kenan Yao <[email protected]>
What problem does this PR solve?
Issue Number: close #16203
Problem Summary:
Error is reported for
order by rand()
when plan cache is enabled.What is changed and how it works?
What's Changed:
remove
Rand
/Sysdate
/UUID
fromDeferredFunctions
, because they should not be folded into constant according tounFoldableFunctions
, otherwise, they would be converted to aConstant
withDeferredExpr
infuncCallToExpression
. This change makes the behavior regarding these functions consistent when plan cache is enabled / disabled.check if the order by items can be treated as constants during execution using a new function, instead of
IsMutableEffectsExpr
, which is specifically designed for de-duplicating expressions.How it Works:
Related previous PRs for this change:
now()
;order by rand()
when plan cache is disabled by usingConstItem()
;order by
clause #11839: second fix fororder by rand()
when plan cache is disabled by usingIsMutableEffectsExpr()
;Related changes
Check List
Tests
Side effects
N/A
Release note