datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

refactor!: consistent null handling in coercible signatures

Open alan910127 opened this issue 9 months ago • 3 comments

Which issue does this PR close?

  • Closes #15013.

Rationale for this change

Currently, there is a special case for null handling in TypeSignatureClass::matches_native_type, which causes inconsistencies and issues between TypeSignatureClass::matches_native_type and TypeSignatureClass::default_casted_type (it will hit the else match arm which returns an error) when self is not a TypeSignatureClass::Native.

What changes are included in this PR?

  1. Remove the special handling of null case in TypeSignatureClass::matches_native_type
  2. Add TypeSignatureClass::Native(logical_null()) where the argument is nullable and it was not originally supplied.

Are these changes tested?

These changes should be covered in existing test.

Are there any user-facing changes?

Yes, if the user rely on the special null case handling behavior of 'TypeSignatureClass::Native, they will need to transform the usage to Coercible::new_implicitand add aTypeSignatureClass::Native(logical_null())`.

alan910127 avatar Mar 25 '25 03:03 alan910127

Hi @alamb, I’ve updated upgrading.md. Since this is my first PR with an API change, I’m not 100% sure I did everything right. Would appreciate it if you could take a look and let me know if anything needs adjusting. Thanks!

alan910127 avatar Apr 14 '25 17:04 alan910127

Thanks @alan910127 -- I'll check it out in a few days

alamb avatar Apr 16 '25 21:04 alamb

Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jun 17 '25 02:06 github-actions[bot]