-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
coercion vec[Dictionary, Utf8] to Dictionary for coalesce function #9958
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this @Lordworms 🙏
I think we need a few more tests and to handle a few more cases, but it looks good so far
@@ -430,7 +430,7 @@ fn coerced_from<'a>( | |||
{ | |||
Some(type_into.clone()) | |||
} | |||
|
|||
Dictionary(_, _) if matches!(type_from, Utf8) => Some(type_into.clone()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this currently says it is possible to coerce from Utf8 to any dictionary type (e.g. even Dictionary(Int64, Int32)
)
I think the dictionary_coercion
function does something similar here: https://github.com/apache/arrow-datafusion/blob/37b73751b19b82516443579c714b3b5986dac927/datafusion/expr/src/type_coercion/binary.rs#L635-L634
So maybe we need to verify we can coerce the value types, like this?
Dictionary(_, _) if matches!(type_from, Utf8) => Some(type_into.clone()), | |
Dictionary(_, value_type) if coerce_from(value_type, from_type) => Some(type_into.clone()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Lordworms -- this looks very nice to me 🙏
…pache#9958) * for debug finish remove print add space * fix clippy * finish * fix clippy
…pache#9958) * for debug finish remove print add space * fix clippy * finish * fix clippy
…9958) (#10104) * for debug finish remove print add space * fix clippy * finish * fix clippy Co-authored-by: Lordworms <[email protected]>
Which issue does this PR close?
Closes #9925
Rationale for this change
The signature of the coalesce function has changed to variadic_equal and we need to add a new rule to coercion [Dictionary, Utf8] to Dictionary
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?