nirajan1111 opened a new pull request, #1407:
URL: https://github.com/apache/arrow-go/pull/1407

   ### Rationale for this change
   
   When a file has columns encrypted with their own keys and the reader isn't 
given the key for one of them, asking for that column panics:
   
   ```
   panic: hidden column exception, path=b
   ```
   
   This happens from `RowGroupMetaData.ColumnChunk` and from 
`pqarrow.ReadTable`, even though both return an `error`. The panic comes from 
`getColumnDecryptor` in `parquet/internal/encryption/decryptor.go` when neither 
the explicit column keys nor the key retriever has a key for the column.
   
   Fixes #69.
   
   ### What changes are included in this PR?
   
   - The internal `FileDecryptor.GetColumnMetaDecryptor` and 
`GetColumnDataDecryptor` now return `(Decryptor, error)`, and the missing-key 
case returns an error instead of panicking.
   - `NewColumnChunkMetaData` and `RowGroupReader.GetColumnPageReader` pass the 
error up. The page index and bloom filter readers already go through 
`encryption.GetColumnMetaDecryptor`, which returns an error.
   
   Columns whose keys are available can still be read.
   
   ### Are these changes tested?
   
   Yes. `TestDecryptHiddenColumn` writes two columns with separate keys, reads 
with only one key, and checks that the hidden column returns an error from 
`ColumnChunk` and `ReadTable` while the other column still reads. It panics on 
main.
   
   - `go test ./parquet -run TestDecryptHiddenColumn -count=1`
   - `go test ./parquet/... -count=1` with `PARQUET_TEST_DATA` set
   - `golangci-lint run` in `parquet/`: 0 issues
   
   ### Are there any user-facing changes?
   
   Yes. Reading a column without its decryption key now returns an error 
instead of panicking. `StringKeyIDRetriever` still panics on a missing key, 
since `KeyRetriever.GetKey` has no error return; that would be a separate API 
change.
   


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