aihuaxu commented on code in PR #13195:
URL: https://github.com/apache/iceberg/pull/13195#discussion_r2136929215


##########
api/src/main/java/org/apache/iceberg/expressions/VariantExpressionUtil.java:
##########
@@ -40,29 +38,32 @@ class VariantExpressionUtil {
           .put(Types.DateType.get(), PhysicalType.DATE)
           .put(Types.TimestampType.withoutZone(), PhysicalType.TIMESTAMPNTZ)
           .put(Types.TimestampType.withZone(), PhysicalType.TIMESTAMPTZ)
+          .put(Types.TimestampNanoType.withoutZone(), 
PhysicalType.TIMESTAMPNTZ_NANOS)
+          .put(Types.TimestampNanoType.withZone(), 
PhysicalType.TIMESTAMPTZ_NANOS)
+          .put(Types.TimeType.get(), PhysicalType.TIME)
+          .put(Types.UUIDType.get(), PhysicalType.UUID)
           .put(Types.StringType.get(), PhysicalType.STRING)
           .put(Types.BinaryType.get(), PhysicalType.BINARY)
           .put(Types.UnknownType.get(), PhysicalType.NULL)
           .build();
 
   private VariantExpressionUtil() {}
 
-  @SuppressWarnings("unchecked")
+  // Todo: Fix cyclomatic complexity checkstyle error using appropriate 
casting functions

Review Comment:
   Can you revert those unrelated change, and also the following removing the 
empty lines?



##########
core/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluatorWithExtract.java:
##########
@@ -683,4 +784,1649 @@ public void testIntegerNotIn() {
         .as("Should read: id above upper bound (85 > 79, 86 > 79)")
         .isTrue();
   }
+
+  @Test
+  public void testTimestampLt() {
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MIN_VALUE_MINUS_10)))
+        .as("Should not read: timestamp range below lower bound (20 > 30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(extract("variant", "$.event_timestamp_long", "long"), 
TS_MIN_VALUE)))
+        .as("Should read: one possible timestamp")

Review Comment:
   ```suggestion
           .as("Should not read: timestamp range below lower bound (30 is not < 
30)"")
   ```



##########
core/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluatorWithExtract.java:
##########
@@ -683,4 +784,1649 @@ public void testIntegerNotIn() {
         .as("Should read: id above upper bound (85 > 79, 86 > 79)")
         .isTrue();
   }
+
+  @Test
+  public void testTimestampLt() {
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MIN_VALUE_MINUS_10)))
+        .as("Should not read: timestamp range below lower bound (20 > 30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(extract("variant", "$.event_timestamp_long", "long"), 
TS_MIN_VALUE)))
+        .as("Should read: one possible timestamp")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(extract("variant", "$.event_timestamp_long", "long"), 
TS_MAX_VALUE)))
+        .as("Should read: may possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE_MINUS_10.toString())))
+        .as("Should not read: timestamp range below lower bound (20 > 30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should read: one possible timestamp")

Review Comment:
   I think you need to update those lines which are incorrect. E.g., here you 
are trying to say "Should not read: ...".



##########
core/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluatorWithExtract.java:
##########
@@ -683,4 +784,1649 @@ public void testIntegerNotIn() {
         .as("Should read: id above upper bound (85 > 79, 86 > 79)")
         .isTrue();
   }
+
+  @Test
+  public void testTimestampLt() {
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MIN_VALUE_MINUS_10)))
+        .as("Should not read: timestamp range below lower bound (20 > 30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(extract("variant", "$.event_timestamp_long", "long"), 
TS_MIN_VALUE)))
+        .as("Should read: one possible timestamp")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(extract("variant", "$.event_timestamp_long", "long"), 
TS_MAX_VALUE)))
+        .as("Should read: may possible timestamp")

Review Comment:
   ```suggestion
           .as("Should read: many possible timestamps")
   ```



##########
core/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluatorWithExtract.java:
##########
@@ -683,4 +784,1649 @@ public void testIntegerNotIn() {
         .as("Should read: id above upper bound (85 > 79, 86 > 79)")
         .isTrue();
   }
+
+  @Test
+  public void testTimestampLt() {
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MIN_VALUE_MINUS_10)))
+        .as("Should not read: timestamp range below lower bound (20 > 30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(extract("variant", "$.event_timestamp_long", "long"), 
TS_MIN_VALUE)))
+        .as("Should read: one possible timestamp")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(extract("variant", "$.event_timestamp_long", "long"), 
TS_MAX_VALUE)))
+        .as("Should read: may possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE_MINUS_10.toString())))

Review Comment:
   These tests are testing timestamp in long against the string? Does it 
compare in string or long?



##########
core/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluatorWithExtract.java:
##########
@@ -683,4 +784,1649 @@ public void testIntegerNotIn() {
         .as("Should read: id above upper bound (85 > 79, 86 > 79)")
         .isTrue();
   }
+
+  @Test
+  public void testTimestampLt() {
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MIN_VALUE_MINUS_10)))
+        .as("Should not read: timestamp range below lower bound (20 > 30)")

Review Comment:
   ```suggestion
           .as("Should not read: timestamp range below lower bound (20 < 30)")
   ```



##########
core/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluatorWithExtract.java:
##########
@@ -683,4 +784,1649 @@ public void testIntegerNotIn() {
         .as("Should read: id above upper bound (85 > 79, 86 > 79)")
         .isTrue();
   }
+
+  @Test
+  public void testTimestampLt() {
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MIN_VALUE_MINUS_10)))
+        .as("Should not read: timestamp range below lower bound (20 > 30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(extract("variant", "$.event_timestamp_long", "long"), 
TS_MIN_VALUE)))
+        .as("Should read: one possible timestamp")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(extract("variant", "$.event_timestamp_long", "long"), 
TS_MAX_VALUE)))
+        .as("Should read: may possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE_MINUS_10.toString())))
+        .as("Should not read: timestamp range below lower bound (20 > 30)")

Review Comment:
   ```suggestion
           .as("Should not read: timestamp range below lower bound (20 < 30)")
   ```



-- 
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-unsubscr...@iceberg.apache.org

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


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

Reply via email to