Skip to content

Commit

Permalink
feat(go/adbc): implement 1.1.0 features
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
lidavidm committed Jul 10, 2023
1 parent 5d6586b commit 8a14461
Show file tree
Hide file tree
Showing 15 changed files with 1,480 additions and 150 deletions.
1 change: 1 addition & 0 deletions .github/workflows/native-unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ jobs:
popd
- name: Go Test
env:
SNOWFLAKE_DATABASE: ADBC_TESTING
SNOWFLAKE_URI: ${{ secrets.SNOWFLAKE_URI }}
run: |
./ci/scripts/go_test.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
Expand Down
2 changes: 1 addition & 1 deletion adbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ AdbcStatusCode AdbcConnectionGetOptionDouble(struct AdbcConnection* connection,
/// | Field Name | Field Type |
/// |--------------------------|----------------------------------|
/// | db_schema_name | utf8 |
/// | db_schema_functions | list<STATISTICS_SCHEMA> |
/// | db_schema_statistics | list<STATISTICS_SCHEMA> |
///
/// STATISTICS_SCHEMA is a Struct with fields:
///
Expand Down
35 changes: 11 additions & 24 deletions go/adbc/adbc.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ type Error struct {
// SqlState is a SQLSTATE error code, if provided, as defined
// by the SQL:2003 standard. If not set, it will be "\0\0\0\0\0"
SqlState [5]byte
// Details is an array of additional driver-specific binary error details.
// Details is an array of additional driver-specific error details.
//
// This allows drivers to return custom, structured error information (for
// example, JSON or Protocol Buffers) that can be optionally parsed by
// clients, beyond the standard Error fields, without having to encode it in
// the error message. The encoding of the data is driver-defined.
Details [][]byte
// 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{}
}

func (e Error) Error() string {
Expand Down Expand Up @@ -621,23 +623,6 @@ type Statement interface {
ExecutePartitions(context.Context) (*arrow.Schema, Partitions, int64, error)
}

// Cancellable is a Connection or Statement that also supports Cancel.
//
// Since ADBC API revision 1.1.0.
type Cancellable interface {
// Cancel stops execution of an in-progress query.
//
// This can be called during ExecuteQuery, GetObjects, or other
// methods that produce result sets, or while consuming a
// RecordReader returned from such. Calling this function should
// make the other functions return an error with a StatusCancelled
// code.
//
// This must always be thread-safe (other operations are not
// necessarily thread-safe).
Cancel() error
}

// ConnectionGetStatistics is a Connection that supports getting
// statistics on data in the database.
//
Expand All @@ -657,7 +642,7 @@ type ConnectionGetStatistics interface {
// Field Name | Field Type
// -------------------------|----------------------------------
// db_schema_name | utf8
// db_schema_functions | list<STATISTICS_SCHEMA>
// db_schema_statistics | list<STATISTICS_SCHEMA>
//
// STATISTICS_SCHEMA is a Struct with fields:
//
Expand All @@ -684,7 +669,6 @@ type ConnectionGetStatistics interface {
// int64 | int64
// uint64 | uint64
// float64 | float64
// decimal256 | decimal256
// binary | binary
//
// For the parameters: If nil is passed, then that parameter will not
Expand Down Expand Up @@ -719,7 +703,10 @@ type StatementExecuteSchema interface {
ExecuteSchema(context.Context) (*arrow.Schema, error)
}

// GetSetOptions is a PostInitOptions that also supports getting and setting property values of different types.
// GetSetOptions is a PostInitOptions that also supports getting and setting option values of different types.
//
// GetOption functions should return an error with StatusNotFound for unsupported options.
// SetOption functions should return an error with StatusNotImplemented for unsupported options.
//
// Since ADBC API revision 1.1.0.
type GetSetOptions interface {
Expand All @@ -728,7 +715,7 @@ type GetSetOptions interface {
SetOptionBytes(key string, value []byte) error
SetOptionInt(key string, value int64) error
SetOptionDouble(key string, value float64) error
GetOption(key, value string) (string, error)
GetOption(key string) (string, error)
GetOptionBytes(key string) ([]byte, error)
GetOptionInt(key string) (int64, error)
GetOptionDouble(key string) (float64, error)
Expand Down
Loading

0 comments on commit 8a14461

Please sign in to comment.