-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem or challenge?
In scalarvalue it seems we disallow negative scale for multiple functions, e.g.
datafusion/datafusion/common/src/scalar/mod.rs
Lines 1676 to 1693 in 775277a
| DataType::Decimal32(precision, scale) => { | |
| Self::validate_decimal_or_internal_err::<Decimal32Type>( | |
| *precision, *scale, | |
| )?; | |
| assert_or_internal_err!(*scale >= 0, "Negative scale is not supported"); | |
| match 10_i32.checked_pow(*scale as u32) { | |
| Some(value) => { | |
| ScalarValue::Decimal32(Some(value), *precision, *scale) | |
| } | |
| None => return _internal_err!("Unsupported scale {scale}"), | |
| } | |
| } | |
| DataType::Decimal64(precision, scale) => { | |
| Self::validate_decimal_or_internal_err::<Decimal64Type>( | |
| *precision, *scale, | |
| )?; | |
| assert_or_internal_err!(*scale >= 0, "Negative scale is not supported"); | |
| match i64::from(10).checked_pow(*scale as u32) { |
Describe the solution you'd like
Remove these limitations and support decimals with negative scale in ScalarValue
Describe alternatives you've considered
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request