Repository navigation
fix(parquet): skip empty CDC page flushes in add_data_page - #11003
Conversation
A forced content-defined chunk boundary can run after the chunk already flushed its page. Flushing with nothing buffered panics BOOLEAN RLE and emits zero-value pages for other encodings.
haohuaijin
left a comment
There was a problem hiding this comment.
Thanks @M-Tesla, LGTM, some suggestion for test case: could we use fewer rows here? 32,768 for BOOLEAN and 8,192 for INT32 reliably reproduce the issues. It might also be worth sharing the CDC setup between the two tests.
32768 BOOLEAN rows and 8192 INT32 rows are enough, and both tests share one CDC setup.
|
Thanks @haohuaijin. I shrank the BOOLEAN test to 32768 rows and the INT32 test to 8192, and both tests now share one CDC setup. The empty-page checks are unchanged. |
haohuaijin
left a comment
There was a problem hiding this comment.
LGTM, two small suggestion.
|
cc @adriangb |
Rich-T-kid
left a comment
There was a problem hiding this comment.
this looks good to me, left a few suggestions
|
Glad to see this being fixed! |
|
@M-Tesla can you enable the CI to run on your fork? |
The BOOLEAN test already says the row count is large enough to hit CDC chunk boundaries. The INT32 test has the same ignore and no note.
|
@Rich-T-kid actions are enabled on the fork. :) |
The fork CI check looks for ci.yml on this branch. That workflow landed on main after the branch was cut.
|
can you resolve the remaining threads |
The two tests share one helper, both Miri ignores say why, and the empty-page comment keeps the no-op line and the OffsetIndex note.
|
Sorry for leaving those notes. The helper, the Miri reasons, and the comment are in now. |
Rich-T-kid
left a comment
There was a problem hiding this comment.
thanks @M-Tesla, @haohuaijin , @ryux1
Which issue does this PR close?
Rationale for this change
Content-defined chunking forces a data page break after every chunk except the last. Writing the chunk can already have flushed that page, when the chunk hits
data_page_size_limitordata_page_row_count_limitexactly at the boundary. The forcedadd_data_pagethen flushes with nothing buffered.For BOOLEAN under
PARQUET_2_0(RLE), that panics:RLE value encoder is not initialized. Other encodings do not panic, but they write a data page with zero values.should_add_data_page,dict_fallback, andflush_data_pagesalready skip the empty case.add_data_pagedid not.What changes are included in this PR?
GenericColumnWriter::add_data_pagereturnsOk(())whennum_buffered_values == 0.No public API change.
Are these changes tested?
data_page_size_limit(1024)and CDC 8KiB/16KiB: write succeeds, no empty data pages, roundtrip row count matchesdata_page_row_count_limit(128)and the same CDC options: no empty data pagescargo test -p parquet --lib -- cdc_boolean_small_pages_does_not_panicandcdc_int32_row_count_limit_does_not_emit_empty_pages.cargo clippy -p parquet --lib -- -D warnings.Are there any user-facing changes?
BOOLEAN CDC writes that previously panicked now succeed. Empty data pages are no longer emitted for the same forced-break case on other encodings.
AI Disclosure
Assisted draft of the empty-buffer guard and regression tests. The skip matches the existing guards on
should_add_data_page,dict_fallback, andflush_data_pages. Reviewed and verified with the checks above.