Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion be/src/format/parquet/vparquet_group_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ bool RowGroupReader::is_dictionary_encoded(const tparquet::ColumnMetaData& colum
if (column_metadata.__isset.encoding_stats) {
// Condition #1 above
for (const tparquet::PageEncodingStats& enc_stat : column_metadata.encoding_stats) {
if (enc_stat.page_type == tparquet::PageType::DATA_PAGE &&
if ((enc_stat.page_type == tparquet::PageType::DATA_PAGE ||
enc_stat.page_type == tparquet::PageType::DATA_PAGE_V2) &&
(enc_stat.encoding != tparquet::Encoding::PLAIN_DICTIONARY &&
enc_stat.encoding != tparquet::Encoding::RLE_DICTIONARY) &&
enc_stat.count > 0) {
Expand Down
31 changes: 31 additions & 0 deletions be/test/format/parquet/parquet_thrift_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <memory>
#include <new>
#include <ostream>
#include <set>
#include <string>
#include <utility>
#include <vector>
Expand Down Expand Up @@ -457,4 +458,34 @@ TEST_F(ParquetThriftReaderTest, dict_decoder) {
read_parquet_data_and_check("./be/test/exec/test_data/parquet_scanner/dict-decoder.parquet",
"./be/test/exec/test_data/parquet_scanner/dict-decoder.txt", 12);
}

TEST_F(ParquetThriftReaderTest, is_dictionary_encoded_rejects_plain_data_page_v2) {
tparquet::ColumnMetaData column_metadata;
column_metadata.type = tparquet::Type::BYTE_ARRAY;
column_metadata.__isset.encoding_stats = true;

tparquet::PageEncodingStats dict_page;
dict_page.page_type = tparquet::PageType::DATA_PAGE_V2;
dict_page.encoding = tparquet::Encoding::RLE_DICTIONARY;
dict_page.count = 2;

tparquet::PageEncodingStats plain_page;
plain_page.page_type = tparquet::PageType::DATA_PAGE_V2;
plain_page.encoding = tparquet::Encoding::PLAIN;
plain_page.count = 1;

column_metadata.encoding_stats = {dict_page, plain_page};

tparquet::RowGroup row_group;
row_group.num_rows = 0;
RowGroupReader::PositionDeleteContext position_delete_ctx(row_group.num_rows, 0);
RowGroupReader::LazyReadContext lazy_read_ctx;
std::set<uint64_t> column_ids;
std::set<uint64_t> filter_column_ids;
RowGroupReader row_group_reader(nullptr, {}, 0, row_group, nullptr, nullptr,
position_delete_ctx, lazy_read_ctx, nullptr, column_ids,
filter_column_ids);

EXPECT_FALSE(row_group_reader.is_dictionary_encoded(column_metadata));
}
} // namespace doris
4 changes: 4 additions & 0 deletions regression-test/data/query_p0/test_parquet_dict.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !s3_tvf --
68535cc98406454081424bf8247d783d

31 changes: 31 additions & 0 deletions regression-test/suites/query_p0/test_parquet_dict.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

suite("test_parquet_dict", "p0") {
try {
String ak = context.config.otherConfigs.get("ak")
String sk = context.config.otherConfigs.get("sk")
qt_s3_tvf """ SELECT * FROM FILE (
"uri" = "https://doris-regression-hk.oss-cn-hongkong.aliyuncs.com/regression/query_p0/test_page_v2.parquet",
"s3.access_key"= "${ak}",
"s3.secret_key" = "${sk}",
"format" = "parquet"
) where user_id='68535cc98406454081424bf8247d783d' ;
"""
} finally {
}
}
Loading