zeroshade commented on code in PR #43484:
URL: https://github.com/apache/arrow/pull/43484#discussion_r1697207327
##########
go/arrow/flight/flight_test.go:
##########
@@ -449,3 +451,36 @@ func TestReaderError(t *testing.T) {
t.Fatal("should have errored")
}
}
+
+func TestWriterInferSchema(t *testing.T) {
+ recs, ok := arrdata.Records["primitives"]
+ require.True(t, ok)
+
+ fs := flightStreamWriter{}
+ w := flight.NewRecordWriter(&fs)
+
+ for _, rec := range recs {
+ require.NoError(t, w.Write(rec))
+ }
+
+ require.NoError(t, w.Close())
+}
+
+func TestWriterInconsistentSchema(t *testing.T) {
+ recs, ok := arrdata.Records["primitives"]
+ require.True(t, ok)
+
+ schema := arrow.NewSchema([]arrow.Field{{Name: "unknown", Type:
arrow.PrimitiveTypes.Int8}}, nil)
+ fs := flightStreamWriter{}
+ w := flight.NewRecordWriter(&fs, ipc.WithSchema(schema))
+
+ require.ErrorContains(t, w.Write(recs[0]), "arrow/ipc: tried to write
record batch with different schema")
Review Comment:
do we use a specific error type via `%w` in this message? If so, can we try
using `ErrorIs`?
--
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]