[Test](tvf) add regression tests for testing orc reader #41606 #42188 (#42120)

cherry pick from #42031 #42188

---------

Co-authored-by: Tiewei Fang <43782773+BePPPower@users.noreply.github.com>
Co-authored-by: TieweiFang <ftw2139@163.com>
This commit is contained in:
Rayner Chen
2024-10-21 21:31:18 +08:00
committed by GitHub
parent ac3d64c010
commit 084434e25c
17 changed files with 1435 additions and 10 deletions

View File

@ -32,8 +32,6 @@ enum {
};
namespace doris::vectorized {
static const int64_t timestamp_threshold = -2177481943;
static const int64_t timestamp_diff = 343;
static const int64_t micr_to_nano_second = 1000;
Status DataTypeDateTimeV2SerDe::serialize_column_to_json(const IColumn& column, int start_idx,
@ -232,14 +230,6 @@ Status DataTypeDateTimeV2SerDe::write_column_to_orc(const std::string& timezone,
return Status::InternalError("get unix timestamp error.");
}
// -2177481943 represent '1900-12-31 23:54:17'
// but -2177481944 represent '1900-12-31 23:59:59'
// so for timestamp <= -2177481944, we subtract 343 (5min 43s)
// Reference: https://www.timeanddate.com/time/change/china/shanghai?year=1900
if (timezone == TimezoneUtils::default_time_zone && timestamp < timestamp_threshold) {
timestamp -= timestamp_diff;
}
cur_batch->data[row_id] = timestamp;
cur_batch->nanoseconds[row_id] = datetime_val.microsecond() * micr_to_nano_second;
}