Skip to content

Conversation

@jasonlin45
Copy link
Contributor

@jasonlin45 jasonlin45 commented Aug 21, 2025

This PR is a continuation of #2998

Key changes from Jade's PR:

  • sql.DB has been pushed up to Database as a stored connection pool
  • Connections are no longer pooled on adbc Connections - the raw connection is persisted
  • Bind and BindStream are marked as todo rather than partial implementations
  • Redundant tests have been cleaned up
  • Reference counting was implemented on the custom IPC reader which was causing readers to be prematurely destroyed before consumption

Connection Pooling
Databricks offers a sql.DB struct which manages a connection pool. This is now initialized on the ADBC Database struct when connections are opened and re-used if no options have changed on the Database.

Connections can be obtained from the pool which are stored on the ADBC Connection.

@jasonlin45 jasonlin45 changed the title [wip] Databricks driver, continuation of Jade's work feat(go/adbc) Initial Databricks Driver - Continuation of Jade's PR Aug 21, 2025
@jasonlin45 jasonlin45 marked this pull request as ready for review August 21, 2025 16:37
@jasonlin45 jasonlin45 requested a review from zeroshade as a code owner August 21, 2025 16:37
@github-actions github-actions bot added this to the ADBC Libraries 20 milestone Aug 21, 2025
@jasonlin45 jasonlin45 changed the title feat(go/adbc) Initial Databricks Driver - Continuation of Jade's PR feat(go/adbc): Initial Databricks Driver - Continuation of Jade's PR Aug 21, 2025
Copy link
Contributor

@felipecrv felipecrv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still need to review statement.go and driver.go.

// Transaction methods (Databricks has limited transaction support)
func (c *connectionImpl) Commit(ctx context.Context) error {
// Databricks SQL doesn't support explicit transactions in the traditional sense.
// Most operations are auto-committed. We'll track state but not perform any operation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Most operations are auto-committed. We'll track state but not perform any operation.
// Most operations are auto-committed.

@jasonlin45 jasonlin45 requested a review from felipecrv August 28, 2025 18:37
Copy link
Contributor

@felipecrv felipecrv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zeroshade can you give a quick look to this? I'm sure we will find bugs when we start using it, but we will surely follow up with fixes as we identify problems.

@jasonlin45 jasonlin45 requested a review from lidavidm September 16, 2025 00:39
@jasonlin45
Copy link
Contributor Author

@lidavidm Thanks for the in depth review! I just applied the following changes:

  • Removed redundant test files
  • Switched to validation.CheckedClose wherever possible
  • Escaped identifiers and literals wherever they are being passed as raw values and patterns

Comment on lines 166 to 184
if d.sslMode != "" {
switch strings.ToLower(d.sslMode) {
case "insecure":
if tlsConfig == nil {
tlsConfig = &tls.Config{MinVersion: tls.VersionTLS12}
}
tlsConfig.InsecureSkipVerify = true
case "require":
// Default behavior - full TLS verification
if tlsConfig == nil {
tlsConfig = &tls.Config{MinVersion: tls.VersionTLS12}
}
default:
return nil, adbc.Error{
Code: adbc.StatusInvalidArgument,
Msg: fmt.Sprintf("invalid SSL mode: %s (supported: 'require', 'insecure')", d.sslMode),
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, move this to SetOptions instead of here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved in 3f29df5

Comment on lines +99 to +105
// TODO: Prepared statement support with raw connections
if s.prepared != nil {
return nil, -1, adbc.Error{
Code: adbc.StatusNotImplemented,
Msg: "Prepared statements are not yet supported via `execute query`",
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't require a prepared statement here. If we have one, then use it, otherwise use s.query.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the same logic as at line 172

Copy link
Contributor Author

@jasonlin45 jasonlin45 Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we are?

if s.prepared != nil

This errors if a prepared statement DOES exist, otherwise it uses the set query

@jasonlin45 jasonlin45 requested a review from zeroshade October 21, 2025 17:57
Copy link
Member

@zeroshade zeroshade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good to me so far other than the above questions

Any further comments @lidavidm ?

Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

staticcheck/pre-commit need to be satisfied.

github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.4.0 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/andybalholm/brotli v1.2.0 // indirect
github.com/apache/arrow/go/v12 v12.0.1 // indirect
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...Does databricks not use the latest arrow-go? 🙁

Any chance that can be fixed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great callout - I just went to the latest dependencies on databricks-sql-go and it looks to be v12.0.1 for latest v1.8.0.

https://github.com/databricks/databricks-sql-go/blob/v1.8.0/go.mod#L6

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jadewang-db perhaps this can be updated on the SDK side for upcoming v1.9.0?

Comment on lines 145 to 149
defer func() {
if closeErr := rows.Close(); closeErr != nil {
err = errors.Join(err, closeErr)
}
}()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value still needs to be named.

@jasonlin45 jasonlin45 requested a review from lidavidm October 23, 2025 16:25
@jasonlin45
Copy link
Contributor Author

@lidavidm Please take a look again when you get the chance! pre-commit should be green now

@felipecrv
Copy link
Contributor

I'm going to merge it based on the 2 approvals and the fact that the CI failure is unrelated.

@felipecrv felipecrv changed the title feat(go/adbc): add initial Databricks driver feat(go/adbc/driver/databricks): Add Databrikcs driver written in Go Oct 24, 2025
@felipecrv felipecrv merged commit 990c67d into apache:main Oct 24, 2025
35 of 44 checks passed
@jasonlin45 jasonlin45 changed the title feat(go/adbc/driver/databricks): Add Databrikcs driver written in Go feat(go/adbc/driver/databricks): Add Databricks driver written in Go Oct 28, 2025
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.

5 participants