You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Decimals of different precisions and scales are properly rebased when working with Literal values. Otherwise, they are not rebased, which leads to an error.
From what I've gathered after investigating this, I think the problem lies in how the sql_expr_to_logical_expr is making a plan for evaluating such an expression. sql_expr_to_logical_expr makes a plan:
sql_expr_to_logical_expr
Eventually binary_op called
binary called
binary_numeric_coercion called
decimal_coercion called
get_wider_decimal called
decimals converted to same scale for comparison
For the first case, the multiplication is done first and then the above flow is done. For the second query, the plan is made first, so the plan converts the decimals and then proceeds to multiply the left one which leads to a scale change in the left decimal. Hence the error.
I've deduced this from dry running this. I'll drop a comment once I go through the stack made by sql_expr_to_logical_expr.
Describe the bug
Decimals of different precisions and scales are properly rebased when working with
Literal
values. Otherwise, they are not rebased, which leads to an error.To Reproduce
Expected behavior
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: