lidavidm commented on code in PR #3808:
URL: https://github.com/apache/arrow-adbc/pull/3808#discussion_r2652007404


##########
go/adbc/driver/flightsql/flightsql_statement.go:
##########
@@ -360,6 +380,48 @@ func (s *statement) SetOption(key string, val string) 
error {
                                Code: adbc.StatusInvalidArgument,
                        }
                }
+       case adbc.OptionKeyIngestTargetTable:
+               s.prepared = nil

Review Comment:
   Use `s.closePreparedStatement`



##########
go/adbc/driver/flightsql/flightsql_adbc_server_test.go:
##########
@@ -2692,3 +2696,404 @@ func (suite *GetObjectsTests) 
TestMetadataGetObjectsColumnsXdbc() {
                })
        }
 }
+
+// ---- Bulk Ingest Tests --------------------
+
+// BulkIngestTestServer implements a FlightSQL server that supports bulk 
ingestion
+type BulkIngestTestServer struct {
+       flightsql.BaseServer
+
+       mu             sync.Mutex
+       ingestedData   []arrow.RecordBatch
+       ingestRequests []flightsql.StatementIngest
+}
+
+func (srv *BulkIngestTestServer) DoPutCommandStatementIngest(ctx 
context.Context, cmd flightsql.StatementIngest, rdr flight.MessageReader) 
(int64, error) {
+       srv.mu.Lock()
+       defer srv.mu.Unlock()
+
+       // Store the ingest request for validation
+       srv.ingestRequests = append(srv.ingestRequests, cmd)
+
+       var totalRows int64
+       for rdr.Next() {
+               rec := rdr.RecordBatch()
+               rec.Retain()
+               srv.ingestedData = append(srv.ingestedData, rec)
+               totalRows += rec.NumRows()
+       }
+
+       if err := rdr.Err(); err != nil {
+               return -1, err
+       }
+
+       return totalRows, nil
+}
+
+func (srv *BulkIngestTestServer) GetIngestedData() []arrow.RecordBatch {
+       srv.mu.Lock()
+       defer srv.mu.Unlock()
+       return srv.ingestedData
+}
+
+func (srv *BulkIngestTestServer) GetIngestRequests() 
[]flightsql.StatementIngest {
+       srv.mu.Lock()
+       defer srv.mu.Unlock()
+       return srv.ingestRequests
+}

Review Comment:
   Ditto here



##########
go/adbc/driver/flightsql/flightsql_adbc_server_test.go:
##########
@@ -2692,3 +2696,404 @@ func (suite *GetObjectsTests) 
TestMetadataGetObjectsColumnsXdbc() {
                })
        }
 }
+
+// ---- Bulk Ingest Tests --------------------
+
+// BulkIngestTestServer implements a FlightSQL server that supports bulk 
ingestion
+type BulkIngestTestServer struct {
+       flightsql.BaseServer
+
+       mu             sync.Mutex
+       ingestedData   []arrow.RecordBatch
+       ingestRequests []flightsql.StatementIngest
+}
+
+func (srv *BulkIngestTestServer) DoPutCommandStatementIngest(ctx 
context.Context, cmd flightsql.StatementIngest, rdr flight.MessageReader) 
(int64, error) {
+       srv.mu.Lock()
+       defer srv.mu.Unlock()
+
+       // Store the ingest request for validation
+       srv.ingestRequests = append(srv.ingestRequests, cmd)
+
+       var totalRows int64
+       for rdr.Next() {
+               rec := rdr.RecordBatch()
+               rec.Retain()
+               srv.ingestedData = append(srv.ingestedData, rec)
+               totalRows += rec.NumRows()
+       }
+
+       if err := rdr.Err(); err != nil {
+               return -1, err
+       }
+
+       return totalRows, nil
+}
+
+func (srv *BulkIngestTestServer) GetIngestedData() []arrow.RecordBatch {
+       srv.mu.Lock()
+       defer srv.mu.Unlock()
+       return srv.ingestedData
+}

Review Comment:
   The lock doesn't really do anything here unless you also copy the slice



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