hcrosse opened a new issue, #1644:
URL: https://github.com/apache/arrow-go/issues/1644

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   arrow-go writes encrypted files with 32769 row groups, or an encrypted 
column at index 32768, that Arrow C++ refuses to read. arrow-go's own reader 
refuses that column too.
   
   I reproduced this on v18.9.0 and `main` with Go 1.26.10 on macOS arm64.
   
   With one encrypted `int32` column and one row per row group, the 32769th 
`AppendRowGroupChecked` succeeds. `Close` succeeds, and arrow-go reads all 
32769 rows. pyarrow 26.0.0, which runs Arrow C++, fails on 
`read_row_group(32768)` with:
   
   ```text
   Encrypted files cannot contain more than 32767 row groups
   ```
   
   With 32769 uniformly encrypted columns, writing also succeeds, but reading 
column 32768 with arrow-go returns:
   
   ```text
   parquet: unable to initialize page reader: encrypted files cannot contain 
more than 32767 column chunks
   ```
   
   pyarrow fails on that column with `Encrypted files cannot contain more than 
32767 columns`. Exactly 32768 encrypted row groups or columns, with ordinals 0 
through 32767, work in both readers. A file of 32769 columns with only column 0 
encrypted also reads correctly in both.
   
   The writer should reject the 32769th encrypted row group and any encrypted 
column at index 32768 or above.
   
   **Cause**
   
   The writer converts row group and column ordinals to `int16` without 
checking their range:
   
   
https://github.com/apache/arrow-go/blob/aba35416f463a99758ecbaee56d0f908fb63da32/parquet/file/file_writer.go#L236-L243
   
   
https://github.com/apache/arrow-go/blob/aba35416f463a99758ecbaee56d0f908fb63da32/parquet/file/row_group_writer.go#L187-L195
   
   Arrow C++ refuses to append the 32769th row group to an encrypted file:
   
   
https://github.com/apache/arrow/blob/976779b2aac587f51b87c3bd2e6ae4c36f75ab6c/cpp/src/parquet/file_writer.cc#L405-L416
   
   The Arrow C++ reader rejects both ordinals for encrypted columns:
   
   
https://github.com/apache/arrow/blob/976779b2aac587f51b87c3bd2e6ae4c36f75ab6c/cpp/src/parquet/file_reader.cc#L282-L288
   
   parquet-java's `AesCipher.createModuleAAD` throws when either ordinal does 
not fit a `short`:
   
   
https://github.com/apache/parquet-java/blob/ee88e9c3d0fcd78ac59b58261ef617ff620c6b3f/parquet-hadoop/src/main/java/org/apache/parquet/crypto/AesCipher.java#L82-L100
   
   ### Component(s)
   
   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