ump45nose opened a new pull request, #4924: URL: https://github.com/apache/arrow-adbc/pull/4924
Closes #4913. `DatabaseImplBase`, `ConnectionImplBase` and `StatementImplBase` reject every key passed to `SetOptionInt` and `SetOptionDouble` with NotImplemented. Drivers that only override the string `SetOption` and parse numbers themselves therefore fail when an option they support arrives as an integer or double, which is what happens with typed values from connection profiles. Following the proposal in the issue, the fallback lives in the `database`, `connection` and `statement` wrappers, since they hold the driver's implementation (`DatabaseImplBase` can't dispatch to the driver's own `SetOption`): - `SetOptionInt` / `SetOptionDouble` first call the driver's typed setter. If it returns an `adbc.Error` with `StatusNotImplemented`, the value is formatted with `strconv.FormatInt(v, 10)` or `strconv.FormatFloat(v, 'g', -1, 64)` and passed to the wrapper's `SetOption`, so the connection wrapper's own handling of autocommit and current catalog/schema still applies. - Drivers that handle a key in their typed setters keep their current behavior, and other errors (e.g. InvalidArgument) are returned unchanged. - If the string setter doesn't know the key either, its NotImplemented "Unknown ... option" error is returned, as before. `SetOptionBytes` is unchanged. ### Testing - New `TestTypedOptionsFallBackToStringSetter` in `go/driver/internal/driverbase/typed_options_test.go`: a mock driver whose database, connection and statement only understand some keys through `SetOption` now accepts them through `SetOptionInt` and `SetOptionDouble` (including `1e21` formatting as `1e+21`), unknown keys still fail with NotImplemented, and a key handled natively by `SetOptionInt` is not routed through `SetOption`. The test fails on `main` for all three objects. - `go test ./internal/driverbase/ ./flightsql/` in `go/driver` passes, `go vet` and `gofmt` are clean. This PR was prepared with AI assistance. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
