kszucs opened a new issue, #55638:
URL: https://github.com/apache/arrow/issues/55638

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   With content-defined chunking, list columns written from a multi-chunk 
`ChunkedArray` lose the chunk boundaries that fall at the start of an array 
chunk, so the page layout depends on the in-memory chunking. Flat and struct 
columns are not affected.
   
   ```python
   import pyarrow as pa
   import pyarrow.parquet as pq
   
   
   def write(table):
       sink = pa.BufferOutputStream()
       cdc = {"min_chunk_size": 1024, "max_chunk_size": 4096}
       pq.write_table(table, sink, use_content_defined_chunking=cdc)
       return sink.getvalue()
   
   
   rows = [[i, i] for i in range(100)]
   
   # chunked at row 84
   table = pa.table({"x": pa.chunked_array([rows[:84], rows[84:]])})
   assert write(table) == write(table.combine_chunks())
   
   # chunked at row 85, where a page starts
   table = pa.table({"x": pa.chunked_array([rows[:85], rows[85:]])})
   assert write(table) == write(table.combine_chunks())  # fails
   ```
   
   The nested branch in `cpp/src/parquet/chunker_internal.cc` skips empty 
chunks (`if (levels_to_write > 0)`), so a boundary at offset 0 of a 
`WriteArrow()` call is dropped instead of closing the previous page.
   
   ### Component(s)
   
   C++, Parquet
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to