Gengliang Wang created SPARK-48016:
--------------------------------------

             Summary: Binary Arithmetic operators should include the evalMode 
during makeCopy
                 Key: SPARK-48016
                 URL: https://issues.apache.org/jira/browse/SPARK-48016
             Project: Spark
          Issue Type: Sub-task
          Components: SQL
    Affects Versions: 4.0.0, 3.5.2
            Reporter: Gengliang Wang
            Assignee: Gengliang Wang


Binary Arithmetic operators should include the evalMode during makeCopy. 
Otherwise, the following query will throw DIVIDE_BY_ZERO error instead of 
returning null

 
{code:java}
SELECT try_divide(1, decimal(0)); {code}
This is caused from the rule DecimalPrecision:
{code:java}
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)) {code}
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to