datafusion
datafusion copied to clipboard
fix: Verify supported type for Unary::Plus in sql planner
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 just
verifies 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.