Skip to content

Commit cf77307

Browse files
committed
revert: revert orc format timezone related ut fix
1 parent 3deed2b commit cf77307

File tree

2 files changed

+20
-50
lines changed

2 files changed

+20
-50
lines changed

src/paimon/format/orc/complex_predicate_test.cpp

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@
2727
#include "arrow/array/array_nested.h"
2828
#include "arrow/c/abi.h"
2929
#include "arrow/c/bridge.h"
30-
#include "arrow/chunked_array.h"
3130
#include "arrow/ipc/json_simple.h"
32-
#include "arrow/vendored/datetime/tz.h"
3331
#include "gtest/gtest.h"
3432
#include "orc/OrcFile.hh"
3533
#include "paimon/common/utils/date_time_utils.h"
@@ -63,6 +61,14 @@ class ComplexPredicateTest : public ::testing::Test {
6361
void SetUp() override {
6462
pool_ = GetDefaultPool();
6563
batch_size_ = 10;
64+
65+
arrow::FieldVector fields = {
66+
arrow::field("f1", arrow::int32()),
67+
arrow::field("f2", arrow::int32()),
68+
arrow::field("f3", arrow::date32()),
69+
arrow::field("f4", arrow::timestamp(arrow::TimeUnit::NANO)),
70+
arrow::field("f5", arrow::decimal128(23, 5)),
71+
};
6672
}
6773
void TearDown() override {}
6874

@@ -125,34 +131,16 @@ TEST_F(ComplexPredicateTest, TestSimple) {
125131
arrow::field("f5", arrow::decimal128(23, 5)),
126132
};
127133
auto read_schema = arrow::schema(fields);
128-
std::shared_ptr<arrow::StructArray> expected_array;
129-
if (arrow_vendored::date::current_zone()->name() == "Asia/Shanghai" ||
130-
arrow_vendored::date::current_zone()->name() == "PRC") {
131-
// refer: https://github.com/eggert/tz/blob/main/asia#L653
132-
// When using the Asia/Shanghai timezone, timestamps prior to 1901 have an additional offset
133-
// of 5 minutes and 43 seconds
134-
expected_array = std::dynamic_pointer_cast<arrow::StructArray>(
135-
arrow::ipc::internal::json::ArrayFromJSON(arrow::struct_({fields}), R"([
136-
[10, 1, 1234, "2033-05-18 03:33:20.0", "123456789987654321.45678"],
137-
[10, 1, 19909, "2033-05-18 03:33:20.000001001", "12.30000"],
138-
[10, 1, 0, "2008-12-28 00:00:00.000123456", null],
139-
[10, 1, 100, "2008-12-28 00:00:00.00012345", "-123.45000"],
140-
[10, 1, null, "1899-01-01 01:05:03.001001001", "0.00000"],
141-
[10, 1, 20006, "2024-10-10 10:10:10.100100100", "1728551410100.10010"]
142-
])")
143-
.ValueOrDie());
144-
} else {
145-
expected_array = std::dynamic_pointer_cast<arrow::StructArray>(
146-
arrow::ipc::internal::json::ArrayFromJSON(arrow::struct_({fields}), R"([
147-
[10, 1, 1234, "2033-05-18 03:33:20.0", "123456789987654321.45678"],
148-
[10, 1, 19909, "2033-05-18 03:33:20.000001001", "12.30000"],
149-
[10, 1, 0, "2008-12-28 00:00:00.000123456", null],
150-
[10, 1, 100, "2008-12-28 00:00:00.00012345", "-123.45000"],
151-
[10, 1, null, "1899-01-01 00:59:20.001001001", "0.00000"],
152-
[10, 1, 20006, "2024-10-10 10:10:10.100100100", "1728551410100.10010"]
153-
])")
154-
.ValueOrDie());
155-
}
134+
auto expected_array = std::dynamic_pointer_cast<arrow::StructArray>(
135+
arrow::ipc::internal::json::ArrayFromJSON(arrow::struct_({fields}), R"([
136+
[10, 1, 1234, "2033-05-18 03:33:20.0", "123456789987654321.45678"],
137+
[10, 1, 19909, "2033-05-18 03:33:20.000001001", "12.30000"],
138+
[10, 1, 0, "2008-12-28 00:00:00.000123456", null],
139+
[10, 1, 100, "2008-12-28 00:00:00.00012345", "-123.45000"],
140+
[10, 1, null, "1899-01-01 00:59:20.001001001", "0.00000"],
141+
[10, 1, 20006, "2024-10-10 10:10:10.100100100", "1728551410100.10010"]
142+
])")
143+
.ValueOrDie());
156144

157145
// date
158146
{

src/paimon/format/orc/orc_file_batch_reader_test.cpp

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -499,33 +499,15 @@ TEST_P(OrcFileBatchReaderTest, TestComplexType) {
499499
ASSERT_OK_AND_ASSIGN(auto result_array,
500500
paimon::test::ReadResultCollector::CollectResult(orc_batch_reader.get()));
501501
std::shared_ptr<arrow::ChunkedArray> expected_array;
502-
arrow::Status array_status;
503-
if (arrow_vendored::date::current_zone()->name() == "Asia/Shanghai" ||
504-
arrow_vendored::date::current_zone()->name() == "PRC") {
505-
// refer: https://github.com/eggert/tz/blob/main/asia#L653
506-
// When using the Asia/Shanghai timezone, timestamps prior to 1901 have an additional offset
507-
// of 5 minutes and 43 seconds
508-
array_status = arrow::ipc::internal::json::ChunkedArrayFromJSON(arrow_data_type, {R"([
509-
[10, 1, 1234, "2033-05-18 03:33:20.0", "123456789987654321.45678", "add"],
510-
[10, 1, 19909, "2033-05-18 03:33:20.000001001", "12.30000", "cat"],
511-
[10, 1, 0, "2008-12-28 00:00:00.000123456", null, "dad"],
512-
[10, 1, 100, "2008-12-28 00:00:00.00012345", "-123.45000", "eat"],
513-
[10, 1, null, "1899-01-01 01:05:03.001001001", "0.00000", "fat"],
514-
[10, 1, 20006, "2024-10-10 10:10:10.1001001", "1728551410100.10010", null]
515-
])"},
516-
&expected_array);
517-
} else {
518-
array_status = arrow::ipc::internal::json::ChunkedArrayFromJSON(arrow_data_type, {R"([
502+
auto array_status = arrow::ipc::internal::json::ChunkedArrayFromJSON(arrow_data_type, {R"([
519503
[10, 1, 1234, "2033-05-18 03:33:20.0", "123456789987654321.45678", "add"],
520504
[10, 1, 19909, "2033-05-18 03:33:20.000001001", "12.30000", "cat"],
521505
[10, 1, 0, "2008-12-28 00:00:00.000123456", null, "dad"],
522506
[10, 1, 100, "2008-12-28 00:00:00.00012345", "-123.45000", "eat"],
523507
[10, 1, null, "1899-01-01 00:59:20.001001001", "0.00000", "fat"],
524508
[10, 1, 20006, "2024-10-10 10:10:10.1001001", "1728551410100.10010", null]
525509
])"},
526-
&expected_array);
527-
}
528-
510+
&expected_array);
529511
ASSERT_TRUE(array_status.ok());
530512
ASSERT_TRUE(result_array->Equals(*expected_array));
531513
}

0 commit comments

Comments
 (0)