zeroshade commented on code in PR #1457:
URL: https://github.com/apache/arrow-adbc/pull/1457#discussion_r1459695127


##########
go/adbc/driver/flightsql/flightsql_statement.go:
##########
@@ -485,13 +530,91 @@ func (s *statement) ExecutePartitions(ctx 
context.Context) (*arrow.Schema, adbc.
 
        var (
                info *flight.FlightInfo
+               poll *flight.PollInfo
                out  adbc.Partitions
                sc   *arrow.Schema
                err  error
        )
 
        var header, trailer metadata.MD
-       if s.prepared != nil {
+       if s.incrementalState != nil {
+               if s.incrementalState.complete {
+                       schema := s.incrementalState.schema
+                       totalRecords := 
s.incrementalState.previousInfo.TotalRecords
+                       // Reset the statement for reuse
+                       s.incrementalState = &incrementalState{}
+                       s.progress = 0.0
+                       return schema, adbc.Partitions{}, totalRecords, nil
+               }
+
+               backoff := 100 * time.Millisecond
+               for {
+                       // Keep polling until the query completes or we get new 
partitions
+                       if s.prepared != nil {
+                               poll, err = s.prepared.ExecutePoll(ctx, 
s.incrementalState.retryDescriptor, grpc.Header(&header), 
grpc.Trailer(&trailer), s.timeouts)
+                       } else {
+                               poll, err = s.query.poll(ctx, s.cnxn, 
s.incrementalState.retryDescriptor, grpc.Header(&header), 
grpc.Trailer(&trailer), s.timeouts)
+                       }

Review Comment:
   It feels like this would be better as a helper method on `s` to make this 
easier to read



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