Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write parquet column chunk file_offset #15882

Closed
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
7 changes: 5 additions & 2 deletions cpp/src/io/parquet/writer_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2486,8 +2486,11 @@ void writer::impl::write_parquet_data_to_sink(
_out_sink[p]->host_write(bounce_buffer.data(), ck.compressed_size);
}

auto const chunk_offset = _current_chunk_offset[p];
auto& column_chunk_meta = row_group.columns[i].meta_data;
auto const chunk_offset = _current_chunk_offset[p];
auto& column_chunk = row_group.columns[i];
column_chunk.file_offset = chunk_offset;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Danger Will Robinson! There appears to be confusion in the community about what file_offset is. According to the parquet thrift this points to the chunk metadata, not the start of the chunk. This allows for the metadata to be separated from the thrift in the footer, both to allow for faster parsing, and to support data living in a file separate from where the footer is located. (See apache/parquet-format#242 (comment) for some discussion of the latter use case). It seems as though parquet-mr incorrectly populates this with the offset of the first page, while arrow does what the spec mandates and uses it to point to a duplicate copy of the ColumnMetaData that is located at the end of a column chunk (as per the figure in the spec). Since libcudf does not write this copy, it's best to leave this field as '0'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. OK, I'll close this PR.


auto& column_chunk_meta = column_chunk.meta_data;
column_chunk_meta.data_page_offset =
chunk_offset + ((ck.use_dictionary) ? ck.dictionary_size : 0);
column_chunk_meta.dictionary_page_offset = (ck.use_dictionary) ? chunk_offset : 0;
Expand Down
Loading