@@ -57,7 +57,8 @@ class OrcReadLinesTest : public testing::Test {
5757 OrcReadLinesTest () {}
5858};
5959
60- static void read_orc_line (int64_t line, std::string block_dump) {
60+ static void read_orc_line (int64_t line, std::string block_dump,
61+ const std::string& time_zone = " CST" ) {
6162 auto runtime_state = RuntimeState::create_unique ();
6263
6364 std::vector<std::string> column_names = {" col1" , " col2" , " col3" , " col4" , " col5" ,
@@ -119,7 +120,6 @@ static void read_orc_line(int64_t line, std::string block_dump) {
119120 io::IOContext io_ctx;
120121 io::FileReaderStats file_reader_stats;
121122 io_ctx.file_reader_stats = &file_reader_stats;
122- std::string time_zone = " CST" ;
123123 auto reader = OrcReader::create_unique (nullptr , runtime_state.get (), params, range, 100 ,
124124 time_zone, &io_ctx, nullptr , true );
125125 auto local_fs = io::global_local_filesystem ();
@@ -143,7 +143,8 @@ static void read_orc_line(int64_t line, std::string block_dump) {
143143 std::unordered_map<std::string, std::tuple<std::string, const SlotDescriptor*>>
144144 partition_columns;
145145 std::unordered_map<std::string, VExprContextSPtr> missing_columns;
146- static_cast <void >(reader->set_fill_columns (partition_columns, missing_columns));
146+ auto st = reader->set_fill_columns (partition_columns, missing_columns);
147+ EXPECT_TRUE (st.ok ()) << st;
147148 BlockUPtr block = Block::create_unique ();
148149 for (const auto & slot_desc : tuple_desc->slots ()) {
149150 auto data_type = slot_desc->type ();
@@ -158,7 +159,8 @@ static void read_orc_line(int64_t line, std::string block_dump) {
158159
159160 bool eof = false ;
160161 size_t read_row = 0 ;
161- static_cast <void >(reader->get_next_block (block.get (), &read_row, &eof));
162+ st = reader->get_next_block (block.get (), &read_row, &eof);
163+ EXPECT_TRUE (st.ok ()) << st;
162164 auto row_id_string_column = static_cast <const ColumnString&>(
163165 *block->get_by_position (block->get_position_by_name (" row_id" )).column .get ());
164166 for (auto i = 0 ; i < row_id_string_column.size (); i++) {
@@ -185,7 +187,7 @@ static void read_orc_line(int64_t line, std::string block_dump) {
185187 slot_info.is_file_slot = true ;
186188 params.required_slots .emplace_back (slot_info);
187189 }
188- runtime_state->_timezone = " CST " ;
190+ runtime_state->_timezone = time_zone ;
189191
190192 std::unique_ptr<RuntimeProfile> runtime_profile;
191193 runtime_profile = std::make_unique<RuntimeProfile>(" ExternalRowIDFetcher" );
@@ -196,9 +198,9 @@ static void read_orc_line(int64_t line, std::string block_dump) {
196198 ExternalFileMappingInfo external_info (0 , range, false );
197199 int64_t init_reader_ms = 0 ;
198200 int64_t get_block_ms = 0 ;
199- auto st = vf->read_lines_from_range (range, {line}, block.get (), external_info, &init_reader_ms,
200- &get_block_ms);
201- EXPECT_TRUE (st.ok ());
201+ st = vf->read_lines_from_range (range, {line}, block.get (), external_info, &init_reader_ms,
202+ &get_block_ms);
203+ EXPECT_TRUE (st.ok ()) << st ;
202204 EXPECT_EQ (block->dump_data (1 ), block_dump);
203205}
204206
@@ -375,4 +377,22 @@ TEST_F(OrcReadLinesTest, test9) {
375377 read_orc_line (9 , block_dump);
376378}
377379
380+ TEST_F (OrcReadLinesTest, date_should_not_shift_in_west_timezone) {
381+ std::string block_dump =
382+ " +----------------------+--------------------+----------------------+------------------"
383+ " ----+----------------------+---------------------+-------------------+----------------"
384+ " --------+----------------------+\n |col1(Nullable(BIGINT))|col2(Nullable(BOOL))|col3("
385+ " Nullable(String))|col4(Nullable(DateV2))|col5(Nullable(DOUBLE))|col6(Nullable(FLOAT))|"
386+ " col7(Nullable(INT))|col8(Nullable(SMALLINT))|col9(Nullable(String))|\n +---------------"
387+ " -------+--------------------+----------------------+----------------------+-----------"
388+ " -----------+---------------------+-------------------+------------------------+-------"
389+ " ---------------+\n | 1| 1| "
390+ " doris| 1900-01-01| 1.567| 1.567| "
391+ " 12345| 1| "
392+ " doris|\n +----------------------+--------------------+----------------------+----------"
393+ " ------------+----------------------+---------------------+-------------------+--------"
394+ " ----------------+----------------------+\n " ;
395+ read_orc_line (1 , block_dump, " America/Mexico_City" );
396+ }
397+
378398} // namespace doris
0 commit comments