-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
ddl: add the not
expression check when creating a partition table
#21497
Conversation
/label type/bug-fix, sig/ddl |
/cc @wjhuang2016 |
/cc @tiancaiamao |
…o `checkPartitionExprFuncAllowed`
� Conflicts: � ddl/db_partition_test.go
a white-list of allowed expression of partition table will be much easier to compatible with MySQL because MySQL uses white-list too. we will always not sure whether we miss some expressions check if we use a black-list. |
/run-all-tests |
/run-check_dev |
ddl/partition.go
Outdated
ast.DateDiff: {}, ast.Floor: {}, ast.Mod: {}, | ||
} | ||
if _, ok := allowedFuncMap[expr.FnName.L]; ok { | ||
case *ast.FuncCastExpr, *ast.CaseExpr, *ast.SubqueryExpr, *ast.WindowFuncExpr, *ast.RowExpr, *ast.DefaultExpr, *ast.ValuesExpr, |
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.
we should explicitly list the expr
which is allowed in partition expression. Although there are many expr
, only a few of them are allowed.
/run-all-tests |
/run-all-tests |
/run-e2e-tests |
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
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
@xiongjiwei, Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments. See the corresponding SIG page for more information. Related SIG: execution(slack). |
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
@Reminiscent merge failed. |
/run-e2e-tests |
What problem does this PR solve?
Issue Number: close #17808
Problem Summary:
When TiDB uses
HASH(not c)
as the partition condition, it will convertnot c
toUnaryOperationExpr
instead ofFuncCallExpr
to check whether the expression is valid.What is changed and how it works?
What's Changed:
When we use
checkPartitionExprArgs
for checking whether the expression is valid. , we addUnaryOperationExpr
into consideration. And if the operand is not, we will report an error.Before this PR:
After this PR:
How it Works:
Tests
Release note
not
expression check when creating a partition table