Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
4.0.0, 3.5.2
Description
Binary Arithmetic operators should include the evalMode during makeCopy. Otherwise, the following query will throw DIVIDE_BY_ZERO error instead of returning null
SELECT try_divide(1, decimal(0));
This is caused from the rule DecimalPrecision:
case b @ BinaryOperator(left, right) if left.dataType != right.dataType => (left, right) match { ... case (l: Literal, r) if r.dataType.isInstanceOf[DecimalType] && l.dataType.isInstanceOf[IntegralType] && literalPickMinimumPrecision => b.makeCopy(Array(Cast(l, DataTypeUtils.fromLiteral(l)), r))