GH-48467: [C++][Parquet] Add total_buffered_bytes() API for RowGroupWriter#49527
Open
wecharyu wants to merge 2 commits intoapache:mainfrom
Open
GH-48467: [C++][Parquet] Add total_buffered_bytes() API for RowGroupWriter#49527wecharyu wants to merge 2 commits intoapache:mainfrom
wecharyu wants to merge 2 commits intoapache:mainfrom
Conversation
wgtmac
reviewed
Mar 18, 2026
cpp/src/parquet/file_writer.cc
Outdated
| if (column_writers_[i]) { | ||
| estimated_buffered_value_bytes += | ||
| column_writers_[i]->estimated_buffered_value_bytes() + | ||
| column_writers_[i]->EstimatedBufferedLevelsBytes(); |
Member
There was a problem hiding this comment.
I still have the question: do we need to consider buffered dictionary values?
Member
There was a problem hiding this comment.
Instead of return a sum, should we return a struct like below:
struct BufferedStats {
int64_t def_level_bytes;
int64_t rep_level_bytes;
int64_t value_bytes;
int64_t dict_bytes;
};
mapleFU
reviewed
Mar 19, 2026
| @@ -34,6 +34,13 @@ class ColumnWriter; | |||
| static constexpr uint8_t kParquetMagic[4] = {'P', 'A', 'R', '1'}; | |||
| static constexpr uint8_t kParquetEMagic[4] = {'P', 'A', 'R', 'E'}; | |||
|
|
|||
| struct PARQUET_EXPORT BufferedStats { | |||
Member
There was a problem hiding this comment.
BufferedStats is a bit weird naming for me. AFAIK, if we append column batch by batch, before flushing the row-group, the pages are still "buffered". Can we choose a better name or add the comment for it?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
Expose an API for buffered bytes of values and levels in RowGroupWriter, it's useful in deciding whether a new row group is needed.
Discussion in #48468 (comment)
What changes are included in this PR?
Add new API
total_buffered_bytes()inRowGroupWriter.Are these changes tested?
Test locally.
Are there any user-facing changes?
Yes, user could use the new API to implement their customized row group strategy.