ueshin commented on PR #45377:
URL: https://github.com/apache/spark/pull/45377#issuecomment-2038202349

   When `df.select` with multiple expressions, both `fragment` and `callSite` 
seem to be different from Scala's.
   
   ```py
   >>> spark.conf.set("spark.sql.ansi.enabled", True)
   >>> df = spark.range(10)
   >>> df.select(
   ...   df.id / 10,
   ...   df.id + 4,
   ...   df.id / 0,
   ...   df.id * 5
   ... ).show()
   pyspark.errors.exceptions.captured.ArithmeticException: [DIVIDE_BY_ZERO] 
Division by zero. Use `try_divide` to tolerate divisor being 0 and return NULL 
instead. If necessary set "spark.sql.ansi.enabled" to "false" to bypass this 
error. SQLSTATE: 22012
   == DataFrame ==
   "divide" was called from
   java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
   
   == PySpark call site ==
   "multiply" was called from
   <stdin>:5
   ```
   
   whereas:
   
   ```scala
   scala> df.select(
        |   df("id") / 10,
        |   df("id") + 4,
        |   df("id") / 0,
        |   df("id") * 5
        | ).show()
   org.apache.spark.SparkArithmeticException: [DIVIDE_BY_ZERO] Division by 
zero. Use `try_divide` to tolerate divisor being 0 and return NULL instead. If 
necessary set "spark.sql.ansi.enabled" to "false" to bypass this error. 
SQLSTATE: 22012
   == DataFrame ==
   "div" was called from
   <init>(<console>:4)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to