diff --git a/velox/functions/sparksql/tests/DateTimeFunctionsTest.cpp b/velox/functions/sparksql/tests/DateTimeFunctionsTest.cpp index ab68988bbbd57..b29e20ee09407 100644 --- a/velox/functions/sparksql/tests/DateTimeFunctionsTest.cpp +++ b/velox/functions/sparksql/tests/DateTimeFunctionsTest.cpp @@ -887,6 +887,15 @@ TEST_F(DateTimeFunctionsTest, fromUnixtime) { fromUnixTime(getUnixTime("2020-06-30 23:59:59"), "yyyy-MM-dd HH:mm:ss"), "2020-06-30 23:59:59"); +// In debug mode, Timestamp constructor will throw exception if range check +// fails. +#ifdef NDEBUG + // Integer overflow in the internal conversion from seconds to milliseconds. + EXPECT_EQ( + fromUnixTime(std::numeric_limits::max(), "yyyy-MM-dd HH:mm:ss"), + "1969-12-31 23:59:59"); +#endif + // 8 hours ahead UTC. setQueryTimeZone("Asia/Shanghai"); // In debug mode, Timestamp constructor will throw exception if range check