Skip to content

feat(go/adbc): implement ADBC 1.1.0 features - #700

Merged
lidavidm merged 1 commit into
apache:spec-1.1.0from
lidavidm:spec-1.1.0-execute-schema
Jul 11, 2023
Merged

feat(go/adbc): implement ADBC 1.1.0 features#700
lidavidm merged 1 commit into
apache:spec-1.1.0from
lidavidm:spec-1.1.0-execute-schema

Conversation

@lidavidm

@lidavidmlidavidm commented May 23, 2023

Copy link
Copy Markdown
Member

@lidavidm
lidavidmforce-pushed the spec-1.1.0-execute-schema branch from 61e2aac to 5aa6a92CompareJune 23, 2023 18:39
@lidavidm
lidavidm marked this pull request as ready for review June 23, 2023 18:39
@lidavidm
lidavidm requested a review from zeroshade as a code ownerJune 23, 2023 18:39
@lidavidm
lidavidmforce-pushed the spec-1.1.0-execute-schema branch 2 times, most recently from 23066de to e5371a9CompareJune 28, 2023 16:36
return nil
}

func (d *database) GetOption(key string) (string, error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we want to default implement this with all the options that are accepted in SetOptions?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yeah, I'm actually working on that now, for this and the Snowflake driver. I was originally going to do one PR per feature but at this rate it's just going to be a mega PR.

@lidavidm
lidavidmforce-pushed the spec-1.1.0-execute-schema branch from e5371a9 to f6aa17bCompareJune 28, 2023 21:59
@lidavidmlidavidm changed the title feat(go/adbc/driver/flightsql): add StatementExecuteSchemafeat(go/adbc): implement 1.1.0 featuresJun 29, 2023
@lidavidmlidavidm changed the title feat(go/adbc): implement 1.1.0 featuresfeat(go/adbc): implement ADBC 1.1.0 featuresJun 29, 2023
@lidavidm
lidavidmforce-pushed the spec-1.1.0-execute-schema branch 2 times, most recently from 3963459 to 6c9cc86CompareJune 29, 2023 16:45
@lidavidm

Copy link
Copy Markdown
MemberAuthor

Updated:

  • Tweaks to adbc.go
  • Get/SetOption
  • Implement error details for the Flight SQL driver, allowing Flight SQL servers to return custom, rich error metadata for clients that know how to parse it

@lidavidm

Copy link
Copy Markdown
MemberAuthor

I think I might remove the Cancellable interface from Go, since we already have context.Context. Instead, I'll have the FFI bridge track the last context it's using, and it can implement StatementCancel() or ConnectionCancel() based on that.

@lidavidm
lidavidmforce-pushed the spec-1.1.0-execute-schema branch 2 times, most recently from 742af71 to 7f7f11bCompareJune 29, 2023 17:31
@lidavidm

Copy link
Copy Markdown
MemberAuthor

Update:

  • Remove cancellable
  • Add a no-op test of GetStatistics (not really possible to implement for Flight SQL)

@lidavidm
lidavidmforce-pushed the spec-1.1.0-execute-schema branch from 7f7f11b to 237f2f0CompareJune 29, 2023 18:29
@lidavidm

Copy link
Copy Markdown
MemberAuthor

OK, I think things are generally complete here (except for the XDBC info). If this is good, I'll port it to the driver template as well.

@lidavidm
lidavidmforce-pushed the spec-1.1.0-execute-schema branch from 237f2f0 to e1c6991CompareJuly 10, 2023 12:48
@lidavidm

Copy link
Copy Markdown
MemberAuthor

Updated to fix the GetStatistics schema.

@lidavidm
lidavidm requested a review from zeroshadeJuly 10, 2023 12:48
Comment threadgo/adbc/adbc.go Outdated
// the error message. The encoding of the data is driver-defined. It is
// suggested to use proto.Message for Protocol Buffers and error for wrapped
// errors.
Details []interface{}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why the switch to use interface{} instead of []byte? it's a bit more difficult to convert this to something usable for a C error struct for an interface{}

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

~Mostly so that we could keep strong typing for things like Protobufs, otherwise we would be forced to serialize them here. I'm sort of ambivalent here.

While working on Java, I also made this an array of key-value pairs; I plan to port that change here too.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

So would [](pair of key, []byte) be preferable?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you can use the proto.Message interface potentially and then just serialize them later when necessary?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I don't want to elevate gRPC too much, though

Comment threadgo/adbc/driver/flightsql/flightsql_adbc.go Outdated
Comment threadgo/adbc/driver/flightsql/flightsql_adbc.go Outdated
Comment threadgo/adbc/driver/flightsql/flightsql_adbc.go Outdated
@lidavidm

Copy link
Copy Markdown
MemberAuthor

Is the shape of the API reasonable? I'd like to tackle the FFI bridge soon

Comment threadgo/adbc/driver/flightsql/utils.go Outdated
Msg: err.Error(),
Code: adbcCode,
// slice of proto.Message or error
Details: grpcStatus.Details(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it looks like the details themselves are effectively proto.Message interfaces that we could leverage?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yes, that's why I made it interface{} so we can easily return them directly without forcing apps to serialize/deserialize them

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ideally i'd prefer to be explicit on the interface type and use proto.Message rather than interface{}

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Trying to wrap this up, now it's behind an interface with wrappers for Protobuf messages.

@lidavidm
lidavidmforce-pushed the spec-1.1.0-execute-schema branch 2 times, most recently from 8a14461 to 1c6cab9CompareJuly 10, 2023 16:48
- ADBC_INFO_DRIVER_ADBC_VERSION
- StatementExecuteSchema (apache#318)
- ADBC_CONNECTION_OPTION_CURRENT_{CATALOG, DB_SCHEMA} (apache#319)
- Get/SetOption
- error_details (apache#755)
- GetStatistics (apache#685)
- New ingest modes (apache#541)
@lidavidm
lidavidmforce-pushed the spec-1.1.0-execute-schema branch from 1c6cab9 to 3466e2eCompareJuly 10, 2023 17:31
@lidavidm

Copy link
Copy Markdown
MemberAuthor

If this looks reasonable, I'd like to merge then start on updating driver.go.tmpl

@lidavidm
lidavidm merged commit e9795d3 into apache:spec-1.1.0Jul 11, 2023
@lidavidm
lidavidm deleted the spec-1.1.0-execute-schema branch July 11, 2023 16:50
lidavidm added a commit that referenced this pull request Jul 11, 2023
- ADBC_INFO_DRIVER_ADBC_VERSION
- StatementExecuteSchema (#318)
- ADBC_CONNECTION_OPTION_CURRENT_{CATALOG, DB_SCHEMA} (#319)
- Get/SetOption
- error_details (#755)
- GetStatistics (#685)
- New ingest modes (#541)
lidavidm added a commit that referenced this pull request Jul 20, 2023
- ADBC_INFO_DRIVER_ADBC_VERSION
- StatementExecuteSchema (#318)
- ADBC_CONNECTION_OPTION_CURRENT_{CATALOG, DB_SCHEMA} (#319)
- Get/SetOption
- error_details (#755)
- GetStatistics (#685)
- New ingest modes (#541)
lidavidm added a commit that referenced this pull request Jul 21, 2023
- ADBC_INFO_DRIVER_ADBC_VERSION
- StatementExecuteSchema (#318)
- ADBC_CONNECTION_OPTION_CURRENT_{CATALOG, DB_SCHEMA} (#319)
- Get/SetOption
- error_details (#755)
- GetStatistics (#685)
- New ingest modes (#541)
lidavidm added a commit that referenced this pull request Jul 21, 2023
- ADBC_INFO_DRIVER_ADBC_VERSION
- StatementExecuteSchema (#318)
- ADBC_CONNECTION_OPTION_CURRENT_{CATALOG, DB_SCHEMA} (#319)
- Get/SetOption
- error_details (#755)
- GetStatistics (#685)
- New ingest modes (#541)
lidavidm added a commit that referenced this pull request Aug 3, 2023
- ADBC_INFO_DRIVER_ADBC_VERSION
- StatementExecuteSchema (#318)
- ADBC_CONNECTION_OPTION_CURRENT_{CATALOG, DB_SCHEMA} (#319)
- Get/SetOption
- error_details (#755)
- GetStatistics (#685)
- New ingest modes (#541)
lidavidm added a commit that referenced this pull request Aug 10, 2023
- ADBC_INFO_DRIVER_ADBC_VERSION
- StatementExecuteSchema (#318)
- ADBC_CONNECTION_OPTION_CURRENT_{CATALOG, DB_SCHEMA} (#319)
- Get/SetOption
- error_details (#755)
- GetStatistics (#685)
- New ingest modes (#541)
lidavidm added a commit that referenced this pull request Aug 10, 2023
- ADBC_INFO_DRIVER_ADBC_VERSION
- StatementExecuteSchema (#318)
- ADBC_CONNECTION_OPTION_CURRENT_{CATALOG, DB_SCHEMA} (#319)
- Get/SetOption
- error_details (#755)
- GetStatistics (#685)
- New ingest modes (#541)
lidavidm added a commit that referenced this pull request Aug 10, 2023
- ADBC_INFO_DRIVER_ADBC_VERSION
- StatementExecuteSchema (#318)
- ADBC_CONNECTION_OPTION_CURRENT_{CATALOG, DB_SCHEMA} (#319)
- Get/SetOption
- error_details (#755)
- GetStatistics (#685)
- New ingest modes (#541)
lidavidm added a commit that referenced this pull request Aug 28, 2023
- ADBC_INFO_DRIVER_ADBC_VERSION
- StatementExecuteSchema (#318)
- ADBC_CONNECTION_OPTION_CURRENT_{CATALOG, DB_SCHEMA} (#319)
- Get/SetOption
- error_details (#755)
- GetStatistics (#685)
- New ingest modes (#541)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants

@lidavidm@zeroshade