fix: Verify supported type for Unary::Plus in sql planner #13019
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.
Which issue does this PR close?
Closes #11175.
Rationale for this change
This makes datafusion reject unary plus in more cases. This aligns our behavior with postgres and other engines by rejecting sql like
select +true
.What changes are included in this PR?
This adds a type check when planning unary plus operator. Since we
currently do not represent the operator in our logical plan we can not
check it later. Instead of introducing a new
Expr
this patch justverifies the type during the translation instead.
Are these changes tested?
New and existing tests.
Are there any user-facing changes?
We will no reject Unary::Plus in more cases. There is some risk that the old behavior hide bug in users code that no will cause failures.