Skip to content

Commit

Permalink
fix ut compile
Browse files Browse the repository at this point in the history
  • Loading branch information
HappenLee committed Jan 13, 2025
1 parent 3590735 commit 794247a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion be/test/vec/core/block_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DateV2ValueType> 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<vectorized::UInt32*>(&value));
}
vectorized::DataTypePtr date_v2_type(std::make_shared<vectorized::DataTypeDateV2>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<DateV2ValueType> 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<vectorized::UInt32*>(&value));
}
vectorized::DataTypePtr date_v2_type(
Expand Down
7 changes: 2 additions & 5 deletions be/test/vec/data_types/serde/data_type_serde_pb_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DateTimeV2ValueType> datetime_v2;
datetime_v2.from_datetime(value);
datetime_v2.unchecked_set_time(year, month, day, hour, minute, second, microsecond);
auto datetime_val = binary_cast<DateV2Value<DateTimeV2ValueType>, UInt64>(datetime_v2);
data.push_back(datetime_val);
}
Expand Down
2 changes: 1 addition & 1 deletion be/test/vec/jsonb/serialize_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DateV2ValueType> 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<vectorized::UInt32*>(&value));
}
vectorized::DataTypePtr date_v2_type(std::make_shared<vectorized::DataTypeDateV2>());
Expand Down
16 changes: 7 additions & 9 deletions be/test/vec/runtime/vdatetime_value_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ TEST(VDateTimeValueTest, date_v2_from_uint32_test) {
uint8_t day = 24;

DateV2Value<DateV2ValueType> 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);
Expand Down Expand Up @@ -114,10 +114,7 @@ TEST(VDateTimeValueTest, datetime_v2_from_uint64_test) {
uint32_t microsecond = 999999;

DateV2Value<DateTimeV2ValueType> 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);
Expand All @@ -142,10 +139,11 @@ TEST(VDateTimeValueTest, datetime_v2_from_uint64_test) {
uint32_t microsecond = 123000;

DateV2Value<DateTimeV2ValueType> 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<DateTimeV2ValueType>&)ui64;

EXPECT_TRUE(datetime_v2.year() == year);
EXPECT_TRUE(datetime_v2.month() == month);
Expand Down

0 comments on commit 794247a

Please sign in to comment.