Skip to content

Commit

Permalink
extract _has_dict_page()
Browse files Browse the repository at this point in the history
  • Loading branch information
suxiaogang223 committed Oct 8, 2024
1 parent 215f451 commit a1b18b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions be/src/vec/exec/format/parquet/vparquet_column_chunk_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,14 @@ ColumnChunkReader::ColumnChunkReader(io::BufferedStreamReader* reader,

Status ColumnChunkReader::init() {
size_t start_offset =
_metadata.__isset.dictionary_page_offset && _metadata.dictionary_page_offset > 0
? _metadata.dictionary_page_offset
: _metadata.data_page_offset;
_has_dict_page() ? _metadata.dictionary_page_offset : _metadata.data_page_offset;
size_t chunk_size = _metadata.total_compressed_size;
// create page reader
_page_reader = create_page_reader(_stream_reader, _io_ctx, start_offset, chunk_size,
_metadata.num_values, _offset_index);
// get the block compression codec
RETURN_IF_ERROR(get_block_compression_codec(_metadata.codec, &_block_compress_codec));
if (_metadata.__isset.dictionary_page_offset && _metadata.dictionary_page_offset > 0) {
if (_has_dict_page()) {
// seek to the directory page
_page_reader->seek_to_page(_metadata.dictionary_page_offset);
// Parse dictionary data when reading
Expand All @@ -83,6 +81,10 @@ Status ColumnChunkReader::init() {
return Status::OK();
}

bool ColumnChunkReader::_has_dict_page() const {
return _metadata.__isset.dictionary_page_offset && _metadata.dictionary_page_offset > 0;
}

Status ColumnChunkReader::next_page() {
if (_state == HEADER_PARSED) {
return Status::OK();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class ColumnChunkReader {
private:
enum ColumnChunkReaderState { NOT_INIT, INITIALIZED, HEADER_PARSED, DATA_LOADED, PAGE_SKIPPED };

bool _has_dict_page() const;
Status _decode_dict_page();
void _reserve_decompress_buf(size_t size);
int32_t _get_type_length();
Expand Down

0 comments on commit a1b18b1

Please sign in to comment.