This is an automated email from the ASF dual-hosted git repository.

ahmedabu98 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 09af958190b Fix BeamRowWrapperTest microsecond precision flake (#39287)
09af958190b is described below

commit 09af958190ba26fc344204a1efc9ffe528bf62cd
Author: Bruno Volpato <[email protected]>
AuthorDate: Mon Jul 13 07:33:27 2026 -0400

    Fix BeamRowWrapperTest microsecond precision flake (#39287)
    
    Use a deterministic microsecond-aligned Instant and assert the exact 
conversion so Java 21 clock precision cannot break test class initialization.
---
 .../java/org/apache/beam/sdk/io/iceberg/BeamRowWrapperTest.java  | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git 
a/sdks/java/io/iceberg/src/test/java/org/apache/beam/sdk/io/iceberg/BeamRowWrapperTest.java
 
b/sdks/java/io/iceberg/src/test/java/org/apache/beam/sdk/io/iceberg/BeamRowWrapperTest.java
index bd8cead7298..f361bc94c15 100644
--- 
a/sdks/java/io/iceberg/src/test/java/org/apache/beam/sdk/io/iceberg/BeamRowWrapperTest.java
+++ 
b/sdks/java/io/iceberg/src/test/java/org/apache/beam/sdk/io/iceberg/BeamRowWrapperTest.java
@@ -85,6 +85,8 @@ public class BeamRowWrapperTest {
                   Types.NestedField.required(1, "nested_int", 
Types.IntegerType.get()))),
           Types.NestedField.required(14, "pass_through_field", 
Types.IntegerType.get()));
   private static final UUID TEST_UUID = UUID.randomUUID();
+  private static final Instant TEST_MICROS_INSTANT =
+      Instant.ofEpochSecond(1_609_459_200L, 123_456_000);
   private static final Row NESTED_ROW = 
Row.withSchema(NESTED_BEAM_SCHEMA).addValue(999).build();
   private static final Row ROW =
       Row.withSchema(BEAM_SCHEMA)
@@ -99,7 +101,7 @@ public class BeamRowWrapperTest {
                   .array(),
               new BigDecimal("123.45"),
               org.joda.time.Instant.now(),
-              Instant.now(),
+              TEST_MICROS_INSTANT,
               LocalDateTime.now(ZoneId.systemDefault()),
               LocalDate.now(ZoneId.systemDefault()),
               LocalTime.now(ZoneId.systemDefault()),
@@ -180,10 +182,7 @@ public class BeamRowWrapperTest {
 
   @Test
   public void testMicrosInstantLogicalTypeConversion() {
-    Instant javaInstant = ROW.getLogicalTypeValue(7, Instant.class);
-    long expectedMicrosInstant =
-        TimeUnit.SECONDS.toMicros(javaInstant.getEpochSecond()) + 
javaInstant.getNano() / 1000;
-    assertEquals(expectedMicrosInstant, (long) WRAPPER.get(7, Long.class));
+    assertEquals(1_609_459_200_123_456L, (long) WRAPPER.get(7, Long.class));
   }
 
   @Test

Reply via email to