Conversation
Contributor
Author
|
@amoeba see adbc-drivers/trino#86 and adbc-drivers/trino#84 for context here |
There was a problem hiding this comment.
Pull request overview
This PR refactors sqlwrapper’s statement implementation to be extensible by downstream drivers, enabling driver-specific statement wrappers (via a statement factory) and allowing drivers to inject additional Exec/Query parameters.
Changes:
- Introduces a new
StatementImplinterface plusStatementImplBasewrapper to support customizable statement implementations. - Adds
StatementFactoryand plumbing (Driver.WithStatementFactory,databaseImpl.stmtFactory,ConnectionImplBase.dbImpl) to construct custom statements. - Propagates driver-provided “additional exec params” into update/query execution paths and the record reader.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| sqlwrapper/statement.go | Reworks statement implementation into an extensible base + interface, wires in statement factory, and threads additional exec params through execution/bulk ingest paths. |
| sqlwrapper/record_reader.go | Adds support for appending driver-provided additional exec params when executing queries. |
| sqlwrapper/driver.go | Adds StatementFactory support to the driver and passes it into databaseImpl. |
| sqlwrapper/connection.go | Stores a pointer to databaseImpl on connections and updates statement construction to return an error. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+106
to
+117
| var impl StatementImpl | ||
| if c.dbImpl.stmtFactory != nil { | ||
| var err error | ||
| impl, err = c.dbImpl.stmtFactory.CreateStatement(wrapper) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| } else { | ||
| impl = wrapper | ||
| } | ||
| wrapper.Derived = impl | ||
| return driverbase.NewStatement(impl), nil |
Comment on lines
152
to
+156
| size, err := strconv.Atoi(val) | ||
| if err != nil { | ||
| return s.Base().ErrorHelper.InvalidArgument("invalid batch size: %v", err) | ||
| } | ||
| return s.SetBatchSize(size) | ||
| return s.SetBatchSize(int64(size)) |
Comment on lines
526
to
528
| quotedTableName := ingester.QuoteIdentifier(options.TableName) | ||
| params := stmtImpl.GetAdditionalExecParams() | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.