You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/07/30 11:50:58 UTC

[GitHub] [arrow-rs] alamb commented on a diff in pull request #2235: Update `IntervalMonthDayNanoType::make_value()` to conform to specifications

alamb commented on code in PR #2235:
URL: https://github.com/apache/arrow-rs/pull/2235#discussion_r933796001


##########
arrow/src/datatypes/types.rs:
##########
@@ -232,6 +232,16 @@ impl IntervalDayTimeType {
         days: i32,
         millis: i32,
     ) -> <IntervalDayTimeType as ArrowPrimitiveType>::Native {
+        /*

Review Comment:
   ❤️ 



##########
arrow/src/datatypes/types.rs:
##########
@@ -278,9 +299,9 @@ impl IntervalMonthDayNanoType {
     pub fn to_parts(
         i: <IntervalMonthDayNanoType as ArrowPrimitiveType>::Native,
     ) -> (i32, i32, i64) {
-        let nanos = (i >> 64) as i64;
-        let days = (i >> 32) as i32;
-        let months = i as i32;
+        let months = (i >> 96) as i32;
+        let days = (i >> 64) as i32;
+        let nanos = i as i64;

Review Comment:
   Re-reading this now with your great pictures, I was wondering if we had to mask off the remaining bits in the other fields -- otherwise the days will also include the months 
   
   However, after some thought, I think the truncation done via `as i32` and `as i64` should be good enough
   
   



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org