Skip to content

Commit 13bce28

Browse files
committed
fix: add a timestamp before UNIX epoch
1 parent c0d2517 commit 13bce28

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/iceberg/test/literal_test.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,26 @@ INSTANTIATE_TEST_SUITE_P(
715715
.target_type = date(),
716716
.expected_literal = Literal::Date(
717717
TemporalTestHelper::CreateDate({.year = 2020, .month = 12, .day = 31}))},
718+
CastLiteralTestParam{.test_name = "EpochToDate",
719+
.source_literal = Literal::Timestamp(
720+
TemporalTestHelper::CreateTimestamp({.year = 1970,
721+
.month = 1,
722+
.day = 1,
723+
.hour = 0,
724+
.minute = 0,
725+
.second = 0})),
726+
.target_type = date(),
727+
.expected_literal = Literal::Date(0)},
728+
CastLiteralTestParam{.test_name = "TimestampBeforeEpochToDate",
729+
.source_literal = Literal::Timestamp(
730+
TemporalTestHelper::CreateTimestamp({.year = 1969,
731+
.month = 12,
732+
.day = 31,
733+
.hour = 23,
734+
.minute = 59,
735+
.second = 59})),
736+
.target_type = date(),
737+
.expected_literal = Literal::Date(-1)},
718738
// Float cast tests
719739
CastLiteralTestParam{.test_name = "FloatToDouble",
720740
.source_literal = Literal::Float(2.0f),

0 commit comments

Comments
 (0)