Handle Null
type in TypeSignatureClass
more consistently
#15013
Labels
enhancement
New feature or request
Is your feature request related to a problem or challenge?
Discovered in #14763 and #14872.
Currently,
NativeType::Null
is treated as a special case inTypeSignatureClass::matches_native_type
. This leads to an error inTypeSignatureClass::default_casted_type
when the signature class is notTypeSignatureClass::Native
, since bothnative_type
andorigin_type
end up beingNull
. This results in an inconsistency between the two functions.Describe the solution you'd like
One approach is to add
TypeSignatureClass::Native(logical_null())
to theallowed_source_types
ofCoercion::Implicit
whereverNULL
is valid. However, this would require modifying many places in the codebase.Describe alternatives you've considered
Another option is introducing a
Coercion::new_nullable
function, which takes the same arguments asCoercion::new_implicit
and automatically addsTypeSignatureClass::Native(logical_null())
toallowed_source_type
.Additional context
Both approaches require significant changes, so I’d love to hear thoughts on which direction makes the most sense.
The text was updated successfully, but these errors were encountered: