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

Add, Minus, Multiply, divide, Modulo operator work with literal NULL #2609

Closed
Tracked by #2483
WinkerDu opened this issue May 24, 2022 · 0 comments · Fixed by #2610
Closed
Tracked by #2483

Add, Minus, Multiply, divide, Modulo operator work with literal NULL #2609

WinkerDu opened this issue May 24, 2022 · 0 comments · Fixed by #2610
Labels
enhancement New feature or request

Comments

@WinkerDu
Copy link
Contributor

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
There is bug when binary mathematical operators +, -, *, /, % work with literal NULL

To reproduce

> select column1 + NULL from (VALUES (1, 2.3), (2, 5.4)) as t
Plan("'Int64 + Null' can't be evaluated because there isn't a common type to coerce the types to")

Postgres works like

# select column1 + NULL from (VALUES (1, 2.3), (2, 5.4)) as t;
 ?column? 
----------
         
         
(2 rows)

Describe the solution you'd like

  • Adjusts mathematics_numerical_coercion in binary_rule.rs, make it work well on condition that at most one side of lhs or rhs is NULL
  • Enhances compute_op_scalar macro in binary.rs to produce NULL array when scalar value is NULL

Describe alternatives you've considered
No.

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant