raminqaf commented on code in PR #30051:
URL: https://github.com/apache/flink/pull/30051#discussion_r4644493229
##########
flink-core/src/test/java/org/apache/flink/types/variant/BinaryVariantTest.java:
##########
@@ -221,6 +221,36 @@ void testNanosecondTimestampPrecisionRange() {
.hasMessageContaining("nanosecond precision");
}
+ @Test
+ void testNanosecondTimestampPrecisionBounds() {
+ // The first and the last value of the range, including the first
second of the range, where
+ // the epoch second times 10^9 overflows although the total fits into
a long.
+
assertThat(BinaryVariantUtil.nanosSinceEpoch(Instant.EPOCH.plusNanos(Long.MIN_VALUE)))
+ .isEqualTo(Long.MIN_VALUE);
+
assertThat(BinaryVariantUtil.nanosSinceEpoch(Instant.EPOCH.plusNanos(Long.MAX_VALUE)))
+ .isEqualTo(Long.MAX_VALUE);
+
+ for (LocalDateTime dateTime :
+ List.of(
+ LocalDateTime.of(1677, 9, 21, 0, 12, 43, 145_224_192),
+ LocalDateTime.of(1677, 9, 21, 0, 12, 43, 999_999_999),
+ LocalDateTime.of(2262, 4, 11, 23, 47, 16,
854_775_807))) {
+ assertThat(builder.of(dateTime).getDateTime()).isEqualTo(dateTime);
Review Comment:
Should we rename builder to a more specific name? Like variantBuilder?
--
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]