[ 
https://issues.apache.org/jira/browse/SPARK-48016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gengliang Wang resolved SPARK-48016.
------------------------------------
    Fix Version/s: 3.4.4
       Resolution: Fixed

Issue resolved by pull request 46289
[https://github.com/apache/spark/pull/46289]

> Fix a bug in try_divide function when with decimals
> ---------------------------------------------------
>
>                 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
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.4.4
>
>
> 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