From f13db15983e981935617821f252444b5beb3bffb Mon Sep 17 00:00:00 2001 From: Joel Lubinitsky Date: Wed, 20 Mar 2024 11:48:47 -0400 Subject: [PATCH 01/12] feat(format): add info codes for supported capabilities --- adbc.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/adbc.h b/adbc.h index 1ec2f05080..1c91dbbe74 100644 --- a/adbc.h +++ b/adbc.h @@ -459,6 +459,28 @@ const struct AdbcError* AdbcErrorFromArrayStream(struct ArrowArrayStream* stream /// /// \see AdbcConnectionGetInfo #define ADBC_INFO_VENDOR_ARROW_VERSION 2 +/// \brief Whether the driver connection is read only (type: bool). +/// +/// \see AdbcConnectionGetInfo +#define ADBC_INFO_VENDOR_READ_ONLY 3 +/// \brief Indicates whether SQL queries are supported (type: bool). +/// +/// \see AdbcConnectionGetInfo +#define ADBC_INFO_VENDOR_SQL 4 +/// \brief Indicates whether Substrait queries are supported (type: bool). +/// +/// \see AdbcConnectionGetInfo +#define ADBC_INFO_VENDOR_SUBSTRAIT 5 +/// \brief The minimum supported Substrait version, or null if +/// Substrait is not supported (type: utf8). +/// +/// \see AdbcConnectionGetInfo +#define ADBC_INFO_VENDOR_SUBSTRAIT_MIN_VERSION 6 +/// \brief The maximum supported Substrait version, or null if +/// Substrait is not supported (type: utf8). +/// +/// \see AdbcConnectionGetInfo +#define ADBC_INFO_VENDOR_SUBSTRAIT_MAX_VERSION 7 /// \brief The driver name (type: utf8). /// From ce63632cf668f50fcfb3c885f2f9154d7a3ec872 Mon Sep 17 00:00:00 2001 From: Joel Lubinitsky Date: Wed, 20 Mar 2024 22:08:32 -0400 Subject: [PATCH 02/12] add info_codes to adbc.go --- go/adbc/adbc.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/go/adbc/adbc.go b/go/adbc/adbc.go index 6968faacf5..c3a7414b96 100644 --- a/go/adbc/adbc.go +++ b/go/adbc/adbc.go @@ -344,7 +344,16 @@ const ( InfoVendorVersion InfoCode = 1 // VendorVersion // The database vendor/product Arrow library version (type: utf8) InfoVendorArrowVersion InfoCode = 2 // VendorArrowVersion - + // Indicates whether the driver connection is read only (type: bool). + InfoVendorReadOnly InfoCode = 3 + // Indicates whether SQL queries are supported (type: bool). + InfoVendorSql InfoCode = 4 + // Indicates whether Substrait queries are supported (type: bool). + InfoVendorSubstrait InfoCode = 5 + // The minimum supported Substrait version, or null if Substrait is not supported (type: utf8). + InfoVendorSubstraitMinVersion InfoCode = 6 + // The maximum supported Substrait version, or null if Substrait is not supported (type: utf8). + InfoVendorSubstraitMaxVersion InfoCode = 7 // The driver name (type: utf8) InfoDriverName InfoCode = 100 // DriverName // The driver version (type: utf8) From 6c8ce0350b0764ad7d12ea676a4a427f1e99bde1 Mon Sep 17 00:00:00 2001 From: Joel Lubinitsky Date: Wed, 20 Mar 2024 22:09:00 -0400 Subject: [PATCH 03/12] refactor and integrate new info codes with go driverbase and drivers --- .../driver/flightsql/flightsql_adbc_test.go | 2 + .../driver/flightsql/flightsql_connection.go | 51 +++++-- .../driver/flightsql/flightsql_database.go | 6 +- .../driver/internal/driverbase/connection.go | 80 ++++------- .../driver/internal/driverbase/driver_info.go | 128 ++++++------------ .../internal/driverbase/driver_info_test.go | 18 +-- .../driver/internal/driverbase/driver_test.go | 21 +++ .../driver/snowflake/snowflake_database.go | 3 +- go/adbc/validation/validation.go | 4 + 9 files changed, 140 insertions(+), 173 deletions(-) diff --git a/go/adbc/driver/flightsql/flightsql_adbc_test.go b/go/adbc/driver/flightsql/flightsql_adbc_test.go index 07fe9416f3..feab14b79d 100644 --- a/go/adbc/driver/flightsql/flightsql_adbc_test.go +++ b/go/adbc/driver/flightsql/flightsql_adbc_test.go @@ -263,6 +263,8 @@ func (s *FlightSQLQuirks) GetMetadata(code adbc.InfoCode) interface{} { return "sqlite 3" case adbc.InfoVendorArrowVersion: return "16.0.0-SNAPSHOT" + case adbc.InfoVendorReadOnly: + return false } return nil diff --git a/go/adbc/driver/flightsql/flightsql_connection.go b/go/adbc/driver/flightsql/flightsql_connection.go index 83807856ec..96b52661d9 100644 --- a/go/adbc/driver/flightsql/flightsql_connection.go +++ b/go/adbc/driver/flightsql/flightsql_connection.go @@ -134,9 +134,14 @@ func (c *connectionImpl) SetAutocommit(enabled bool) error { } var adbcToFlightSQLInfo = map[adbc.InfoCode]flightsql.SqlInfo{ - adbc.InfoVendorName: flightsql.SqlInfoFlightSqlServerName, - adbc.InfoVendorVersion: flightsql.SqlInfoFlightSqlServerVersion, - adbc.InfoVendorArrowVersion: flightsql.SqlInfoFlightSqlServerArrowVersion, + adbc.InfoVendorName: flightsql.SqlInfoFlightSqlServerName, + adbc.InfoVendorVersion: flightsql.SqlInfoFlightSqlServerVersion, + adbc.InfoVendorArrowVersion: flightsql.SqlInfoFlightSqlServerArrowVersion, + adbc.InfoVendorReadOnly: flightsql.SqlInfoFlightSqlServerReadOnly, + adbc.InfoVendorSql: flightsql.SqlInfoFlightSqlServerSql, + adbc.InfoVendorSubstrait: flightsql.SqlInfoFlightSqlServerSubstrait, + adbc.InfoVendorSubstraitMinVersion: flightsql.SqlInfoFlightSqlServerSubstraitMinVersion, + adbc.InfoVendorSubstraitMaxVersion: flightsql.SqlInfoFlightSqlServerSubstraitMaxVersion, } func doGet(ctx context.Context, cl *flightsql.Client, endpoint *flight.FlightEndpoint, clientCache gcache.Cache, opts ...grpc.CallOption) (rdr *flight.Reader, err error) { @@ -564,21 +569,37 @@ func (c *connectionImpl) PrepareDriverInfo(ctx context.Context, infoCodes []adbc var adbcInfoCode adbc.InfoCode for i := 0; i < int(rec.NumRows()); i++ { - switch flightsql.SqlInfo(field.Value(i)) { - case flightsql.SqlInfoFlightSqlServerName: - adbcInfoCode = adbc.InfoVendorName - case flightsql.SqlInfoFlightSqlServerVersion: - adbcInfoCode = adbc.InfoVendorVersion - case flightsql.SqlInfoFlightSqlServerArrowVersion: - adbcInfoCode = adbc.InfoVendorArrowVersion - default: + + var found bool + idx := int(info.ValueOffset(i)) + flightSqlInfoCode := flightsql.SqlInfo(field.Value(i)) + for infocode := range adbcToFlightSQLInfo { + if adbcToFlightSQLInfo[infocode] == flightSqlInfoCode { + adbcInfoCode = infocode + found = true + break + } + } + + // SqlInfo on the server that does not have an explicit mapping to ADBC is ignored + if !found { continue } - // we know we're only doing string fields here right now - v := info.Field(info.ChildID(i)).(*array.String). - Value(int(info.ValueOffset(i))) - if err := driverInfo.RegisterInfoCode(adbcInfoCode, strings.Clone(v)); err != nil { + var v any + switch arr := info.Field(info.ChildID(i)).(type) { + case *array.String: + v = strings.Clone(arr.Value(idx)) + case *array.Boolean: + v = arr.Value(idx) + default: + return adbc.Error{ + Msg: fmt.Sprintf("unsupported field_type %T for info_value", arr), + Code: adbc.StatusInvalidArgument, + } + } + + if err := driverInfo.RegisterInfoCode(adbcInfoCode, v); err != nil { return err } } diff --git a/go/adbc/driver/flightsql/flightsql_database.go b/go/adbc/driver/flightsql/flightsql_database.go index 9f0848c3f9..21302c2cb1 100644 --- a/go/adbc/driver/flightsql/flightsql_database.go +++ b/go/adbc/driver/flightsql/flightsql_database.go @@ -383,10 +383,8 @@ func getFlightClient(ctx context.Context, loc string, d *databaseImpl, authMiddl target = "unix:" + uri.Path } - driverVersion, ok := d.DatabaseImplBase.DriverInfo.GetInfoDriverVersion() - if !ok { - driverVersion = driverbase.UnknownVersion - } + dv, _ := d.DatabaseImplBase.DriverInfo.GetInfoForInfoCode(adbc.InfoDriverVersion) + driverVersion := dv.(string) dialOpts := append(d.dialOpts.opts, grpc.WithConnectParams(d.timeout.connectParams()), grpc.WithTransportCredentials(creds), grpc.WithUserAgent("ADBC Flight SQL Driver "+driverVersion)) d.Logger.DebugContext(ctx, "new client", "location", loc) diff --git a/go/adbc/driver/internal/driverbase/connection.go b/go/adbc/driver/internal/driverbase/connection.go index fc1fc0d369..10074975b5 100644 --- a/go/adbc/driver/internal/driverbase/connection.go +++ b/go/adbc/driver/internal/driverbase/connection.go @@ -150,65 +150,43 @@ func (base *ConnectionImplBase) GetInfo(ctx context.Context, infoCodes []adbc.In infoValueBldr := bldr.Field(1).(*array.DenseUnionBuilder) strInfoBldr := infoValueBldr.Child(int(adbc.InfoValueStringType)).(*array.StringBuilder) intInfoBldr := infoValueBldr.Child(int(adbc.InfoValueInt64Type)).(*array.Int64Builder) + boolInfoBldr := infoValueBldr.Child(int(adbc.InfoValueBooleanType)).(*array.BooleanBuilder) for _, code := range infoCodes { - switch code { - case adbc.InfoDriverName: - name, ok := base.DriverInfo.GetInfoDriverName() - if !ok { - continue - } - - infoNameBldr.Append(uint32(code)) - infoValueBldr.Append(adbc.InfoValueStringType) - strInfoBldr.Append(name) - case adbc.InfoDriverVersion: - version, ok := base.DriverInfo.GetInfoDriverVersion() - if !ok { - continue - } - - infoNameBldr.Append(uint32(code)) - infoValueBldr.Append(adbc.InfoValueStringType) - strInfoBldr.Append(version) - case adbc.InfoDriverArrowVersion: - arrowVersion, ok := base.DriverInfo.GetInfoDriverArrowVersion() - if !ok { - continue - } + infoNameBldr.Append(uint32(code)) + value, ok := base.DriverInfo.GetInfoForInfoCode(code) + + // We want to return a null value if the info_code requested is set to nil. + // The null value needs a type so we arbitrarily choose string (info_code: 0) + if value == nil { + value = "" + ok = false + } - infoNameBldr.Append(uint32(code)) + switch v := value.(type) { + case string: infoValueBldr.Append(adbc.InfoValueStringType) - strInfoBldr.Append(arrowVersion) - case adbc.InfoDriverADBCVersion: - adbcVersion, ok := base.DriverInfo.GetInfoDriverADBCVersion() - if !ok { - continue + if ok { + strInfoBldr.Append(v) + } else { + strInfoBldr.AppendNull() } - - infoNameBldr.Append(uint32(code)) + case int64: infoValueBldr.Append(adbc.InfoValueInt64Type) - intInfoBldr.Append(adbcVersion) - case adbc.InfoVendorName: - name, ok := base.DriverInfo.GetInfoVendorName() - if !ok { - continue + if ok { + intInfoBldr.Append(v) + } else { + intInfoBldr.AppendNull() } - - infoNameBldr.Append(uint32(code)) - infoValueBldr.Append(adbc.InfoValueStringType) - strInfoBldr.Append(name) - default: - infoNameBldr.Append(uint32(code)) - value, ok := base.DriverInfo.GetInfoForInfoCode(code) - if !ok { - infoValueBldr.AppendNull() - continue + case bool: + infoValueBldr.Append(adbc.InfoValueBooleanType) + if ok { + boolInfoBldr.Append(v) + } else { + boolInfoBldr.AppendNull() } - - // TODO: Handle other custom info types - infoValueBldr.Append(adbc.InfoValueStringType) - strInfoBldr.Append(fmt.Sprint(value)) + default: + return nil, fmt.Errorf("no defined type code for info_value of type %T", v) } } diff --git a/go/adbc/driver/internal/driverbase/driver_info.go b/go/adbc/driver/internal/driverbase/driver_info.go index e68aa16c2c..688eddb42a 100644 --- a/go/adbc/driver/internal/driverbase/driver_info.go +++ b/go/adbc/driver/internal/driverbase/driver_info.go @@ -29,6 +29,21 @@ const ( DefaultInfoDriverADBCVersion = adbc.AdbcVersion1_1_0 ) +var infoValueTypeCodeForInfoCode = map[adbc.InfoCode]adbc.InfoValueTypeCode{ + adbc.InfoVendorName: adbc.InfoValueStringType, + adbc.InfoVendorVersion: adbc.InfoValueStringType, + adbc.InfoVendorArrowVersion: adbc.InfoValueStringType, + adbc.InfoDriverName: adbc.InfoValueStringType, + adbc.InfoDriverVersion: adbc.InfoValueStringType, + adbc.InfoDriverArrowVersion: adbc.InfoValueStringType, + adbc.InfoDriverADBCVersion: adbc.InfoValueInt64Type, + adbc.InfoVendorReadOnly: adbc.InfoValueBooleanType, + adbc.InfoVendorSql: adbc.InfoValueBooleanType, + adbc.InfoVendorSubstrait: adbc.InfoValueBooleanType, + adbc.InfoVendorSubstraitMinVersion: adbc.InfoValueStringType, + adbc.InfoVendorSubstraitMaxVersion: adbc.InfoValueStringType, +} + func DefaultDriverInfo(name string) *DriverInfo { defaultInfoVendorName := name defaultInfoDriverName := fmt.Sprintf("ADBC %s Driver - Go", name) @@ -73,104 +88,37 @@ func (di *DriverInfo) InfoSupportedCodes() []adbc.InfoCode { } func (di *DriverInfo) RegisterInfoCode(code adbc.InfoCode, value any) error { - switch code { - case adbc.InfoVendorName: - if err := ensureType[string](value); err != nil { - return fmt.Errorf("info_code %d: %w", code, err) - } - case adbc.InfoVendorVersion: - if err := ensureType[string](value); err != nil { - return fmt.Errorf("info_code %d: %w", code, err) - } - case adbc.InfoVendorArrowVersion: - if err := ensureType[string](value); err != nil { - return fmt.Errorf("info_code %d: %w", code, err) - } - case adbc.InfoDriverName: - if err := ensureType[string](value); err != nil { - return fmt.Errorf("info_code %d: %w", code, err) - } - case adbc.InfoDriverVersion: - if err := ensureType[string](value); err != nil { - return fmt.Errorf("info_code %d: %w", code, err) + infoValueTypeCode, isStandardInfoCode := infoValueTypeCodeForInfoCode[code] + if !isStandardInfoCode { + di.info[code] = value + return nil + } + + // If it is a standard InfoCode, we make sure to validate its type on write + var err error + switch infoValueTypeCode { + case adbc.InfoValueStringType: + if val, ok := value.(string); !ok { + err = fmt.Errorf("info_code %d: expected info_value %v to be of type %T but found %T", code, value, val, value) } - case adbc.InfoDriverArrowVersion: - if err := ensureType[string](value); err != nil { - return fmt.Errorf("info_code %d: %w", code, err) + case adbc.InfoValueInt64Type: + if val, ok := value.(int64); !ok { + err = fmt.Errorf("info_code %d: expected info_value %v to be of type %T but found %T", code, value, val, value) } - case adbc.InfoDriverADBCVersion: - if err := ensureType[int64](value); err != nil { - return fmt.Errorf("info_code %d: %w", code, err) + case adbc.InfoValueBooleanType: + if val, ok := value.(bool); !ok { + err = fmt.Errorf("info_code %d: expected info_value %v to be of type %T but found %T", code, value, val, value) } } - di.info[code] = value - return nil + if err == nil { + di.info[code] = value + } + + return err } func (di *DriverInfo) GetInfoForInfoCode(code adbc.InfoCode) (any, bool) { val, ok := di.info[code] return val, ok } - -func (di *DriverInfo) GetInfoVendorName() (string, bool) { - return di.getStringInfoCode(adbc.InfoVendorName) -} - -func (di *DriverInfo) GetInfoVendorVersion() (string, bool) { - return di.getStringInfoCode(adbc.InfoVendorVersion) -} - -func (di *DriverInfo) GetInfoVendorArrowVersion() (string, bool) { - return di.getStringInfoCode(adbc.InfoVendorArrowVersion) -} - -func (di *DriverInfo) GetInfoDriverName() (string, bool) { - return di.getStringInfoCode(adbc.InfoDriverName) -} - -func (di *DriverInfo) GetInfoDriverVersion() (string, bool) { - return di.getStringInfoCode(adbc.InfoDriverVersion) -} - -func (di *DriverInfo) GetInfoDriverArrowVersion() (string, bool) { - return di.getStringInfoCode(adbc.InfoDriverArrowVersion) -} - -func (di *DriverInfo) GetInfoDriverADBCVersion() (int64, bool) { - return di.getInt64InfoCode(adbc.InfoDriverADBCVersion) -} - -func (di *DriverInfo) getStringInfoCode(code adbc.InfoCode) (string, bool) { - val, ok := di.GetInfoForInfoCode(code) - if !ok { - return "", false - } - - if err := ensureType[string](val); err != nil { - panic(err) - } - - return val.(string), true -} - -func (di *DriverInfo) getInt64InfoCode(code adbc.InfoCode) (int64, bool) { - val, ok := di.GetInfoForInfoCode(code) - if !ok { - return int64(0), false - } - - if err := ensureType[int64](val); err != nil { - panic(err) - } - - return val.(int64), true -} - -func ensureType[T any](value any) error { - typedVal, ok := value.(T) - if !ok { - return fmt.Errorf("expected info_value %v to be of type %T but found %T", value, typedVal, value) - } - return nil -} diff --git a/go/adbc/driver/internal/driverbase/driver_info_test.go b/go/adbc/driver/internal/driverbase/driver_info_test.go index 2bad25d056..c4b79ba3fd 100644 --- a/go/adbc/driver/internal/driverbase/driver_info_test.go +++ b/go/adbc/driver/internal/driverbase/driver_info_test.go @@ -18,7 +18,6 @@ package driverbase_test import ( - "strings" "testing" "github.com/apache/arrow-adbc/go/adbc" @@ -45,11 +44,11 @@ func TestDriverInfo(t *testing.T) { require.ElementsMatch(t, expectedDefaultInfoCodes, driverInfo.InfoSupportedCodes()) // We get some formatted default values out of the box - vendorName, ok := driverInfo.GetInfoVendorName() + vendorName, ok := driverInfo.GetInfoForInfoCode(adbc.InfoVendorName) require.True(t, ok) require.Equal(t, "test", vendorName) - driverName, ok := driverInfo.GetInfoDriverName() + driverName, ok := driverInfo.GetInfoForInfoCode(adbc.InfoDriverName) require.True(t, ok) require.Equal(t, "ADBC test Driver - Go", driverName) @@ -65,16 +64,11 @@ func TestDriverInfo(t *testing.T) { require.NoError(t, driverInfo.RegisterInfoCode(adbc.InfoCode(10_001), "string_value")) require.NoError(t, driverInfo.RegisterInfoCode(adbc.InfoCode(10_001), 123)) - // Retrieving known info codes is type-safe - driverVersion, ok := driverInfo.GetInfoDriverName() - require.True(t, ok) - require.NotEmpty(t, strings.Clone(driverVersion)) // do string stuff - - adbcVersion, ok := driverInfo.GetInfoDriverADBCVersion() - require.True(t, ok) - require.NotEmpty(t, adbcVersion+int64(123)) // do int64 stuff + // Once an info code has been registered, it is considered "supported" by the driver. + // This means that it will be returned if GetInfo is called with no parameters. + require.Contains(t, driverInfo.InfoSupportedCodes(), adbc.InfoCode(10_001)) - // We can also retrieve arbitrary info codes, but the result's type must be asserted + // We can retrieve arbitrary info codes, but the result's type must be asserted arrowVersion, ok := driverInfo.GetInfoForInfoCode(adbc.InfoDriverArrowVersion) require.True(t, ok) _, ok = arrowVersion.(string) diff --git a/go/adbc/driver/internal/driverbase/driver_test.go b/go/adbc/driver/internal/driverbase/driver_test.go index 309c529c1e..1f25ee44ad 100644 --- a/go/adbc/driver/internal/driverbase/driver_test.go +++ b/go/adbc/driver/internal/driverbase/driver_test.go @@ -232,6 +232,18 @@ func TestCustomizedDriver(t *testing.T) { "info_name": 2, "info_value": [0, "(unknown or development build)"] }, + { + "info_name": 3, + "info_value": [1, false] + }, + { + "info_name": 4, + "info_value": [1, true] + }, + { + "info_name": 5, + "info_value": [1, false] + }, { "info_name": 100, "info_value": [0, "ADBC MockDriver Driver - Go"] @@ -506,6 +518,15 @@ func (c *connectionImpl) ListTableTypes(ctx context.Context) ([]string, error) { } func (c *connectionImpl) PrepareDriverInfo(ctx context.Context, infoCodes []adbc.InfoCode) error { + if err := c.ConnectionImplBase.DriverInfo.RegisterInfoCode(adbc.InfoVendorReadOnly, false); err != nil { + return err + } + if err := c.ConnectionImplBase.DriverInfo.RegisterInfoCode(adbc.InfoVendorSql, true); err != nil { + return err + } + if err := c.ConnectionImplBase.DriverInfo.RegisterInfoCode(adbc.InfoVendorSubstrait, false); err != nil { + return err + } return c.ConnectionImplBase.DriverInfo.RegisterInfoCode(adbc.InfoCode(10_002), "this was fetched dynamically") } diff --git a/go/adbc/driver/snowflake/snowflake_database.go b/go/adbc/driver/snowflake/snowflake_database.go index 5c5f32b690..76da3d425a 100644 --- a/go/adbc/driver/snowflake/snowflake_database.go +++ b/go/adbc/driver/snowflake/snowflake_database.go @@ -155,7 +155,8 @@ func (d *databaseImpl) SetOptions(cnOptions map[string]string) error { } } - driverVersion, _ := d.DatabaseImplBase.DriverInfo.GetInfoDriverVersion() + dv, _ := d.DatabaseImplBase.DriverInfo.GetInfoForInfoCode(adbc.InfoDriverVersion) + driverVersion := dv.(string) defaultAppName := "[ADBC][Go-" + driverVersion + "]" // set default application name to track // unless user overrides it diff --git a/go/adbc/validation/validation.go b/go/adbc/validation/validation.go index ca594cba0f..41331e63f9 100644 --- a/go/adbc/validation/validation.go +++ b/go/adbc/validation/validation.go @@ -300,6 +300,7 @@ func (c *ConnectionTests) TestMetadataGetInfo() { adbc.InfoVendorName, adbc.InfoVendorVersion, adbc.InfoVendorArrowVersion, + adbc.InfoVendorReadOnly, } rdr, err := cnxn.GetInfo(ctx, info) @@ -329,6 +330,9 @@ func (c *ConnectionTests) TestMetadataGetInfo() { case 0: // String actual = child.(*array.String).Value(offset) + case 1: + // bool + actual = child.(*array.Boolean).Value(offset) case 2: // int64 actual = child.(*array.Int64).Value(offset) From 3f0b83ee8829294d87d2d07163004245d8950818 Mon Sep 17 00:00:00 2001 From: Joel Lubinitsky Date: Thu, 21 Mar 2024 06:46:23 -0400 Subject: [PATCH 04/12] driver_info for snowflake --- .../driver/internal/driverbase/connection.go | 2 +- go/adbc/driver/snowflake/connection.go | 11 ++++++ go/adbc/driver/snowflake/driver_test.go | 35 +++++++++++++++++++ .../driver/snowflake/snowflake_database.go | 1 + 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/go/adbc/driver/internal/driverbase/connection.go b/go/adbc/driver/internal/driverbase/connection.go index 10074975b5..1745d3d19b 100644 --- a/go/adbc/driver/internal/driverbase/connection.go +++ b/go/adbc/driver/internal/driverbase/connection.go @@ -157,7 +157,7 @@ func (base *ConnectionImplBase) GetInfo(ctx context.Context, infoCodes []adbc.In value, ok := base.DriverInfo.GetInfoForInfoCode(code) // We want to return a null value if the info_code requested is set to nil. - // The null value needs a type so we arbitrarily choose string (info_code: 0) + // The null value needs a type so we arbitrarily choose string (type_code: 0) if value == nil { value = "" ok = false diff --git a/go/adbc/driver/snowflake/connection.go b/go/adbc/driver/snowflake/connection.go index 9bc3ef54fc..7dda176c4f 100644 --- a/go/adbc/driver/snowflake/connection.go +++ b/go/adbc/driver/snowflake/connection.go @@ -83,6 +83,17 @@ type TableConstraint struct { skipRely bool } +// PrepareDriverInfo implements driverbase.DriverInfoPreparer. +func (c *connectionImpl) PrepareDriverInfo(ctx context.Context, infoCodes []adbc.InfoCode) error { + if err := c.ConnectionImplBase.DriverInfo.RegisterInfoCode(adbc.InfoVendorReadOnly, false); err != nil { + return err + } + if err := c.ConnectionImplBase.DriverInfo.RegisterInfoCode(adbc.InfoVendorSql, true); err != nil { + return err + } + return c.ConnectionImplBase.DriverInfo.RegisterInfoCode(adbc.InfoVendorSubstrait, false) +} + // ListTableTypes implements driverbase.TableTypeLister. func (*connectionImpl) ListTableTypes(ctx context.Context) ([]string, error) { return []string{"BASE TABLE", "TEMPORARY TABLE", "VIEW"}, nil diff --git a/go/adbc/driver/snowflake/driver_test.go b/go/adbc/driver/snowflake/driver_test.go index 3f93dbdb58..3767e6ea8f 100644 --- a/go/adbc/driver/snowflake/driver_test.go +++ b/go/adbc/driver/snowflake/driver_test.go @@ -225,6 +225,8 @@ func (s *SnowflakeQuirks) GetMetadata(code adbc.InfoCode) interface{} { return adbc.AdbcVersion1_1_0 case adbc.InfoVendorName: return "Snowflake" + case adbc.InfoVendorReadOnly: + return false } return nil @@ -1794,6 +1796,39 @@ func (suite *SnowflakeTests) TestDescribeOnly() { suite.Truef(arrow.TypeEqual(&arrow.Decimal128Type{Precision: 6, Scale: 2}, schema.Field(0).Type), "expected decimal(6, 2), got %s", schema.Field(0).Type) } +func (suite *SnowflakeTests) TestAdditionalDriverInfo() { + rdr, err := suite.cnxn.GetInfo( + suite.ctx, + []adbc.InfoCode{ + adbc.InfoVendorSql, + adbc.InfoVendorSubstrait, + }, + ) + suite.Require().NoError(err) + + var totalRows int64 + for rdr.Next() { + rec := rdr.Record() + totalRows += rec.NumRows() + code := rec.Column(0).(*array.Uint32) + info := rec.Column(1).(*array.DenseUnion) + + for i := 0; i < int(rec.NumRows()); i++ { + if code.Value(i) == uint32(adbc.InfoVendorSql) { + arr, ok := info.Field(info.ChildID(i)).(*array.Boolean) + suite.Require().True(ok) + suite.Require().Equal(true, arr.Value(i)) + } + if code.Value(i) == uint32(adbc.InfoVendorSubstrait) { + arr, ok := info.Field(info.ChildID(i)).(*array.Boolean) + suite.Require().True(ok) + suite.Require().Equal(false, arr.Value(i)) + } + } + } + suite.Require().Equal(int64(2), totalRows) +} + func TestJwtAuthenticationUnencryptedValue(t *testing.T) { // test doesn't participate in SnowflakeTests because // JWT auth has a different behavior diff --git a/go/adbc/driver/snowflake/snowflake_database.go b/go/adbc/driver/snowflake/snowflake_database.go index 76da3d425a..581d9733e4 100644 --- a/go/adbc/driver/snowflake/snowflake_database.go +++ b/go/adbc/driver/snowflake/snowflake_database.go @@ -460,6 +460,7 @@ func (d *databaseImpl) Open(ctx context.Context) (adbc.Connection, error) { WithAutocommitSetter(conn). WithCurrentNamespacer(conn). WithTableTypeLister(conn). + WithDriverInfoPreparer(conn). Connection(), nil } From f0e974dc11c395cb909bbe788fecef0c1bbb21fc Mon Sep 17 00:00:00 2001 From: Joel Lubinitsky Date: Thu, 21 Mar 2024 08:36:01 -0400 Subject: [PATCH 05/12] reformat error message --- go/adbc/driver/internal/driverbase/driver_info.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/go/adbc/driver/internal/driverbase/driver_info.go b/go/adbc/driver/internal/driverbase/driver_info.go index 688eddb42a..60404c87d6 100644 --- a/go/adbc/driver/internal/driverbase/driver_info.go +++ b/go/adbc/driver/internal/driverbase/driver_info.go @@ -99,15 +99,15 @@ func (di *DriverInfo) RegisterInfoCode(code adbc.InfoCode, value any) error { switch infoValueTypeCode { case adbc.InfoValueStringType: if val, ok := value.(string); !ok { - err = fmt.Errorf("info_code %d: expected info_value %v to be of type %T but found %T", code, value, val, value) + err = fmt.Errorf("%s: expected info_value %v to be of type %T but found %T", code, value, val, value) } case adbc.InfoValueInt64Type: if val, ok := value.(int64); !ok { - err = fmt.Errorf("info_code %d: expected info_value %v to be of type %T but found %T", code, value, val, value) + err = fmt.Errorf("%s: expected info_value %v to be of type %T but found %T", code, value, val, value) } case adbc.InfoValueBooleanType: if val, ok := value.(bool); !ok { - err = fmt.Errorf("info_code %d: expected info_value %v to be of type %T but found %T", code, value, val, value) + err = fmt.Errorf("%s: expected info_value %v to be of type %T but found %T", code, value, val, value) } } From d84055eea58ae2f9204af3508013233525131c28 Mon Sep 17 00:00:00 2001 From: Joel Lubinitsky Date: Thu, 21 Mar 2024 09:38:53 -0400 Subject: [PATCH 06/12] update error string in test --- go/adbc/driver/internal/driverbase/driver_info_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/adbc/driver/internal/driverbase/driver_info_test.go b/go/adbc/driver/internal/driverbase/driver_info_test.go index c4b79ba3fd..b253c1b7a3 100644 --- a/go/adbc/driver/internal/driverbase/driver_info_test.go +++ b/go/adbc/driver/internal/driverbase/driver_info_test.go @@ -58,7 +58,7 @@ func TestDriverInfo(t *testing.T) { // We cannot register a non-string value to that same info code err := driverInfo.RegisterInfoCode(adbc.InfoDriverVersion, 123) require.Error(t, err) - require.Equal(t, "info_code 101: expected info_value 123 to be of type string but found int", err.Error()) + require.Equal(t, "DriverVersion: expected info_value 123 to be of type string but found int", err.Error()) // We can also set vendor-specific info codes but they won't get type checked require.NoError(t, driverInfo.RegisterInfoCode(adbc.InfoCode(10_001), "string_value")) From 492c33333f38da76f08adb874253d1fbcb4fff97 Mon Sep 17 00:00:00 2001 From: Joel Lubinitsky Date: Thu, 21 Mar 2024 13:58:24 -0400 Subject: [PATCH 07/12] add java info codes --- .../java/org/apache/arrow/adbc/core/AdbcInfoCode.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcInfoCode.java b/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcInfoCode.java index 8d5c73ba9f..70ff35fac6 100644 --- a/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcInfoCode.java +++ b/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcInfoCode.java @@ -29,6 +29,16 @@ public enum AdbcInfoCode { VENDOR_VERSION(1), /** The database vendor/product Arrow library version (type: utf8). */ VENDOR_ARROW_VERSION(2), + /** Indicates whether the driver connection is read only (type: bool). */ + VENDOR_READ_ONLY(3), + /** Indicates whether SQL queries are supported (type: bool). */ + VENDOR_SQL(4), + /** Indicates whether Substrait queries are supported (type: bool). */ + VENDOR_SUBSTRAIT(5), + /** The minimum supported Substrait version, or null if Substrait is not supported (type: utf8). */ + VENDOR_SUBSTRAIT_MIN_VERSION(6), + /** The maximum supported Substrait version, or null if Substrait is not supported (type: utf8). */ + VENDOR_SUBSTRAIT_MAX_VERSION(7), /** The driver name (type: utf8). */ DRIVER_NAME(100), From 633e025f339952e49f93024dd7ad13d5e5779689 Mon Sep 17 00:00:00 2001 From: Joel Lubinitsky Date: Thu, 21 Mar 2024 14:00:25 -0400 Subject: [PATCH 08/12] sync header file --- adbc.h | 2 +- go/adbc/drivermgr/adbc.h | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/adbc.h b/adbc.h index 1c91dbbe74..82ec663c6f 100644 --- a/adbc.h +++ b/adbc.h @@ -459,7 +459,7 @@ const struct AdbcError* AdbcErrorFromArrayStream(struct ArrowArrayStream* stream /// /// \see AdbcConnectionGetInfo #define ADBC_INFO_VENDOR_ARROW_VERSION 2 -/// \brief Whether the driver connection is read only (type: bool). +/// \brief Indicates whether the driver connection is read only (type: bool). /// /// \see AdbcConnectionGetInfo #define ADBC_INFO_VENDOR_READ_ONLY 3 diff --git a/go/adbc/drivermgr/adbc.h b/go/adbc/drivermgr/adbc.h index 1ec2f05080..82ec663c6f 100644 --- a/go/adbc/drivermgr/adbc.h +++ b/go/adbc/drivermgr/adbc.h @@ -459,6 +459,28 @@ const struct AdbcError* AdbcErrorFromArrayStream(struct ArrowArrayStream* stream /// /// \see AdbcConnectionGetInfo #define ADBC_INFO_VENDOR_ARROW_VERSION 2 +/// \brief Indicates whether the driver connection is read only (type: bool). +/// +/// \see AdbcConnectionGetInfo +#define ADBC_INFO_VENDOR_READ_ONLY 3 +/// \brief Indicates whether SQL queries are supported (type: bool). +/// +/// \see AdbcConnectionGetInfo +#define ADBC_INFO_VENDOR_SQL 4 +/// \brief Indicates whether Substrait queries are supported (type: bool). +/// +/// \see AdbcConnectionGetInfo +#define ADBC_INFO_VENDOR_SUBSTRAIT 5 +/// \brief The minimum supported Substrait version, or null if +/// Substrait is not supported (type: utf8). +/// +/// \see AdbcConnectionGetInfo +#define ADBC_INFO_VENDOR_SUBSTRAIT_MIN_VERSION 6 +/// \brief The maximum supported Substrait version, or null if +/// Substrait is not supported (type: utf8). +/// +/// \see AdbcConnectionGetInfo +#define ADBC_INFO_VENDOR_SUBSTRAIT_MAX_VERSION 7 /// \brief The driver name (type: utf8). /// From aeb0fba85320791da0f02bc1dfa769157fa6d7ba Mon Sep 17 00:00:00 2001 From: Joel Lubinitsky Date: Thu, 21 Mar 2024 14:05:15 -0400 Subject: [PATCH 09/12] reformat java comment --- .../java/org/apache/arrow/adbc/core/AdbcInfoCode.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcInfoCode.java b/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcInfoCode.java index 70ff35fac6..d44971c89f 100644 --- a/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcInfoCode.java +++ b/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcInfoCode.java @@ -35,9 +35,13 @@ public enum AdbcInfoCode { VENDOR_SQL(4), /** Indicates whether Substrait queries are supported (type: bool). */ VENDOR_SUBSTRAIT(5), - /** The minimum supported Substrait version, or null if Substrait is not supported (type: utf8). */ + /** + * The minimum supported Substrait version, or null if Substrait is not supported (type: utf8). + */ VENDOR_SUBSTRAIT_MIN_VERSION(6), - /** The maximum supported Substrait version, or null if Substrait is not supported (type: utf8). */ + /** + * The maximum supported Substrait version, or null if Substrait is not supported (type: utf8). + */ VENDOR_SUBSTRAIT_MAX_VERSION(7), /** The driver name (type: utf8). */ From 81da8a16206f7aca98d49517fc773f1d2178fecb Mon Sep 17 00:00:00 2001 From: Joel Lubinitsky Date: Mon, 1 Apr 2024 15:20:33 -0400 Subject: [PATCH 10/12] move ingest option keys from options.h to adbc.h --- adbc.h | 18 ++++++++++++++++++ c/driver/common/options.h | 21 --------------------- go/adbc/drivermgr/adbc.h | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+), 21 deletions(-) diff --git a/adbc.h b/adbc.h index 82ec663c6f..ddab389aec 100644 --- a/adbc.h +++ b/adbc.h @@ -776,6 +776,24 @@ const struct AdbcError* AdbcErrorFromArrayStream(struct ArrowArrayStream* stream /// schema of the data to append (ADBC_STATUS_ALREADY_EXISTS). /// \since ADBC API revision 1.1.0 #define ADBC_INGEST_OPTION_MODE_CREATE_APPEND "adbc.ingest.mode.create_append" +/// \brief The catalog of the table for bulk insert. +/// +/// The type is char*. +#define ADBC_INGEST_OPTION_TARGET_CATALOG "adbc.ingest.target_catalog" +/// \brief The schema of the table for bulk insert. +/// +/// The type is char*. +#define ADBC_INGEST_OPTION_TARGET_DB_SCHEMA "adbc.ingest.target_db_schema" +/// \brief Use a temporary table for ingestion. +/// +/// The value should be ADBC_OPTION_VALUE_ENABLED or +/// ADBC_OPTION_VALUE_DISABLED (the default). +/// +/// This is not supported with ADBC_INGEST_OPTION_TARGET_CATALOG and +/// ADBC_INGEST_OPTION_TARGET_DB_SCHEMA. +/// +/// The type is char*. +#define ADBC_INGEST_OPTION_TEMPORARY "adbc.ingest.temporary" /// @} diff --git a/c/driver/common/options.h b/c/driver/common/options.h index f42bb09046..ef4f1cf536 100644 --- a/c/driver/common/options.h +++ b/c/driver/common/options.h @@ -24,27 +24,6 @@ extern "C" { #endif -/// \brief The catalog of the table for bulk insert. -/// -/// The type is char*. -#define ADBC_INGEST_OPTION_TARGET_CATALOG "adbc.ingest.target_catalog" - -/// \brief The schema of the table for bulk insert. -/// -/// The type is char*. -#define ADBC_INGEST_OPTION_TARGET_DB_SCHEMA "adbc.ingest.target_db_schema" - -/// \brief Use a temporary table for ingestion. -/// -/// The value should be ADBC_OPTION_VALUE_ENABLED or -/// ADBC_OPTION_VALUE_DISABLED (the default). -/// -/// This is not supported with ADBC_INGEST_OPTION_TARGET_CATALOG and -/// ADBC_INGEST_OPTION_TARGET_DB_SCHEMA. -/// -/// The type is char*. -#define ADBC_INGEST_OPTION_TEMPORARY "adbc.ingest.temporary" - #ifdef __cplusplus } #endif diff --git a/go/adbc/drivermgr/adbc.h b/go/adbc/drivermgr/adbc.h index 82ec663c6f..ddab389aec 100644 --- a/go/adbc/drivermgr/adbc.h +++ b/go/adbc/drivermgr/adbc.h @@ -776,6 +776,24 @@ const struct AdbcError* AdbcErrorFromArrayStream(struct ArrowArrayStream* stream /// schema of the data to append (ADBC_STATUS_ALREADY_EXISTS). /// \since ADBC API revision 1.1.0 #define ADBC_INGEST_OPTION_MODE_CREATE_APPEND "adbc.ingest.mode.create_append" +/// \brief The catalog of the table for bulk insert. +/// +/// The type is char*. +#define ADBC_INGEST_OPTION_TARGET_CATALOG "adbc.ingest.target_catalog" +/// \brief The schema of the table for bulk insert. +/// +/// The type is char*. +#define ADBC_INGEST_OPTION_TARGET_DB_SCHEMA "adbc.ingest.target_db_schema" +/// \brief Use a temporary table for ingestion. +/// +/// The value should be ADBC_OPTION_VALUE_ENABLED or +/// ADBC_OPTION_VALUE_DISABLED (the default). +/// +/// This is not supported with ADBC_INGEST_OPTION_TARGET_CATALOG and +/// ADBC_INGEST_OPTION_TARGET_DB_SCHEMA. +/// +/// The type is char*. +#define ADBC_INGEST_OPTION_TEMPORARY "adbc.ingest.temporary" /// @} From 197a4706afdbbed33c22fb13baa0ee539575d30d Mon Sep 17 00:00:00 2001 From: Joel Lubinitsky Date: Mon, 1 Apr 2024 15:24:25 -0400 Subject: [PATCH 11/12] add options to adbc.go --- go/adbc/adbc.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/go/adbc/adbc.go b/go/adbc/adbc.go index c3a7414b96..56ecf43b07 100644 --- a/go/adbc/adbc.go +++ b/go/adbc/adbc.go @@ -244,6 +244,9 @@ const ( OptionValueIngestModeAppend = "adbc.ingest.mode.append" OptionValueIngestModeReplace = "adbc.ingest.mode.replace" OptionValueIngestModeCreateAppend = "adbc.ingest.mode.create_append" + OptionValueIngestTargetCatalog = "adbc.ingest.target_catalog" + OptionValueIngestTargetDBSchema = "adbc.ingest.target_db_schema" + OptionValueIngestTemporary = "adbc.ingest.temporary" OptionKeyURI = "uri" OptionKeyUsername = "username" OptionKeyPassword = "password" From a52a4fa16e6b740392d3617751e28f044f1a8325 Mon Sep 17 00:00:00 2001 From: Joel Lubinitsky Date: Fri, 5 Apr 2024 11:06:51 -0400 Subject: [PATCH 12/12] remove readonly info code --- adbc.h | 12 ++++-------- go/adbc/adbc.go | 10 ++++------ go/adbc/driver/flightsql/flightsql_adbc_test.go | 2 -- go/adbc/driver/flightsql/flightsql_connection.go | 1 - go/adbc/driver/internal/driverbase/driver_info.go | 1 - go/adbc/driver/internal/driverbase/driver_test.go | 9 +-------- go/adbc/driver/snowflake/connection.go | 3 --- go/adbc/driver/snowflake/driver_test.go | 2 -- go/adbc/drivermgr/adbc.h | 12 ++++-------- go/adbc/validation/validation.go | 1 - .../org/apache/arrow/adbc/core/AdbcInfoCode.java | 10 ++++------ 11 files changed, 17 insertions(+), 46 deletions(-) diff --git a/adbc.h b/adbc.h index ddab389aec..26b8da13b8 100644 --- a/adbc.h +++ b/adbc.h @@ -459,28 +459,24 @@ const struct AdbcError* AdbcErrorFromArrayStream(struct ArrowArrayStream* stream /// /// \see AdbcConnectionGetInfo #define ADBC_INFO_VENDOR_ARROW_VERSION 2 -/// \brief Indicates whether the driver connection is read only (type: bool). -/// -/// \see AdbcConnectionGetInfo -#define ADBC_INFO_VENDOR_READ_ONLY 3 /// \brief Indicates whether SQL queries are supported (type: bool). /// /// \see AdbcConnectionGetInfo -#define ADBC_INFO_VENDOR_SQL 4 +#define ADBC_INFO_VENDOR_SQL 3 /// \brief Indicates whether Substrait queries are supported (type: bool). /// /// \see AdbcConnectionGetInfo -#define ADBC_INFO_VENDOR_SUBSTRAIT 5 +#define ADBC_INFO_VENDOR_SUBSTRAIT 4 /// \brief The minimum supported Substrait version, or null if /// Substrait is not supported (type: utf8). /// /// \see AdbcConnectionGetInfo -#define ADBC_INFO_VENDOR_SUBSTRAIT_MIN_VERSION 6 +#define ADBC_INFO_VENDOR_SUBSTRAIT_MIN_VERSION 5 /// \brief The maximum supported Substrait version, or null if /// Substrait is not supported (type: utf8). /// /// \see AdbcConnectionGetInfo -#define ADBC_INFO_VENDOR_SUBSTRAIT_MAX_VERSION 7 +#define ADBC_INFO_VENDOR_SUBSTRAIT_MAX_VERSION 6 /// \brief The driver name (type: utf8). /// diff --git a/go/adbc/adbc.go b/go/adbc/adbc.go index 56ecf43b07..9f50935ac0 100644 --- a/go/adbc/adbc.go +++ b/go/adbc/adbc.go @@ -347,16 +347,14 @@ const ( InfoVendorVersion InfoCode = 1 // VendorVersion // The database vendor/product Arrow library version (type: utf8) InfoVendorArrowVersion InfoCode = 2 // VendorArrowVersion - // Indicates whether the driver connection is read only (type: bool). - InfoVendorReadOnly InfoCode = 3 // Indicates whether SQL queries are supported (type: bool). - InfoVendorSql InfoCode = 4 + InfoVendorSql InfoCode = 3 // Indicates whether Substrait queries are supported (type: bool). - InfoVendorSubstrait InfoCode = 5 + InfoVendorSubstrait InfoCode = 4 // The minimum supported Substrait version, or null if Substrait is not supported (type: utf8). - InfoVendorSubstraitMinVersion InfoCode = 6 + InfoVendorSubstraitMinVersion InfoCode = 5 // The maximum supported Substrait version, or null if Substrait is not supported (type: utf8). - InfoVendorSubstraitMaxVersion InfoCode = 7 + InfoVendorSubstraitMaxVersion InfoCode = 6 // The driver name (type: utf8) InfoDriverName InfoCode = 100 // DriverName // The driver version (type: utf8) diff --git a/go/adbc/driver/flightsql/flightsql_adbc_test.go b/go/adbc/driver/flightsql/flightsql_adbc_test.go index feab14b79d..07fe9416f3 100644 --- a/go/adbc/driver/flightsql/flightsql_adbc_test.go +++ b/go/adbc/driver/flightsql/flightsql_adbc_test.go @@ -263,8 +263,6 @@ func (s *FlightSQLQuirks) GetMetadata(code adbc.InfoCode) interface{} { return "sqlite 3" case adbc.InfoVendorArrowVersion: return "16.0.0-SNAPSHOT" - case adbc.InfoVendorReadOnly: - return false } return nil diff --git a/go/adbc/driver/flightsql/flightsql_connection.go b/go/adbc/driver/flightsql/flightsql_connection.go index 96b52661d9..a17d8f2e3f 100644 --- a/go/adbc/driver/flightsql/flightsql_connection.go +++ b/go/adbc/driver/flightsql/flightsql_connection.go @@ -137,7 +137,6 @@ var adbcToFlightSQLInfo = map[adbc.InfoCode]flightsql.SqlInfo{ adbc.InfoVendorName: flightsql.SqlInfoFlightSqlServerName, adbc.InfoVendorVersion: flightsql.SqlInfoFlightSqlServerVersion, adbc.InfoVendorArrowVersion: flightsql.SqlInfoFlightSqlServerArrowVersion, - adbc.InfoVendorReadOnly: flightsql.SqlInfoFlightSqlServerReadOnly, adbc.InfoVendorSql: flightsql.SqlInfoFlightSqlServerSql, adbc.InfoVendorSubstrait: flightsql.SqlInfoFlightSqlServerSubstrait, adbc.InfoVendorSubstraitMinVersion: flightsql.SqlInfoFlightSqlServerSubstraitMinVersion, diff --git a/go/adbc/driver/internal/driverbase/driver_info.go b/go/adbc/driver/internal/driverbase/driver_info.go index 60404c87d6..7f98082b83 100644 --- a/go/adbc/driver/internal/driverbase/driver_info.go +++ b/go/adbc/driver/internal/driverbase/driver_info.go @@ -37,7 +37,6 @@ var infoValueTypeCodeForInfoCode = map[adbc.InfoCode]adbc.InfoValueTypeCode{ adbc.InfoDriverVersion: adbc.InfoValueStringType, adbc.InfoDriverArrowVersion: adbc.InfoValueStringType, adbc.InfoDriverADBCVersion: adbc.InfoValueInt64Type, - adbc.InfoVendorReadOnly: adbc.InfoValueBooleanType, adbc.InfoVendorSql: adbc.InfoValueBooleanType, adbc.InfoVendorSubstrait: adbc.InfoValueBooleanType, adbc.InfoVendorSubstraitMinVersion: adbc.InfoValueStringType, diff --git a/go/adbc/driver/internal/driverbase/driver_test.go b/go/adbc/driver/internal/driverbase/driver_test.go index 1f25ee44ad..3d0b579bd8 100644 --- a/go/adbc/driver/internal/driverbase/driver_test.go +++ b/go/adbc/driver/internal/driverbase/driver_test.go @@ -234,14 +234,10 @@ func TestCustomizedDriver(t *testing.T) { }, { "info_name": 3, - "info_value": [1, false] - }, - { - "info_name": 4, "info_value": [1, true] }, { - "info_name": 5, + "info_name": 4, "info_value": [1, false] }, { @@ -518,9 +514,6 @@ func (c *connectionImpl) ListTableTypes(ctx context.Context) ([]string, error) { } func (c *connectionImpl) PrepareDriverInfo(ctx context.Context, infoCodes []adbc.InfoCode) error { - if err := c.ConnectionImplBase.DriverInfo.RegisterInfoCode(adbc.InfoVendorReadOnly, false); err != nil { - return err - } if err := c.ConnectionImplBase.DriverInfo.RegisterInfoCode(adbc.InfoVendorSql, true); err != nil { return err } diff --git a/go/adbc/driver/snowflake/connection.go b/go/adbc/driver/snowflake/connection.go index 7dda176c4f..d992b6516c 100644 --- a/go/adbc/driver/snowflake/connection.go +++ b/go/adbc/driver/snowflake/connection.go @@ -85,9 +85,6 @@ type TableConstraint struct { // PrepareDriverInfo implements driverbase.DriverInfoPreparer. func (c *connectionImpl) PrepareDriverInfo(ctx context.Context, infoCodes []adbc.InfoCode) error { - if err := c.ConnectionImplBase.DriverInfo.RegisterInfoCode(adbc.InfoVendorReadOnly, false); err != nil { - return err - } if err := c.ConnectionImplBase.DriverInfo.RegisterInfoCode(adbc.InfoVendorSql, true); err != nil { return err } diff --git a/go/adbc/driver/snowflake/driver_test.go b/go/adbc/driver/snowflake/driver_test.go index 3767e6ea8f..aa5280437f 100644 --- a/go/adbc/driver/snowflake/driver_test.go +++ b/go/adbc/driver/snowflake/driver_test.go @@ -225,8 +225,6 @@ func (s *SnowflakeQuirks) GetMetadata(code adbc.InfoCode) interface{} { return adbc.AdbcVersion1_1_0 case adbc.InfoVendorName: return "Snowflake" - case adbc.InfoVendorReadOnly: - return false } return nil diff --git a/go/adbc/drivermgr/adbc.h b/go/adbc/drivermgr/adbc.h index ddab389aec..26b8da13b8 100644 --- a/go/adbc/drivermgr/adbc.h +++ b/go/adbc/drivermgr/adbc.h @@ -459,28 +459,24 @@ const struct AdbcError* AdbcErrorFromArrayStream(struct ArrowArrayStream* stream /// /// \see AdbcConnectionGetInfo #define ADBC_INFO_VENDOR_ARROW_VERSION 2 -/// \brief Indicates whether the driver connection is read only (type: bool). -/// -/// \see AdbcConnectionGetInfo -#define ADBC_INFO_VENDOR_READ_ONLY 3 /// \brief Indicates whether SQL queries are supported (type: bool). /// /// \see AdbcConnectionGetInfo -#define ADBC_INFO_VENDOR_SQL 4 +#define ADBC_INFO_VENDOR_SQL 3 /// \brief Indicates whether Substrait queries are supported (type: bool). /// /// \see AdbcConnectionGetInfo -#define ADBC_INFO_VENDOR_SUBSTRAIT 5 +#define ADBC_INFO_VENDOR_SUBSTRAIT 4 /// \brief The minimum supported Substrait version, or null if /// Substrait is not supported (type: utf8). /// /// \see AdbcConnectionGetInfo -#define ADBC_INFO_VENDOR_SUBSTRAIT_MIN_VERSION 6 +#define ADBC_INFO_VENDOR_SUBSTRAIT_MIN_VERSION 5 /// \brief The maximum supported Substrait version, or null if /// Substrait is not supported (type: utf8). /// /// \see AdbcConnectionGetInfo -#define ADBC_INFO_VENDOR_SUBSTRAIT_MAX_VERSION 7 +#define ADBC_INFO_VENDOR_SUBSTRAIT_MAX_VERSION 6 /// \brief The driver name (type: utf8). /// diff --git a/go/adbc/validation/validation.go b/go/adbc/validation/validation.go index 41331e63f9..9d73e6b436 100644 --- a/go/adbc/validation/validation.go +++ b/go/adbc/validation/validation.go @@ -300,7 +300,6 @@ func (c *ConnectionTests) TestMetadataGetInfo() { adbc.InfoVendorName, adbc.InfoVendorVersion, adbc.InfoVendorArrowVersion, - adbc.InfoVendorReadOnly, } rdr, err := cnxn.GetInfo(ctx, info) diff --git a/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcInfoCode.java b/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcInfoCode.java index d44971c89f..03d9abf4f4 100644 --- a/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcInfoCode.java +++ b/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcInfoCode.java @@ -29,20 +29,18 @@ public enum AdbcInfoCode { VENDOR_VERSION(1), /** The database vendor/product Arrow library version (type: utf8). */ VENDOR_ARROW_VERSION(2), - /** Indicates whether the driver connection is read only (type: bool). */ - VENDOR_READ_ONLY(3), /** Indicates whether SQL queries are supported (type: bool). */ - VENDOR_SQL(4), + VENDOR_SQL(3), /** Indicates whether Substrait queries are supported (type: bool). */ - VENDOR_SUBSTRAIT(5), + VENDOR_SUBSTRAIT(4), /** * The minimum supported Substrait version, or null if Substrait is not supported (type: utf8). */ - VENDOR_SUBSTRAIT_MIN_VERSION(6), + VENDOR_SUBSTRAIT_MIN_VERSION(5), /** * The maximum supported Substrait version, or null if Substrait is not supported (type: utf8). */ - VENDOR_SUBSTRAIT_MAX_VERSION(7), + VENDOR_SUBSTRAIT_MAX_VERSION(6), /** The driver name (type: utf8). */ DRIVER_NAME(100),