diff --git a/be/test/vec/core/block_test.cpp b/be/test/vec/core/block_test.cpp index 134264f3e80364..7c876b00aa4952 100644 --- a/be/test/vec/core/block_test.cpp +++ b/be/test/vec/core/block_test.cpp @@ -771,7 +771,7 @@ TEST(BlockTest, dump_data) { auto& date_v2_data = column_vector_date_v2->get_data(); for (int i = 0; i < 1024; ++i) { DateV2Value value; - value.from_date((uint32_t)((2022 << 9) | (6 << 5) | 6)); + value.unchecked_set_time(2022, 6, 6, 0, 0, 0, 0); date_v2_data.push_back(*reinterpret_cast(&value)); } vectorized::DataTypePtr date_v2_type(std::make_shared()); diff --git a/be/test/vec/data_types/serde/data_type_serde_mysql_test.cpp b/be/test/vec/data_types/serde/data_type_serde_mysql_test.cpp index f05919e4a8f477..3f37bf93c52909 100644 --- a/be/test/vec/data_types/serde/data_type_serde_mysql_test.cpp +++ b/be/test/vec/data_types/serde/data_type_serde_mysql_test.cpp @@ -204,7 +204,7 @@ void serialize_and_deserialize_mysql_test() { auto& date_v2_data = column_vector_date_v2->get_data(); for (int i = 0; i < row_num; ++i) { DateV2Value value; - value.from_date((uint32_t)((2022 << 9) | (6 << 5) | 6)); + value.unchecked_set_time(2022, 6, 6, 0, 0, 0, 0); date_v2_data.push_back(*reinterpret_cast(&value)); } vectorized::DataTypePtr date_v2_type( diff --git a/be/test/vec/data_types/serde/data_type_serde_pb_test.cpp b/be/test/vec/data_types/serde/data_type_serde_pb_test.cpp index bf6ead9b21bd28..1414d6c78dc443 100644 --- a/be/test/vec/data_types/serde/data_type_serde_pb_test.cpp +++ b/be/test/vec/data_types/serde/data_type_serde_pb_test.cpp @@ -668,12 +668,9 @@ TEST(DataTypeSerDePbTest, DataTypeScalaSerDeTestDateTime) { uint8_t minute = i; uint8_t second = 0; uint32_t microsecond = 123000; - auto value = ((uint64_t)(((uint64_t)year << 46) | ((uint64_t)month << 42) | - ((uint64_t)day << 37) | ((uint64_t)hour << 32) | - ((uint64_t)minute << 26) | ((uint64_t)second << 20) | - (uint64_t)microsecond)); + DateV2Value datetime_v2; - datetime_v2.from_datetime(value); + datetime_v2.unchecked_set_time(year, month, day, hour, minute, second, microsecond); auto datetime_val = binary_cast, UInt64>(datetime_v2); data.push_back(datetime_val); } diff --git a/be/test/vec/jsonb/serialize_test.cpp b/be/test/vec/jsonb/serialize_test.cpp index f3bfc4448fa653..239d2a5f165d82 100644 --- a/be/test/vec/jsonb/serialize_test.cpp +++ b/be/test/vec/jsonb/serialize_test.cpp @@ -483,7 +483,7 @@ TEST(BlockSerializeTest, JsonbBlock) { auto& date_v2_data = column_vector_date_v2->get_data(); for (int i = 0; i < 1024; ++i) { DateV2Value value; - value.from_date((uint32_t)((2022 << 9) | (6 << 5) | 6)); + value.unchecked_set_time(2022, 6, 6, 0, 0, 0, 0); date_v2_data.push_back(*reinterpret_cast(&value)); } vectorized::DataTypePtr date_v2_type(std::make_shared()); diff --git a/be/test/vec/runtime/vdatetime_value_test.cpp b/be/test/vec/runtime/vdatetime_value_test.cpp index 6c0bfad6b56f24..fd0b3a1d2e5e74 100644 --- a/be/test/vec/runtime/vdatetime_value_test.cpp +++ b/be/test/vec/runtime/vdatetime_value_test.cpp @@ -75,7 +75,7 @@ TEST(VDateTimeValueTest, date_v2_from_uint32_test) { uint8_t day = 24; DateV2Value date_v2; - date_v2.from_date((uint32_t)((year << 9) | (month << 5) | day)); + date_v2.unchecked_set_time(year, month, day, 0, 0, 0, 0); EXPECT_TRUE(date_v2.year() == year); EXPECT_TRUE(date_v2.month() == month); @@ -114,10 +114,7 @@ TEST(VDateTimeValueTest, datetime_v2_from_uint64_test) { uint32_t microsecond = 999999; DateV2Value datetime_v2; - datetime_v2.from_datetime((uint64_t)(((uint64_t)year << 46) | ((uint64_t)month << 42) | - ((uint64_t)day << 37) | ((uint64_t)hour << 32) | - ((uint64_t)minute << 26) | ((uint64_t)second << 20) | - (uint64_t)microsecond)); + datetime_v2.unchecked_set_time(year, month, day, hour, minute, second, microsecond); EXPECT_TRUE(datetime_v2.year() == year); EXPECT_TRUE(datetime_v2.month() == month); @@ -142,10 +139,11 @@ TEST(VDateTimeValueTest, datetime_v2_from_uint64_test) { uint32_t microsecond = 123000; DateV2Value datetime_v2; - datetime_v2.from_datetime((uint64_t)(((uint64_t)year << 46) | ((uint64_t)month << 42) | - ((uint64_t)day << 37) | ((uint64_t)hour << 32) | - ((uint64_t)minute << 26) | ((uint64_t)second << 20) | - (uint64_t)microsecond)); + auto ui64 = (uint64_t)(((uint64_t)year << 46) | ((uint64_t)month << 42) | + ((uint64_t)day << 37) | ((uint64_t)hour << 32) | + ((uint64_t)minute << 26) | ((uint64_t)second << 20) | + (uint64_t)microsecond); + datetime_v2 = (DateV2Value&)ui64; EXPECT_TRUE(datetime_v2.year() == year); EXPECT_TRUE(datetime_v2.month() == month);