pgwhalen commented on a change in pull request #10142:
URL: https://github.com/apache/arrow/pull/10142#discussion_r619418953
##########
File path: go/arrow/flight/record_batch_writer.go
##########
@@ -46,17 +47,39 @@ func (f *flightPayloadWriter) WritePayload(payload
ipc.Payload) error {
payload.SerializeBody(&f.buf)
f.fd.DataBody = f.buf.Bytes()
+
return f.w.Send(&f.fd)
}
func (f *flightPayloadWriter) Close() error { return nil }
+type Writer struct {
+ *ipc.Writer
+ pw *flightPayloadWriter
+}
+
+// ClearAppMetadata sets the writers app metadata to nil so that subsequent
records
+// will not contain App Metadata until another call is made to
WriteWithAppMetadata.
+func (w *Writer) ClearAppMetadata() {
+ w.pw.fd.AppMetadata = nil
+}
Review comment:
Is the idea that you would call `ClearAppMetadata()` after calling
`WriteWithAppMetadata()` but before calling `Write()` (with no metadata)? If
so, it might be nice to put this pattern in an integration test, since the
tests are probably serving as documentation to most users for now (at least it
did to me).
That being said, what do you think about just setting `w.pw.fd.AppMetadata =
nil` in `WriteWithAppMetadata()` after `w.Write(rec)`? So that you don't have
to remember calling `ClearAppMetadata()`.
At least the way I've been using it, "sticky" metadata would be an
unfortunate bug, and it would be nice to minimize the chances of that. I
suppose my mental model about non-sticky metadata could be wrong, but at least
the Java client assumes it is not sticky.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]