avantgardnerio commented on code in PR #2031:
URL: https://github.com/apache/arrow-rs/pull/2031#discussion_r917156004
##########
arrow/src/datatypes/types.rs:
##########
@@ -191,3 +194,166 @@ impl ArrowTimestampType for TimestampNanosecondType {
TimeUnit::Nanosecond
}
}
+
+impl IntervalYearMonthType {
+ /// Creates a IntervalYearMonthType
+ ///
+ /// # Arguments
+ ///
+ /// * `years` - The number of years (+/-) represented in this interval
+ /// * `months` - The number of months (+/-) represented in this interval
+ pub fn new(
+ years: i32,
+ months: i32,
+ ) -> <IntervalYearMonthType as ArrowPrimitiveType>::Native {
+ years * 12 + months
+ }
+
+ pub fn to_months(i: <IntervalYearMonthType as ArrowPrimitiveType>::Native)
-> i32 {
+ i
+ }
+}
+
+impl IntervalDayTimeType {
+ /// Creates a IntervalDayTimeType
+ ///
+ /// # Arguments
+ ///
+ /// * `days` - The number of days (+/-) represented in this interval
+ /// * `millis` - The number of milliseconds (+/-) represented in this
interval
+ pub fn new(
+ days: i32,
+ millis: i32,
+ ) -> <IntervalDayTimeType as ArrowPrimitiveType>::Native {
+ let m = millis as u64 & u32::MAX as u64;
+ let d = (days as u64 & u32::MAX as u64) << 32;
+ (m | d) as <IntervalDayTimeType as ArrowPrimitiveType>::Native
+ }
+
+ pub fn to_parts(
Review Comment:
If there's a `pub` keyword, doc it - got it. Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]