zeroshade commented on code in PR #3808:
URL: https://github.com/apache/arrow-adbc/pull/3808#discussion_r2659796945
##########
go/adbc/driver/flightsql/flightsql_statement.go:
##########
@@ -360,6 +380,53 @@ func (s *statement) SetOption(key string, val string)
error {
Code: adbc.StatusInvalidArgument,
}
}
+ case adbc.OptionKeyIngestTargetTable:
+ if s.prepared != nil {
+ if err := s.closePreparedStatement(); err != nil {
+ return err
+ }
+ s.prepared = nil
+ }
+ s.query.sqlQuery = ""
+ s.query.substraitPlan = nil
+ s.targetTable = val
+ case adbc.OptionKeyIngestMode:
+ switch val {
+ case adbc.OptionValueIngestModeCreate,
+ adbc.OptionValueIngestModeAppend,
+ adbc.OptionValueIngestModeReplace,
+ adbc.OptionValueIngestModeCreateAppend:
+ s.ingestMode = val
+ default:
+ return adbc.Error{
+ Msg: fmt.Sprintf("[Flight SQL] Invalid ingest
mode '%s'", val),
+ Code: adbc.StatusInvalidArgument,
+ }
+ }
+ case adbc.OptionValueIngestTargetCatalog:
Review Comment:
We only clean up the existing stuff if target table is set? Not the other
options?
##########
go/adbc/driver/flightsql/flightsql_statement.go:
##########
@@ -540,6 +633,22 @@ func (s *statement) Bind(_ context.Context, values
arrow.RecordBatch) error {
// The driver will call Release on the record reader, but may not do this
// until Close is called.
func (s *statement) BindStream(_ context.Context, stream array.RecordReader)
error {
+ // For bulk ingest, bind to the statement
+ if s.targetTable != "" {
+ if s.bound != nil {
+ s.bound.Release()
+ s.bound = nil
+ }
+ if s.streamBind != nil {
+ s.streamBind.Release()
+ }
+ s.streamBind = stream
+ if s.streamBind != nil {
+ s.streamBind.Retain()
+ }
+ return nil
+ }
+
Review Comment:
Should the error below be updated to say must call prepare *or* set
IngestTargetTable to bind?
--
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]