You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "fallintoplace (via GitHub)" <gi...@apache.org> on 2026/07/25 15:38:22 UTC

[PR] fix(transform): floor pre-epoch nanosecond bucket values [iceberg-rust]

fallintoplace opened a new pull request, #2891:
URL: https://github.com/apache/iceberg-rust/pull/2891

   ## Summary
   
   - use Euclidean division when converting nanosecond time and timestamp values to microseconds for bucket hashing
   - keep pre-epoch nanosecond timestamps aligned with equivalent microsecond values and the Java implementation
   - cover both literal transforms and Arrow array transforms
   
   ## Testing
   
   - cargo test -p iceberg --lib
   - cargo clippy -p iceberg --lib -- -D warnings


-- 
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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(transform): floor nanosecond timestamps before bucket hashing [iceberg-rust]

Posted by "xanderbailey (via GitHub)" <gi...@apache.org>.
xanderbailey commented on code in PR #2891:
URL: https://github.com/apache/iceberg-rust/pull/2891#discussion_r3654874052


##########
crates/iceberg/src/transform/bucket.rs:
##########
@@ -146,6 +148,11 @@ impl Bucket {
     fn bucket_bytes(&self, v: &[u8]) -> i32 {
         self.bucket_n(Self::hash_bytes(v))
     }
+
+    #[inline]
+    fn nanos_to_micros(v: i64) -> i64 {

Review Comment:
   Confirmed that this matches Java https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/util/DateTimeUtil.java#L104 and 
   
   https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/transforms/Bucket.java#L245



##########
crates/iceberg/src/transform/bucket.rs:
##########
@@ -999,4 +1006,43 @@ mod test {
 
         assert_eq!(micro_result.value(0), nano_result.value(0));
     }
+
+    #[test]
+    fn test_nanos_to_micros_uses_floor_division() {
+        assert_eq!(Bucket::nanos_to_micros(1_001), 1);
+        assert_eq!(Bucket::nanos_to_micros(1_000), 1);
+        assert_eq!(Bucket::nanos_to_micros(-1_000), -1);

Review Comment:
   Maybe worth a sanity check for 0, i64::Min and i64::Max



-- 
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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(transform): floor nanosecond timestamps before bucket hashing [iceberg-rust]

Posted by "CTTY (via GitHub)" <gi...@apache.org>.
CTTY merged PR #2891:
URL: https://github.com/apache/iceberg-rust/pull/2891


-- 
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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(transform): floor nanosecond timestamps before bucket hashing [iceberg-rust]

Posted by "xanderbailey (via GitHub)" <gi...@apache.org>.
xanderbailey commented on PR #2891:
URL: https://github.com/apache/iceberg-rust/pull/2891#issuecomment-5308438120

   I think this one is ready for a review @CTTY , I think it's a pretty safe change 


-- 
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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org