alinaliBQ opened a new issue, #55888:
URL: https://github.com/apache/arrow/issues/55888
### Describe the enhancement requested
The ODBC driver only supports `Decimal128` result columns end to end. The
data types `decimal32`, `decimal64` and `decimal256` are not supported for data
fetching. The exception is `decimal256`, as values above 38 digits can't be
returned as `SQL_C_NUMERIC`, it likely needs to be implemented as string
(`SQL_WVARCHAR`).
Note: GH-55748 (#55819) made the metadata calls (`GetPrecision`,
`GetOctetLength`, `GetDecimalTypePrecision`, `GetDecimalTypeScale`) work for
any decimal width by using `is_decimal` and `DecimalType`. The data path is
still Decimal128-only, so such a column reports its precision but cannot be
fetched.
### Where to implement
All under `cpp/src/arrow/flight/sql/odbc/odbc_impl/`:
- `util.cc`: the `Type::DECIMAL128` cases that map Arrow types to
`SqlDataType_DECIMAL` and to `CDataType_NUMERIC`, the conversion-support check,
and the default cast target (`decimal128(38, 0)`) only know about Decimal128.
(Note that `CDataType_NUMERIC` maps back to `Type::DECIMAL128` as the target
type, which is correct and should stay.)
- `flight_sql_result_set_accessors.cc` and
`accessors/decimal_array_accessor.{h,cc}`: `DecimalArrayFlightSqlAccessor` is
only instantiated for `Decimal128Array` and casts the type to
`Decimal128Type*`. It needs to read 4, 8, 16 or 32 byte values and fill
`SQL_NUMERIC_STRUCT`.
- `util.cc` decimal-to-string conversion (the `original_type_id ==
Type::DECIMAL128` branch) uses `scalar->ToString()` and probably works for all
widths, but only checks for Decimal128.
### Tests
The mock (SQLite) server cannot return decimals, so suggest to write tests
against the remote Dremio OSS docker instance (which is set up in ODBC Linux CI
workflow).
### Component(s)
FlightRPC, C++
--
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]