andygrove opened a new issue, #113:
URL: https://github.com/apache/datafusion-spark/issues/113

   ### Describe the bug
   
   `next_day` returns NULL for an unrecognized day-of-week name whatever the 
ANSI setting. With `datafusion.execution.enable_ansi_mode = true`, Spark raises 
`ILLEGAL_DAY_OF_WEEK`. The code has `TODO: if spark.sql.ansi.enabled is false, 
...` comments where the error would go 
([next_day.rs](https://github.com/apache/datafusion-spark/blob/main/crates/spark/src/function/datetime/next_day.rs)).
   
   ### To Reproduce
   
   ```sql
   SET datafusion.execution.enable_ansi_mode = true;
   SELECT next_day(DATE '2024-01-01', 'xx');
   -- datafusion-spark: NULL
   -- Spark 4.2.0 (ANSI on): [ILLEGAL_DAY_OF_WEEK] Illegal input for day of 
week: xx. SQLSTATE: 22009
   ```
   
   With ANSI off, both return NULL.
   
   ### Expected behavior
   
   When ANSI mode is on, raise `ILLEGAL_DAY_OF_WEEK` for an unrecognized day 
name. Keep returning NULL when it is off.
   
   ### Additional context
   
   #25 says both modes are implemented and tested. That was true of the 
upstream DataFusion code it describes, but the code in this repository only 
implements the non-ANSI behavior. #25 covers the differences between Spark 
versions; this issue covers implementing the ANSI behavior at all. Spark 
results come from PySpark 4.2.0.
   


-- 
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