zeroshade commented on a change in pull request #10142:
URL: https://github.com/apache/arrow/pull/10142#discussion_r619888556
##########
File path: go/arrow/flight/flight_test.go
##########
@@ -311,3 +312,65 @@ func TestServer(t *testing.T) {
t.Fatalf("got %d, want %d", numRows, fi.TotalRecords)
}
}
+
+type flightMetadataWriterServer struct{}
+
+func (f *flightMetadataWriterServer) DoGet(tkt *flight.Ticket, fs
flight.FlightService_DoGetServer) error {
+ recs := arrdata.Records[string(tkt.GetTicket())]
+
+ w := flight.NewRecordWriter(fs, ipc.WithSchema(recs[0].Schema()))
+ defer w.Close()
+ for idx, r := range recs {
+ w.WriteWithAppMetadata(r, []byte(fmt.Sprintf("%d_%s", idx,
string(tkt.GetTicket()))))
Review comment:
Go doesn't particularly have a convention for that type of thing, most
of the time it's handled by whatever IDE you're using which would be able to
tell you what each argument was by hovering over the function. But it's easy to
add some comments such as you described, i'll update
##########
File path: go/arrow/flight/flight_test.go
##########
@@ -311,3 +312,65 @@ func TestServer(t *testing.T) {
t.Fatalf("got %d, want %d", numRows, fi.TotalRecords)
}
}
+
+type flightMetadataWriterServer struct{}
+
+func (f *flightMetadataWriterServer) DoGet(tkt *flight.Ticket, fs
flight.FlightService_DoGetServer) error {
+ recs := arrdata.Records[string(tkt.GetTicket())]
+
+ w := flight.NewRecordWriter(fs, ipc.WithSchema(recs[0].Schema()))
+ defer w.Close()
+ for idx, r := range recs {
+ w.WriteWithAppMetadata(r, []byte(fmt.Sprintf("%d_%s", idx,
string(tkt.GetTicket()))))
Review comment:
So when running `gofmt` after adding the `/*metadata*/` before
`[]byte(fmt.Sprintf("%d_%s", idx, string(tkt.GetTicket())))` it insisted on the
comment being put after the `r` before the comma, so it appears that the
convention for Go is for the comment identifying the literal to be *after* the
value, rather than before it. So that's what i'll do.
##########
File path: go/arrow/flight/record_batch_reader.go
##########
@@ -60,15 +68,41 @@ func (d *dataMessageReader) Release() {
if d.msg != nil {
d.msg.Release()
d.msg = nil
+ d.lastAppMetadata = nil
}
}
}
+type Reader struct {
+ *ipc.Reader
+ dmr *dataMessageReader
+}
+
+func (r *Reader) Retain() {
Review comment:
added
--
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]