ennuite commented on code in PR #732:
URL: https://github.com/apache/arrow-go/pull/732#discussion_r3887902534


##########
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:
   I opened a separate issue at https://github.com/apache/arrow-go/issues/1267 
just to make sure it is tracked.



-- 
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]

Reply via email to