ennuite commented on code in PR #732:
URL: https://github.com/apache/arrow-go/pull/732#discussion_r3733066313
##########
arrow/flight/flightsql/server_test.go:
##########
@@ -287,6 +355,69 @@ func (s *FlightSqlServerSuite) TestExecuteChunkError() {
}
}
+func (s *FlightSqlServerSuite) TestExecutePreparedStatementQuery() {
+ prep, err := s.cl.Prepare(context.TODO(), "prepared query")
+ s.Require().NoError(err)
+ defer prep.Close(context.TODO())
+
+ val, ok := prep.IsUpdate()
+ s.Require().True(ok)
+ s.False(val)
+
+ fi, err := prep.Execute(context.TODO())
+ s.Require().NoError(err)
+ ep := fi.GetEndpoint()
+ s.Require().Len(ep, 1)
+ fr, err := s.cl.DoGet(context.TODO(), ep[0].GetTicket())
+ s.Require().NoError(err)
+ var recs []arrow.RecordBatch
+ for fr.Next() {
+ rec := fr.RecordBatch()
+ rec.Retain()
+ defer rec.Release()
+ recs = append(recs, rec)
+ }
+ s.Require().NoError(fr.Err())
+ tbl := array.NewTableFromRecords(fr.Schema(), recs)
+ defer tbl.Release()
+ s.Assert().Equal(int64(2), tbl.NumRows())
+ s.Assert().Equal(int64(1), tbl.NumCols())
+ col := tbl.Column(0)
+ s.Assert().Equal("t1", col.Name())
+ s.Assert().Equal(2, col.Len())
+ s.Assert().Equal(1, col.NullN())
+ s.Assert().Equal(arrow.INT16, col.DataType().ID())
+ var n int
+ for _, arr := range col.Data().Chunks() {
+ data := array.NewInt16Data(arr.Data())
+ defer data.Release()
+ for i := 0; i < data.Len(); i++ {
+ switch n {
+ case 0:
+ s.True(data.IsNull(i))
+ case 1:
+ s.False(data.IsNull(i))
+ s.Assert().Equal(int16(1), data.Value(i))
+ }
+ n++
+ }
+ }
+}
+
+func (s *FlightSqlServerSuite) TestExecutePreparedStatementUpdate() {
Review Comment:
1. About the Substrait path: I added server-side tests at
271a2095410cbd12e232dcc23beb7f680c2338a4
I don't actually execute the queries because, apart from Prepared Statement
creation, Substrait and SQL have the exact same execution path in Flight SQL,
the difference is only in how the query is sent. Executing the queries would
just be exercising the same code path unnecessarily.
I note that I didn't find any client-side tests for Substrait, and I think
if we need them then they should go in a separate issue/PR. Do you agree?
2. Yeah, the cleanups outside my own tests were a Find->Replace mistake: I
was trying to fix my own tests and did not realize I changed other ones. I'll
be more careful next time.
--
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]