[VARIANT] Add support for DataType::Struct for cast_to_variant#8090
[VARIANT] Add support for DataType::Struct for cast_to_variant#8090alamb merged 7 commits intoapache:mainfrom
Conversation
4f4abcb to
e44051f
Compare
alamb
left a comment
There was a problem hiding this comment.
Thanks @carpecodeum -- I think this implementation may have some non trivial performance issues, but we can also address that as a follow on PR
Just let me know how you want to proceed:
- Merge this PR and file a follow on ticket (my preference)
- Try and improve the performance in this PR
There was a problem hiding this comment.
I think as written this will cast the entire input array for each row, and then only read a single row each time, which will likely perform pretty poorly
One way to avoid this might be to slice the field array and only convert the slice (e.g.
let field_array = field_array.slice(i, 1);
let field_variant_array = cast_to_variant(field_array)?;
let field_variant = field_variant_array.value(0); // index zeroAnother way that might be even faster could be to recursively cast each field once at the start of the function in a pre-traversal order, and then traverse the input fields the same way (so you always had access to the current field as a variant)
Thank you for reviewing, I will make the changes here |
e44051f to
5a550da
Compare
b90bdc6 to
566ab3d
Compare
|
🚀 |
|
Thanks @carpecodeum |

Which issue does this PR close?
DataType::Structsupport forcast_to_variantkernel #8061Rationale for this change
Add support for DataType::Struct for cast_to_variant
What changes are included in this PR?
Adds support for casting and adds tests as well
Are there any user-facing changes?
yes casting to variant is a user facing issue
Props to @mprammer!!