sunchao opened a new issue, #7378:
URL: https://github.com/apache/datafusion-comet/issues/7378

   ### Describe the bug
   
   With ANSI mode disabled, an overflowing `try_add` or `try_multiply` can 
return a wrapped integer when it is nested in another addition or 
multiplication. Spark returns `NULL` for the inner operation, which should make 
the enclosing expression `NULL` too.
   
   ### Steps to reproduce
   
   On Apache Comet `7deeba21a4` with Spark 4.1.3, use Parquet columns so that 
Spark cannot fold the expression into a literal.
   
   ```sql
   SET spark.sql.ansi.enabled=false;
   CREATE TABLE mixed_arithmetic (a INT, b INT) USING parquet;
   INSERT INTO mixed_arithmetic VALUES (2147483647, 1);
   
   SELECT try_add(a, b) + b AS added,
          try_multiply(a, a) * b AS multiplied
   FROM mixed_arithmetic;
   ```
   
   | Execution | added | multiplied |
   | --- | ---: | ---: |
   | Spark | `NULL` | `NULL` |
   | Comet native project | -2147483647 | 1 |
   
   ### Expected behavior
   
   The native project should return `NULL` for both expressions, matching Spark.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to