diff --git a/be/src/vec/exec/format/parquet/vparquet_reader.cpp b/be/src/vec/exec/format/parquet/vparquet_reader.cpp index b91a7c21cbd0c8..3083fd61ab03b3 100644 --- a/be/src/vec/exec/format/parquet/vparquet_reader.cpp +++ b/be/src/vec/exec/format/parquet/vparquet_reader.cpp @@ -561,6 +561,7 @@ Status ParquetReader::get_next_block(Block* block, size_t* read_rows, bool* eof) return Status::OK(); } + std::vector original_block_column_name = block->get_names(); if (!_hive_use_column_names) { for (auto i = 0; i < block->get_names().size(); i++) { auto& col = block->get_by_position(i); @@ -584,7 +585,7 @@ Status ParquetReader::get_next_block(Block* block, size_t* read_rows, bool* eof) if (!_hive_use_column_names) { for (auto i = 0; i < block->columns(); i++) { - block->get_by_position(i).name = (*_column_names)[i]; + block->get_by_position(i).name = original_block_column_name[i]; } block->initialize_index_by_name(); } diff --git a/regression-test/data/external_table_p0/hive/test_external_catalog_hive_partition.out b/regression-test/data/external_table_p0/hive/test_external_catalog_hive_partition.out index aa1e48a439d1e9..0402feef40e6b5 100644 --- a/regression-test/data/external_table_p0/hive/test_external_catalog_hive_partition.out +++ b/regression-test/data/external_table_p0/hive/test_external_catalog_hive_partition.out @@ -143,3 +143,99 @@ -- !q06 -- 2023-01-03T00:00 100 0.3 test3 +-- !q01 -- +0.1 test1 2023-01-01T00:00 \N +0.2 test2 2023-01-02T00:00 \N +0.3 test3 2023-01-03T00:00 100 + +-- !q02 -- +0.1 test1 2023-01-01T00:00 \N +0.2 test2 2023-01-02T00:00 \N + +-- !q03 -- +0.3 test3 2023-01-03T00:00 100 + +-- !q04 -- +2023-01-01T00:00 \N 0.1 test1 +2023-01-02T00:00 \N 0.2 test2 +2023-01-03T00:00 100 0.3 test3 + +-- !q05 -- +2023-01-01T00:00 \N 0.1 test1 +2023-01-02T00:00 \N 0.2 test2 + +-- !q06 -- +2023-01-03T00:00 100 0.3 test3 + +-- !q01 -- +0.1 test1 2023-01-01T00:00 \N +0.2 test2 2023-01-02T00:00 \N +0.3 test3 2023-01-03T00:00 100 + +-- !q02 -- +0.1 test1 2023-01-01T00:00 \N +0.2 test2 2023-01-02T00:00 \N + +-- !q03 -- +0.3 test3 2023-01-03T00:00 100 + +-- !q04 -- +2023-01-01T00:00 \N 0.1 test1 +2023-01-02T00:00 \N 0.2 test2 +2023-01-03T00:00 100 0.3 test3 + +-- !q05 -- +2023-01-01T00:00 \N 0.1 test1 +2023-01-02T00:00 \N 0.2 test2 + +-- !q06 -- +2023-01-03T00:00 100 0.3 test3 + +-- !q01 -- +0.1 test1 2023-01-01T00:00 \N +0.2 test2 2023-01-02T00:00 \N +0.3 test3 2023-01-03T00:00 100 + +-- !q02 -- +0.1 test1 2023-01-01T00:00 \N +0.2 test2 2023-01-02T00:00 \N + +-- !q03 -- +0.3 test3 2023-01-03T00:00 100 + +-- !q04 -- +2023-01-01T00:00 \N 0.1 test1 +2023-01-02T00:00 \N 0.2 test2 +2023-01-03T00:00 100 0.3 test3 + +-- !q05 -- +2023-01-01T00:00 \N 0.1 test1 +2023-01-02T00:00 \N 0.2 test2 + +-- !q06 -- +2023-01-03T00:00 100 0.3 test3 + +-- !q01 -- +0.1 test1 2023-01-01T00:00 \N +0.2 test2 2023-01-02T00:00 \N +0.3 test3 2023-01-03T00:00 100 + +-- !q02 -- +0.1 test1 2023-01-01T00:00 \N +0.2 test2 2023-01-02T00:00 \N + +-- !q03 -- +0.3 test3 2023-01-03T00:00 100 + +-- !q04 -- +2023-01-01T00:00 \N 0.1 test1 +2023-01-02T00:00 \N 0.2 test2 +2023-01-03T00:00 100 0.3 test3 + +-- !q05 -- +2023-01-01T00:00 \N 0.1 test1 +2023-01-02T00:00 \N 0.2 test2 + +-- !q06 -- +2023-01-03T00:00 100 0.3 test3 + diff --git a/regression-test/suites/external_table_p0/hive/test_external_catalog_hive_partition.groovy b/regression-test/suites/external_table_p0/hive/test_external_catalog_hive_partition.groovy index 32b80f5650da8f..d34467c4c56356 100644 --- a/regression-test/suites/external_table_p0/hive/test_external_catalog_hive_partition.groovy +++ b/regression-test/suites/external_table_p0/hive/test_external_catalog_hive_partition.groovy @@ -65,9 +65,18 @@ suite("test_external_catalog_hive_partition", "p0,external,hive,external_docker, qt_q06 """ select * from multi_catalog.text_partitioned_columns where t_int is not null order by t_float """ } sql """ use `multi_catalog`; """ + sql """ set hive_parquet_use_column_names = true; """ + sql """ set hive_orc_use_column_names = true""" + q01_parquet() q01_orc() q01_text() + + sql """ set hive_parquet_use_column_names = false; """ + sql """ set hive_orc_use_column_names = false""" + q01_parquet() + q01_orc() + } }