Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
Signed-off-by: Youngwb <[email protected]>
  • Loading branch information
Youngwb committed Jan 18, 2025
1 parent 2c6c7de commit fc909b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion be/src/formats/parquet/column_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ Status Int96ToDateTimeConverter::convert(const ColumnPtr& src, Column* dst) {
dst_null_data[i] = src_null_data[i];
if (!src_null_data[i]) {
Timestamp timestamp = (static_cast<uint64_t>(src_data[i].hi) << TIMESTAMP_BITS) | (src_data[i].lo / 1000);
dst_data[i].set_timestamp(timestamp);
dst_data[i].set_timestamp(_utc_to_local(timestamp));
}
}
dst_nullable_column->set_has_null(src_nullable_column->has_null());
Expand Down
4 changes: 3 additions & 1 deletion be/src/formats/parquet/level_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ Status LevelBuilder::_write_datetime_column_chunk(const LevelBuilderContext& ctx
DeferOp defer([&] { delete[] values; });

for (size_t i = 0; i < col->size(); i++) {
auto timestamp = data_col[i]._timestamp;
auto timestamp = use_int96_timestamp_encoding
? timestamp::sub<TimeUnit::SECOND>(data_col[i]._timestamp, _offset)
: data_col[i]._timestamp;
if constexpr (use_int96_timestamp_encoding) {
auto date = reinterpret_cast<int32_t*>(values[i].value + 2);
auto nanosecond = reinterpret_cast<int64_t*>(values[i].value);
Expand Down
8 changes: 4 additions & 4 deletions be/test/formats/parquet/column_converter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ TEST_F(ColumnConverterTest, Int96Test) {
const std::string col_name = "timestamp_int96";
{
const TypeDescriptor col_type = TypeDescriptor::from_logical_type(LogicalType::TYPE_DATETIME);
check(file_path, col_type, col_name, "[2023-04-28 16:40:22.618760]", expected_rows);
check(file_path, col_type, col_name, "[2023-04-29 00:40:22.618760]", expected_rows);
}
}
}
Expand All @@ -476,21 +476,21 @@ TEST_F(ColumnConverterTest, Int96TimeZoneTest) {
const std::string col_name = "time_with_new_york";
{
const TypeDescriptor col_type = TypeDescriptor::from_logical_type(LogicalType::TYPE_DATETIME);
check(file_path, col_type, col_name, "[2019-04-16 20:00:00]", expected_rows);
check(file_path, col_type, col_name, "[2019-04-17 04:00:00]", expected_rows);
}
}
{
const std::string col_name = "time_with_shanghai";
{
const TypeDescriptor col_type = TypeDescriptor::from_logical_type(LogicalType::TYPE_DATETIME);
check(file_path, col_type, col_name, "[2019-04-16 20:00:00]", expected_rows);
check(file_path, col_type, col_name, "[2019-04-17 04:00:00]", expected_rows);
}
}
{
const std::string col_name = "time_without_timezone";
{
const TypeDescriptor col_type = TypeDescriptor::from_logical_type(LogicalType::TYPE_DATETIME);
check(file_path, col_type, col_name, "[2019-04-16 20:00:00]", expected_rows);
check(file_path, col_type, col_name, "[2019-04-17 04:00:00]", expected_rows);
}
}
}
Expand Down

0 comments on commit fc909b4

Please sign in to comment.