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


##########
core/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluatorWithExtract.java:
##########
@@ -683,4 +784,1638 @@ 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 not read: timestamp range below lower bound (30 is not < 
30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(extract("variant", "$.event_timestamp_long", "long"), 
TS_MAX_VALUE)))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should not read: timestamp range below lower bound (30 is not < 
30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: many possible timestamp")

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



##########
core/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluatorWithExtract.java:
##########
@@ -683,4 +784,1638 @@ 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 not read: timestamp range below lower bound (30 is not < 
30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(extract("variant", "$.event_timestamp_long", "long"), 
TS_MAX_VALUE)))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should not read: timestamp range below lower bound (30 is not < 
30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+
+    // Timestamp as timestamp datatype
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        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_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should not read: timestamp range below lower bound (30 is not < 
30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+  }
+
+  @Test
+  public void testTimestampLtEq() {
+    assertThat(
+            shouldRead(
+                lessThanOrEqual(
+                    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(
+                lessThanOrEqual(
+                    extract("variant", "$.event_timestamp_long", "long"), 
TS_MIN_VALUE)))
+        .as("Should read: one possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThanOrEqual(
+                    extract("variant", "$.event_timestamp_long", "long"), 
TS_MAX_VALUE)))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThanOrEqual(
+                    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(
+                lessThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should read: one possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+
+    // Timestamp as timestamp datatype
+    assertThat(
+            shouldRead(
+                lessThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        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(
+                lessThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should read: one possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+  }
+
+  @Test
+  public void testTimestampGt() {
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MAX_VALUE_PLUS_10)))
+        .as("Should not read: timestamp range above upper bound (89 > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThan(extract("variant", "$.event_timestamp_long", 
"long"), TS_MAX_VALUE)))
+        .as("Should not read: id range above upper bound (79 is not > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MAX_VALUE_MINUS_10)))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_PLUS_10.toString())))
+        .as("Should not read: timestamp range above upper bound (89 > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should not read: id range above upper bound (79 is not > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_MINUS_10.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+
+    // Timestamp as timestamp data type
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_PLUS_10.toString())))
+        .as("Should not read: timestamp range above upper bound (89 > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should not read: timestamp range equal to upper bound (79 is not 
> 79")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_MINUS_10.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+  }
+
+  @Test
+  public void testTimestampGtEq() {
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MAX_VALUE_PLUS_10)))
+        .as("Should not read: timestamp range above upper bound (89 > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract("variant", "$.event_timestamp_long", "long"), 
TS_MAX_VALUE)))
+        .as("Should read: one possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MAX_VALUE_MINUS_10)))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_PLUS_10.toString())))
+        .as("Should not read: timestamp range above upper bound (89 > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: one possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_MINUS_10.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+
+    // Timestamp as timestamp data type
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_PLUS_10.toString())))
+        .as("Should not read: timestamp range above upper bound (89 > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: one possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_MINUS_10.toString())))
+        .as("Should read: many possible timestamp")

Review Comment:
   nit: can you correct the rest => "Should read: many possible timestamps"?



##########
core/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluatorWithExtract.java:
##########
@@ -683,4 +784,1638 @@ 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 not read: timestamp range below lower bound (30 is not < 
30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(extract("variant", "$.event_timestamp_long", "long"), 
TS_MAX_VALUE)))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should not read: timestamp range below lower bound (30 is not < 
30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: many possible timestamp")

Review Comment:
   nit



##########
core/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluatorWithExtract.java:
##########
@@ -683,4 +784,1638 @@ 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 not read: timestamp range below lower bound (30 is not < 
30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(extract("variant", "$.event_timestamp_long", "long"), 
TS_MAX_VALUE)))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should not read: timestamp range below lower bound (30 is not < 
30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+
+    // Timestamp as timestamp datatype
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        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_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should not read: timestamp range below lower bound (30 is not < 
30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+  }
+
+  @Test
+  public void testTimestampLtEq() {
+    assertThat(
+            shouldRead(
+                lessThanOrEqual(
+                    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(
+                lessThanOrEqual(
+                    extract("variant", "$.event_timestamp_long", "long"), 
TS_MIN_VALUE)))
+        .as("Should read: one possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThanOrEqual(
+                    extract("variant", "$.event_timestamp_long", "long"), 
TS_MAX_VALUE)))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThanOrEqual(
+                    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(
+                lessThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should read: one possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+
+    // Timestamp as timestamp datatype
+    assertThat(
+            shouldRead(
+                lessThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        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(
+                lessThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should read: one possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+  }
+
+  @Test
+  public void testTimestampGt() {
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MAX_VALUE_PLUS_10)))
+        .as("Should not read: timestamp range above upper bound (89 > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThan(extract("variant", "$.event_timestamp_long", 
"long"), TS_MAX_VALUE)))
+        .as("Should not read: id range above upper bound (79 is not > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MAX_VALUE_MINUS_10)))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_PLUS_10.toString())))
+        .as("Should not read: timestamp range above upper bound (89 > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should not read: id range above upper bound (79 is not > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_MINUS_10.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+
+    // Timestamp as timestamp data type
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_PLUS_10.toString())))
+        .as("Should not read: timestamp range above upper bound (89 > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should not read: timestamp range equal to upper bound (79 is not 
> 79")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_MINUS_10.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+  }
+
+  @Test
+  public void testTimestampGtEq() {
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MAX_VALUE_PLUS_10)))
+        .as("Should not read: timestamp range above upper bound (89 > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract("variant", "$.event_timestamp_long", "long"), 
TS_MAX_VALUE)))
+        .as("Should read: one possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MAX_VALUE_MINUS_10)))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_PLUS_10.toString())))
+        .as("Should not read: timestamp range above upper bound (89 > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: one possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_MINUS_10.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+
+    // Timestamp as timestamp data type
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_PLUS_10.toString())))
+        .as("Should not read: timestamp range above upper bound (89 > 79)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: one possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                greaterThanOrEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_MINUS_10.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+  }
+
+  @Test
+  public void testTimestampEq() {
+    assertThat(
+            shouldRead(
+                equal(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MIN_VALUE_MINUS_10)))
+        .as("Should not read: timestamp below lower bound")
+        .isFalse();
+    assertThat(
+            shouldRead(equal(extract("variant", "$.event_timestamp_long", 
"long"), TS_MIN_VALUE)))
+        .as("Should read: timestamp equal to lower bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                equal(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MAX_VALUE_PLUS_10)))
+        .as("Should not read: timestamp above upper bound")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                equal(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MAX_VALUE_MINUS_10)))
+        .as("Should read: timestamp between lower and upper bounds")
+        .isTrue();
+    assertThat(
+            shouldRead(equal(extract("variant", "$.event_timestamp_long", 
"long"), TS_MAX_VALUE)))
+        .as("Should read: timestamp equal to lower bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                equal(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE_MINUS_10.toString())))
+        .as("Should not read: timestamp below lower bound")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                equal(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should read: timestamp equal to lower bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                equal(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_PLUS_10.toString())))
+        .as("Should not read: timestamp above upper bound")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                equal(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_MINUS_10.toString())))
+        .as("Should read: timestamp between lower and upper bounds")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                equal(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: timestamp equal to upper bound")
+        .isTrue();
+
+    // Timestamp as timestamp data type
+    assertThat(
+            shouldRead(
+                equal(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE_MINUS_10.toString())))
+        .as("Should not read: timestamp below lower bound")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                equal(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should read: timestamp equal to lower bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                equal(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_MINUS_10.toString())))
+        .as("Should read: timestamp between lower and upper bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                equal(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_PLUS_10.toString())))
+        .as("Should not read: timestamp above upper bound")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                equal(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: timestamp equal to upper bound")
+        .isTrue();
+  }
+
+  @Test
+  public void testTimestampNotEq() {
+    assertThat(
+            shouldRead(
+                notEqual(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MIN_VALUE_MINUS_10)))
+        .as("Should read: timestamp below lower bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                notEqual(extract("variant", "$.event_timestamp_long", "long"), 
TS_MIN_VALUE)))
+        .as("Should read: timestamp equal to lower bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                notEqual(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MAX_VALUE_PLUS_10)))
+        .as("Should read: timestamp above upper bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                notEqual(
+                    extract("variant", "$.event_timestamp_long", "long"), 
L_TS_MAX_VALUE_MINUS_10)))
+        .as("Should read: timestamp between lower and upper bounds")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                notEqual(extract("variant", "$.event_timestamp_long", "long"), 
TS_MAX_VALUE)))
+        .as("Should read: timestamp equal to upper bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                notEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE_MINUS_10.toString())))
+        .as("Should read: timestamp below lower bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                notEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should read: timestamp equal to lower bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                notEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_PLUS_10.toString())))
+        .as("Should read: timestamp above upper bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                notEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_MINUS_10.toString())))
+        .as("Should read: timestamp between lower and  upper bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                notEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: timestamp equal to upper bound")
+        .isTrue();
+
+    // Timestamp as timestamp data type
+    assertThat(
+            shouldRead(
+                notEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE_MINUS_10.toString())))
+        .as("Should read: timestamp below lower bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                notEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should read: timestamp equal to lower bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                notEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_MINUS_10.toString())))
+        .as("Should read: timestamp between lower and upper bounds")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                notEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE_PLUS_10.toString())))
+        .as("Should read: timestamp above upper bound")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                notEqual(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: timestamp equal to upper bound")
+        .isTrue();
+  }
+
+  @Test
+  public void testTimestampNanoLt() {
+    assertThat(
+            shouldRead(

Review Comment:
   Instead of duplicate the same tests, can you take a look if we can use 
parameterized tests with 
   
   "$.event_timestamp_nano_long", TS_NANO_MIN_VALUE, 
L_TS_NANO_MIN_VALUE_MINUS_10, etc as the inputs? 
   
   Otherwise, they are the same as micro_timestamp, right?



##########
core/src/test/java/org/apache/iceberg/expressions/TestInclusiveMetricsEvaluatorWithExtract.java:
##########
@@ -683,4 +784,1638 @@ 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 not read: timestamp range below lower bound (30 is not < 
30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(extract("variant", "$.event_timestamp_long", "long"), 
TS_MAX_VALUE)))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should not read: timestamp range below lower bound (30 is not < 
30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_long",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: many possible timestamp")
+        .isTrue();
+
+    // Timestamp as timestamp datatype
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        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_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MIN_VALUE.toString())))
+        .as("Should not read: timestamp range below lower bound (30 is not < 
30)")
+        .isFalse();
+    assertThat(
+            shouldRead(
+                lessThan(
+                    extract(
+                        "variant",
+                        "$.event_timestamp_ts_type",
+                        Types.TimestampType.withZone().toString()),
+                    TS_COMMON_MAX_VALUE.toString())))
+        .as("Should read: many possible timestamp")

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



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