ychampion opened a new pull request, #12565:
URL: https://github.com/apache/arrow-rs/pull/12565

   # Which issue does this PR close?
   
   - Closes #12541
   
   # Rationale for this change
   
   With the default `WriterProperties` (`DEFAULT_STATISTICS_TRUNCATE_LENGTH = 
Some(64)` and `DEFAULT_COLUMN_INDEX_TRUNCATE_LENGTH = Some(64)`), the Parquet 
writer truncated min/max statistics and column index bounds for non-decimal, 
non-Float16 `FIXED_LEN_BYTE_ARRAY` columns longer than 64 bytes. Because 
PLAIN-encoded `FIXED_LEN_BYTE_ARRAY(N)` values must be exactly `N` bytes, 
truncated bounds violate the Parquet specification and cause Parquet C++ / 
PyArrow readers to fail when reading metadata or evaluating filters.
   
   # What changes are included in this PR?
   
   - Return `false` for `Type::FIXED_LEN_BYTE_ARRAY` in 
`GenericColumnWriter::can_truncate_value` (`parquet/src/column/writer/mod.rs`), 
leaving truncation enabled only for non-decimal variable-length 
`Type::BYTE_ARRAY`. `truncate_statistics` still copies 
`Statistics::FixedLenByteArray` bounds into owned buffers without shortening 
them, preserving exact bounds and avoiding buffer aliasing.
   - Update `test_column_offset_index_metadata_truncating` and 
`test_column_offset_index_truncating_spec_example` to use `ByteArrayType` so 
variable-length column index truncation coverage is preserved.
   - Replace `test_statistics_truncating_fixed_len_byte_array` with 
`test_statistics_not_truncating_fixed_len_byte_array` and add a 
`SerializedFileWriter`/`SerializedFileReader` round-trip test 
(`test_fixed_len_byte_array_no_statistics_or_column_index_truncation`) for 
`FIXED_LEN_BYTE_ARRAY(100)` with default `WriterProperties`.
   
   # Are these changes tested?
   
   Yes — unit and round-trip tests in `parquet/src/column/writer/mod.rs` cover 
`FIXED_LEN_BYTE_ARRAY(100)` with default `WriterProperties` (verifying 100-byte 
exact bounds in both row group statistics and `ColumnIndex`), 
`FIXED_LEN_BYTE_ARRAY(16)` with explicit 1-byte truncation limits, and 
unchanged truncation behavior for `BYTE_ARRAY` columns.
   
   # Are there any significant user-facing changes?
   
   No public API changes. Non-decimal `FIXED_LEN_BYTE_ARRAY` columns wider than 
the configured truncation length now emit full `type_length`-byte exact min/max 
bounds in statistics and column indexes instead of invalid shortened bounds.
   
   # AI usage disclosure
   
   AI assistance was used to draft the code changes, tests, and PR description; 
all changes and test results were reviewed and verified locally.
   


-- 
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