Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
PARQUET-1358: index_page_offset should be unset as it is not supported
Browse files Browse the repository at this point in the history
Author: Korn, Uwe <Uwe.Korn@blue-yonder.com>

Closes #480 from xhochy/PARQUET-1358 and squashes the following commits:

dcf9a94 [Korn, Uwe] PARQUET-1358: index_page_offset should be unset as it is not supported
  • Loading branch information
xhochy committed Jul 26, 2018
1 parent 5264ad4 commit c246da9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/parquet/column_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ class SerializedPageWriter : public PageWriter {
}

void Close(bool has_dictionary, bool fallback) override {
// index_page_offset = 0 since they are not supported
metadata_->Finish(num_values_, dictionary_page_offset_, 0, data_page_offset_,
// index_page_offset = -1 since they are not supported
metadata_->Finish(num_values_, dictionary_page_offset_, -1, data_page_offset_,
total_compressed_size_, total_uncompressed_size_, has_dictionary,
fallback);

Expand Down
1 change: 1 addition & 0 deletions src/parquet/file-serialize-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class TestSerialize : public PrimitiveTypedTest<TestType> {
int64_t values_read;

for (int i = 0; i < num_columns_; ++i) {
ASSERT_FALSE(rg_reader->metadata()->ColumnChunk(i)->has_index_page());
std::vector<int16_t> def_levels_out(rows_per_rowgroup_);
std::vector<int16_t> rep_levels_out(rows_per_rowgroup_);
auto col_reader =
Expand Down
12 changes: 11 additions & 1 deletion src/parquet/metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ class ColumnChunkMetaData::ColumnChunkMetaDataImpl {

inline int64_t data_page_offset() const { return column_->meta_data.data_page_offset; }

inline bool has_index_page() const {
return column_->meta_data.__isset.index_page_offset;
}

inline int64_t index_page_offset() const {
return column_->meta_data.index_page_offset;
}
Expand Down Expand Up @@ -218,6 +222,10 @@ int64_t ColumnChunkMetaData::data_page_offset() const {
return impl_->data_page_offset();
}

bool ColumnChunkMetaData::has_index_page() const {
return impl_->has_index_page();
}

int64_t ColumnChunkMetaData::index_page_offset() const {
return impl_->index_page_offset();
}
Expand Down Expand Up @@ -607,7 +615,9 @@ class ColumnChunkMetaDataBuilder::ColumnChunkMetaDataBuilderImpl {
}
column_chunk_->__isset.meta_data = true;
column_chunk_->meta_data.__set_num_values(num_values);
column_chunk_->meta_data.__set_index_page_offset(index_page_offset);
if (index_page_offset >= 0) {
column_chunk_->meta_data.__set_index_page_offset(index_page_offset);
}
column_chunk_->meta_data.__set_data_page_offset(data_page_offset);
column_chunk_->meta_data.__set_total_uncompressed_size(uncompressed_size);
column_chunk_->meta_data.__set_total_compressed_size(compressed_size);
Expand Down
1 change: 1 addition & 0 deletions src/parquet/metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class PARQUET_EXPORT ColumnChunkMetaData {
bool has_dictionary_page() const;
int64_t dictionary_page_offset() const;
int64_t data_page_offset() const;
bool has_index_page() const;
int64_t index_page_offset() const;
int64_t total_compressed_size() const;
int64_t total_uncompressed_size() const;
Expand Down

0 comments on commit c246da9

Please sign in to comment.