-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(substrait): add time literal support #17655
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
Conversation
Adds support for `ScalarValue::Time64Microsecond` and `ScalarValue::Time64Nanosecond` to be converted to and from Substrait literals. This includes the `PrecisionTime` literal type and specific `TIME_64_TYPE_VARIATION_REF` for 6-digit (microseconds) and 9-digit (nanoseconds) precision.
@LiaCastaneda and @gabotechs can one of you help review this PR? |
Sure! giving it a look shortly |
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.
👍 nice!
}, | ||
Some(LiteralType::Date(d)) => ScalarValue::Date32(Some(*d)), | ||
Some(LiteralType::PrecisionTime(pt)) => match pt.precision { | ||
6 => match lit.type_variation_reference { |
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.
Nice, I imagine if we wanted to support the rest of the type variations it would look something like:
0 => match lit.type_variation_reference {
TIME_32_TYPE_VARIATION_REF => {
ScalarValue::Time32Second(Some(pt.value as i32))
}
others => {
return substrait_err!("Unknown type variation reference {others}");
}
},
3 => match lit.type_variation_reference {
TIME_32_TYPE_VARIATION_REF => {
ScalarValue::Time32Millisecond(Some(pt.value as i32))
}
others => {
return substrait_err!("Unknown type variation reference {others}");
}
},
If you are up for the ride I think we could also add them, otherwise I think it's fine as is
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.
Thanks @gabotechs -- I filed a ticket to track this:
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.
awesome
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.
And @petern48 delivers a PR:
Which issue does this PR close?
Rationale for this change
Making sure that we can have proper mapping between Substrait and Arrow types.
What changes are included in this PR?
Adds support for
ScalarValue::Time64Microsecond
andScalarValue::Time64Nanosecond
to be converted to and from Substrait literals.This includes the
PrecisionTime
literal type and specificTIME_64_TYPE_VARIATION_REF
for 6-digit (microseconds) and 9-digit (nanoseconds) precision.Are these changes tested?
Added unit tests
Are there any user-facing changes?
n/a