Omega359 commented on code in PR #13356: URL: https://github.com/apache/datafusion/pull/13356#discussion_r1844007495
########## datafusion/sqllogictest/test_files/nullif.slt: ########## @@ -97,11 +97,35 @@ SELECT NULLIF(1, 3); ---- 1 -query I +query T SELECT NULLIF(NULL, NULL); ---- NULL +query R +select nullif(1, 1.2); +---- +1 + +query R +select nullif(1.0, 2); +---- +1 + +query error DataFusion error: Error during planning: Internal error: Failed to match any signature, errors: Error during planning: The signature expected NativeType::String but received NativeType::Int64 +select nullif(2, 'a'); + + +query T +select nullif('2', '3'); +---- +2 + +# TODO: support numeric string +# This query success in Postgres and DuckDB +query error DataFusion error: Error during planning: Internal error: Failed to match any signature, errors: Error during planning: The signature expected NativeType::String but received NativeType::Int64 +select nullif(2, '1'); Review Comment: To me what is important is not strictly what other systems support - those may/could be a guide to what datafusion will support - but whether the provided arguments to a signature can be losslessly converted to what the signature accepts and whether it logically makes sense to do so. I personally would rather be lenient for what is accepted and do casting/coercion as required than to be strict and push the onus onto the user to do that. That's just me though, I don't know if that is the general consensus of the community. Perhaps we should file a discussion ticket with the options and decide? -- 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