coercion vec[Dictionary, Utf8] to Dictionary for coalesce function#9958
Merged
alamb merged 4 commits intoapache:mainfrom Apr 5, 2024
Merged
coercion vec[Dictionary, Utf8] to Dictionary for coalesce function#9958alamb merged 4 commits intoapache:mainfrom
alamb merged 4 commits intoapache:mainfrom
Conversation
alamb
reviewed
Apr 5, 2024
Contributor
alamb
left a comment
There was a problem hiding this comment.
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
| Some(type_into.clone()) | ||
| } | ||
|
|
||
| Dictionary(_, _) if matches!(type_from, Utf8) => Some(type_into.clone()), |
Contributor
There was a problem hiding this comment.
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?
Suggested change
| Dictionary(_, _) if matches!(type_from, Utf8) => Some(type_into.clone()), | |
| Dictionary(_, value_type) if coerce_from(value_type, from_type) => Some(type_into.clone()), |
alamb
approved these changes
Apr 5, 2024
Contributor
alamb
left a comment
There was a problem hiding this comment.
Thank you @Lordworms -- this looks very nice to me 🙏
wiedld
pushed a commit
to influxdata/arrow-datafusion
that referenced
this pull request
Apr 10, 2024
…pache#9958) * for debug finish remove print add space * fix clippy * finish * fix clippy
alamb
pushed a commit
to alamb/datafusion
that referenced
this pull request
Apr 16, 2024
…pache#9958) * for debug finish remove print add space * fix clippy * finish * fix clippy
This was referenced Apr 22, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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?