-
Notifications
You must be signed in to change notification settings - Fork 115
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
Support for Decimal128 & Decimal256 without downcasting to f64 #305
Comments
Hi! I don't know if We do have a In the case of 256-width decimals however, thats more of an expected limitation as DuckDB itself doesn't support 256-width decimals internally. |
The vtab module does have some support already: https://docs.rs/duckdb/latest/duckdb/vtab/struct.LogicalType.html#method.decimal |
Even if DuckDB-rs has some typing for Decimal128, I think the core issue is that I don't have the best understanding of duckdb specifically. |
Where are you seeing that function used in the codepath duckdb-rs uses? |
Running let schema = Schema::new(vec![Field::new("a", input_array.data_type().clone(), false)]);
let rb = RecordBatch::try_new(Arc::new(schema), vec![Arc::new(input_array.clone())])?;
let mut stmt = db.prepare("select a from arrow(?, ?)")?;
let rb = stmt.query_arrow(param)?
|
As mentioned DuckDB doesn't support decimal256 or decimals with negative scale, but I've added support for positive decimal128 conversion here #328 |
Overview
Currently Duckdb-rs supports Decimal128, but not Decimal256. However, its support for Decimal128 downcasts to f64. See decimal_array_to_vector.
This fails a check_rust_primitive_array_roundtrip, when I ran it locally.
The underlying cause of the issue is that duckdb-rs explicitly converts to Double, and not Decimal see code
The comment above reference the fact Decimal does not appear in https://github.com/duckdb/duckdb/blob/main/src/main/capi/helper-c.cpp#L5-L61.
Feature
Support for Decimal128 and Decimal256.
Question
Is this issue in
capi/helper-c.cpp
an intrinisic issue with DuckDB, and if not, what work would be required to support all Decimal types in the Rust bindings?The text was updated successfully, but these errors were encountered: