zeroshade commented on code in PR #852:
URL: https://github.com/apache/arrow-go/pull/852#discussion_r3439076976
##########
parquet/file/column_writer_types.gen.go.tmpl:
##########
@@ -269,6 +269,97 @@ func (w *{{.Name}}ColumnChunkWriter)
WriteBatchSpaced(values []{{.name}}, defLev
{{- end}}
}
+// WriteBatchSpacedWithError behaves like WriteBatchSpaced but reports a write
+// failure as an error instead of panicking or silently discarding it,
+// mirroring the error handling of WriteBatch. Prefer this method on write
+// paths whose sink may fail (for example a network-attached writer).
+func (w *{{.Name}}ColumnChunkWriter) WriteBatchSpacedWithError(values
[]{{.name}}, defLevels, repLevels []int16, validBits []byte, validBitsOffset
int64) (valueOffset int64, err error) {
Review Comment:
Done in 975d0524.
1. **Deprecated** — both `WriteBatchSpaced` (all 8 column-writer types) and
`WriteBitmapBatchSpaced` now carry a `// Deprecated:` notice pointing at their
`…WithError` counterparts.
2. **No more duplication** — each now just defers to the `…WithError`
variant and panics if it returns an error, so the duplicated bodies are gone
(−265 lines in the generated file; template + regen).
One behavior note worth your eyes: the legacy methods now fail loudly on a
write error instead of silently discarding it on the numeric/boolean/fixed
paths (the byte-array path already panicked). Because the delegation routes
through `…WithError`'s `recover`, the panic payload is now the
`FormatRecoveredError("unknown error type", …)` wrapper rather than the raw
error — `errors.Is(…, original)` still resolves through the `%w` chain, but the
exact value differs for the byte-array/FLBA paths that previously panicked with
the raw error. Happy to re-panic the unwrapped cause for those two if you'd
rather preserve their exact original payload.
Internal callers are off the deprecated API: `pqarrow` already uses
`WriteBatchSpacedWithError`, and the spaced-write test helper in
`internal/testutils` was migrated too. The spaced-write failure tests now
assert the deprecated methods panic with the underlying error.
--
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]