[Variant]: Implement DataType::Interval support for cast_to_variant kernel#8125
Conversation
Signed-off-by: codephage2020 <tingwangyan2020@163.com>
Signed-off-by: codephage2020 <tingwangyan2020@163.com>
3e4a677 to
7cc9eb7
Compare
| let mut bytes = Vec::with_capacity(8); | ||
| bytes.extend_from_slice(&days_bytes); | ||
| bytes.extend_from_slice(&millis_bytes); | ||
| bytes |
There was a problem hiding this comment.
I think if you made this Variant::Binary(bytes) you could then use the existing run_test function rather than adding run_binary_interval_test
| Some(i32::MIN), | ||
| ])), | ||
| vec![ | ||
| Some(Variant::Int32(0)), |
There was a problem hiding this comment.
I double checked that there doesn't seem to be a interval / duration type in Variant: https://github.com/apache/parquet-format/blob/master/VariantEncoding.md#encoding-types
Converting to Int32 / VariantBinary is about the best we can do for now. However, it might be misleading
Another behavior might be to throw a "InvalidArgument" Error and make it clear that casting from Intervals to Variant is not well defined / supported.
What do you think?
There was a problem hiding this comment.
You're right. I think throwing an InvalidArgument error is the better choice.
It's more honest and prevents silent data corruption or misinterpretation.
Let's modify it.
…dephage2020/arrow-rs into feat/cast-to-variant-interval
Signed-off-by: codephage2020 <tingwangyan2020@163.com>
Signed-off-by: codephage2020 <tingwangyan2020@163.com>
Which issue does this PR close?
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax.
DataType::Intervalsupport forcast_to_variantkernel #8056 .What changes are included in this PR?
Added Interval Support:
Are these changes tested?
Yes.
Are there any user-facing changes?
No.