pvary commented on code in PR #14245:
URL: https://github.com/apache/iceberg/pull/14245#discussion_r2414568067


##########
flink/v2.1/flink/src/test/java/org/apache/iceberg/flink/source/reader/TestColumnStatsWatermarkExtractorNanosecond.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.flink.source.reader;
+
+import static org.apache.iceberg.types.Types.NestedField.required;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.concurrent.TimeUnit;
+import org.apache.iceberg.Schema;
+import org.apache.iceberg.types.Types;
+import org.junit.jupiter.api.Test;
+
+/** Test that ColumnStatsWatermarkExtractor properly handles nanosecond 
precision timestamps. */
+public class TestColumnStatsWatermarkExtractorNanosecond {
+
+  @Test
+  public void testNanosecondTimestampTypeDetection() {
+    // Create a schema with nanosecond precision timestamp
+    Schema schema =
+        new Schema(
+            required(1, "id", Types.LongType.get()),
+            required(2, "timestamp_ns", Types.TimestampNanoType.withoutZone()),
+            required(3, "timestamp_ns_tz", Types.TimestampNanoType.withZone()),
+            required(4, "timestamp_us", Types.TimestampType.withoutZone()));
+
+    // Test nanosecond timestamp without timezone
+    ColumnStatsWatermarkExtractor extractorNs =
+        new ColumnStatsWatermarkExtractor(schema, "timestamp_ns", 
TimeUnit.MICROSECONDS);
+
+    // Test nanosecond timestamp with timezone
+    ColumnStatsWatermarkExtractor extractorNsTz =
+        new ColumnStatsWatermarkExtractor(schema, "timestamp_ns_tz", 
TimeUnit.MICROSECONDS);
+
+    // Test microsecond timestamp
+    ColumnStatsWatermarkExtractor extractorUs =
+        new ColumnStatsWatermarkExtractor(schema, "timestamp_us", 
TimeUnit.MICROSECONDS);
+
+    // Verify that the extractors are created successfully
+    // The actual time unit detection is tested through the constructor logic
+    assertThat(extractorNs).isNotNull();
+    assertThat(extractorNsTz).isNotNull();
+    assertThat(extractorUs).isNotNull();
+  }
+
+  @Test
+  public void testLongColumnWithNanosecondTimeUnit() {
+    // Create a schema with a Long column
+    Schema schema =
+        new Schema(
+            required(1, "id", Types.LongType.get()),
+            required(2, "timestamp_long", Types.LongType.get()));
+
+    // Test Long column with nanosecond time unit
+    ColumnStatsWatermarkExtractor extractor =
+        new ColumnStatsWatermarkExtractor(schema, "timestamp_long", 
TimeUnit.NANOSECONDS);
+
+    // Verify that the extractor is created successfully
+    assertThat(extractor).isNotNull();
+  }
+
+  @Test
+  public void testTimestampTypeDetection() {

Review Comment:
   What does this test?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to