Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

lidavidm
Copy link
Member

@lidavidm lidavidm commented May 23, 2023

Code: adbc.StatusInvalidArgument,
}
}

return nil
}

func (d *database) GetOption(key string) (string, error) {
Copy link
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
Member Author

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 lidavidm changed the title feat(go/adbc/driver/flightsql): add StatementExecuteSchema feat(go/adbc): implement 1.1.0 features Jun 29, 2023
@lidavidm lidavidm changed the title feat(go/adbc): implement 1.1.0 features feat(go/adbc): implement ADBC 1.1.0 features Jun 29, 2023
@lidavidm lidavidm force-pushed the spec-1.1.0-execute-schema branch 2 times, most recently from 3963459 to 6c9cc86 Compare June 29, 2023 16:45
@lidavidm
Copy link
Member Author

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
Member Author

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 lidavidm force-pushed the spec-1.1.0-execute-schema branch 2 times, most recently from 742af71 to 7f7f11b Compare June 29, 2023 17:31
@lidavidm
Copy link
Member Author

Update:

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

@lidavidm
Copy link
Member Author

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
Copy link
Member Author

Updated to fix the GetStatistics schema.

@lidavidm lidavidm requested a review from zeroshade July 10, 2023 12:48
go/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
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
Member Author

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
Member Author

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
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
Member Author

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

@lidavidm
Copy link
Member Author

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

@@ -71,5 +73,7 @@ func adbcFromFlightStatus(err error) error {
return adbc.Error{
Msg: err.Error(),
Code: adbcCode,
// slice of proto.Message or error
Details: grpcStatus.Details(),
Copy link
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
Member Author

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
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
Member Author

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 lidavidm force-pushed the spec-1.1.0-execute-schema branch 2 times, most recently from 8a14461 to 1c6cab9 Compare July 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
Copy link
Member Author

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.0 Jul 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 free to 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