[Variant]: Implement DataType::Dictionary support for cast_to_variant kernel#8173
Merged
alamb merged 2 commits intoapache:mainfrom Aug 20, 2025
Merged
[Variant]: Implement DataType::Dictionary support for cast_to_variant kernel#8173alamb merged 2 commits intoapache:mainfrom
DataType::Dictionary support for cast_to_variant kernel#8173alamb merged 2 commits intoapache:mainfrom
Conversation
Weijun-H
reviewed
Aug 20, 2025
Comment on lines
+1864
to
+1879
| fn test_cast_to_variant_dictionary_with_nulls() { | ||
| // Test dictionary with null values in the values array | ||
| let values = StringArray::from(vec![Some("a"), None, Some("c")]); | ||
| let keys = Int8Array::from(vec![Some(0), Some(1), Some(2), Some(0)]); | ||
| let dict_array = DictionaryArray::<Int8Type>::try_new(keys, Arc::new(values)).unwrap(); | ||
|
|
||
| run_test( | ||
| Arc::new(dict_array), | ||
| vec![ | ||
| Some(Variant::from("a")), | ||
| None, // key 1 points to null value | ||
| Some(Variant::from("c")), | ||
| Some(Variant::from("a")), | ||
| ], | ||
| ); | ||
| } |
Member
There was a problem hiding this comment.
It only contains the value. What about the key in the Dictionary?
Contributor
Author
There was a problem hiding this comment.
I may misunderstand the behavior. There's no corresponding datatype in Variant so what I did is to unfold the dictionary encoding and return the logic array it represent.
Do you mean we need to represent the same internal structure of the dictionary encoding in variant?
Member
There was a problem hiding this comment.
Thanks for the clarification — that makes sense to me @liamzwbao 👍
alamb
approved these changes
Aug 20, 2025
Contributor
There was a problem hiding this comment.
Thank you @liamzwbao and @Weijun-H -- this makes sense to me
@Weijun-H let me know if the answer to your question makes sense
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?
DataType::Dictionarysupport forcast_to_variantkernel #8062Rationale for this change
What changes are included in this PR?
Implement
DataType::Dictionaryincast_to_variantAre these changes tested?
Yes
Are there any user-facing changes?
New cast type supported