aweltsch commented on issue #13782: URL: https://github.com/apache/datafusion/issues/13782#issuecomment-2568812549
Out of interest I looked into this a bit and wanted to share my findings. To me it looks like this might be related to the type coercion of `NULLIF`. I reduced the example to the following query: datafusion cli: ```sql > SELECT - 4588 - 213220800 * NULLIF (1, CAST ( NULL AS REAL )) col1; +--------------+ | col1 | +--------------+ | -213225390.0 | +--------------+ ``` duckdb ```sql D SELECT - 4588 - 213220800 * NULLIF (1, CAST ( NULL AS REAL )) col1; ┌────────────┐ │ col1 │ │ int32 │ ├────────────┤ │ -213225388 │ └────────────┘ ``` Looking at just the nullif: datafusion-cli: ```sql SELECT NULLIF (1, CAST ( NULL AS REAL )); +-----------------------+ | nullif(Int64(1),NULL) | +-----------------------+ | 1.0 | +-----------------------+ ``` duckdb ```sql SELECT NULLIF (1, CAST ( NULL AS REAL )); ┌──────────────────────────────────┐ │ "nullif"(1, CAST(NULL AS FLOAT)) │ │ int32 │ ├──────────────────────────────────┤ │ 1 │ └──────────────────────────────────┘ ``` The documentation of nullif mentions that this is slightly different than postgres / duckdb: https://github.com/apache/datafusion/blob/63265fdbbc3371bff9fad4a5dd0b901d3b59c397/datafusion/functions/src/core/nullif.rs#L44-L56 Maybe this helps someone with the investigation. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org