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

   ### Rationale for this change
   
   Follow-up to #1621, the point @zeroshade raised in review. #1597 and #1621 
keep `FlushCurrentPage` errors on the column, but a panic recovered by a write 
handler is only returned. After a batch whose definition levels name more slots 
than there are values, `Close` returns nil and the file gets a footer for rows 
with no values.
   
   ### What changes are included in this PR?
   
   The recover handlers in `WriteBatch`, `WriteBatchSpacedWithError`, 
`WriteBitmapBatch`, `WriteBitmapBatchSpacedWithError` and the Arrow byte-array 
and fixed-length byte-array paths now record the recovered error with 
`recordError`. Column, row group and file `Close` return it and no footer is 
written.
   
   `WriteDictIndices` is unchanged: its panic comes from `PutIndices` before 
any levels are written, and `TestWriteDictIndicesRejectsBeforeWritingLevels` 
needs the writer to stay usable after it.
   
   ### Are these changes tested?
   
   Two tests in `column_writer_panic_test.go`, one for `WriteBatch` with the 
batch from the review and one for the fixed-length `WriteBatchArrow` path. Both 
close the column, row group and file twice, check that no bytes are appended 
and that `NewParquetReader` rejects the file. Both fail on main and pass with 
it.
   
   ```sh
   go test -short -count=1 ./parquet/...
   go test -race -count=1 ./parquet/file ./parquet/pqarrow
   cd parquet && golangci-lint run ./file/...
   ```
   
   `go generate ./parquet/file` leaves the diff unchanged.
   
   ### Are there any user-facing changes?
   
   After an error from a recovered panic, column `Close` returns it and the 
file writer writes no footer.
   
   Fixes #1693
   AI-assisted, reviewed by a human.
   


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