Rishab Joshi created SPARK-52659:
------------------------------------

             Summary: Misleading modulo error message in ANSI mode
                 Key: SPARK-52659
                 URL: https://issues.apache.org/jira/browse/SPARK-52659
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 4.0.0
            Reporter: Rishab Joshi


Spark throws misleading exception message for modulo operation in ANSI mode.

Here is the snapshot of the spark-shell 4.0. It suggests - "Use `try_divide`" , 
however it should have said to - "Use `try_mod`.

The spark [ANSI doc 
|https://spark.apache.org/docs/latest/sql-ref-ansi-compliance.html]also says to 
use `try_mod` to tolerate this division-by-zero. Here is the text from the 
document:
{code:java}
try_mod: identical to the remainder operator %, except that it returns NULL 
result instead of throwing an exception on dividing 0.{code}
 

This ticket is about maintaining consistency with the document and replacing 
`try_divide` with `try_mod` in the error message.

!image-2025-07-02-11-48-38-817.png|width=1178,height=287!



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to