Skip to content

fix(go/adbc/drivermgr): adjust ingest helper to set target before BindStream#4308

Open
arnoldwakim wants to merge 1 commit intoapache:mainfrom
arnoldwakim:fix/go-adbc-ingest-helper
Open

fix(go/adbc/drivermgr): adjust ingest helper to set target before BindStream#4308
arnoldwakim wants to merge 1 commit intoapache:mainfrom
arnoldwakim:fix/go-adbc-ingest-helper

Conversation

@arnoldwakim
Copy link
Copy Markdown

Summary

Reorder IngestStream and IngestStreamContext to set OptionKeyIngestTargetTable and OptionKeyIngestMode before calling BindStream, matching drivers that require ingest targets up front (e.g., FlightSQL).

Keep all other ingest option handling and execution flow unchanged.

Evidence (FlightSQL requirement):

go/adbc/driver/flightsql/flightsql_statement.go:630-656:

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
	}

	if s.prepared == nil {
		return adbc.Error{
			Msg:  "[Flight SQL Statement] must call Prepare or set IngestTargetTable before calling Bind",
			Code: adbc.StatusInvalidState}
	}

	// calls retain
	s.prepared.SetRecordReader(stream)
	return nil
}

The current non-patched code, raises the error:

[Flight SQL Statement] must call Prepare or set IngestTargetTable before calling Bind

@arnoldwakim arnoldwakim requested a review from zeroshade as a code owner May 10, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants