alamb commented on code in PR #7866:
URL: https://github.com/apache/arrow-datafusion/pull/7866#discussion_r1365448770
##########
datafusion/sql/src/utils.rs:
##########
@@ -221,14 +223,17 @@ pub(crate) fn make_decimal_type(
(None, None) => (DECIMAL128_MAX_PRECISION, DECIMAL_DEFAULT_SCALE),
};
- // Arrow decimal is i128 meaning 38 maximum decimal digits
if precision == 0
- || precision > DECIMAL128_MAX_PRECISION
+ || precision > DECIMAL256_MAX_PRECISION
|| scale.unsigned_abs() > precision
{
plan_err!(
- "Decimal(precision = {precision}, scale = {scale}) should satisfy
`0 < precision <= 38`, and `scale <= precision`."
+ "Decimal(precision = {precision}, scale = {scale}) should satisfy
`0 < precision <= 76`, and `scale <= precision`."
)
+ } else if precision > DECIMAL128_MAX_PRECISION
+ && precision <= DECIMAL256_MAX_PRECISION
+ {
+ Ok(DataType::Decimal256(precision, scale))
Review Comment:
👍
##########
datafusion/sql/src/utils.rs:
##########
@@ -221,14 +223,17 @@ pub(crate) fn make_decimal_type(
(None, None) => (DECIMAL128_MAX_PRECISION, DECIMAL_DEFAULT_SCALE),
};
- // Arrow decimal is i128 meaning 38 maximum decimal digits
if precision == 0
- || precision > DECIMAL128_MAX_PRECISION
+ || precision > DECIMAL256_MAX_PRECISION
|| scale.unsigned_abs() > precision
{
plan_err!(
- "Decimal(precision = {precision}, scale = {scale}) should satisfy
`0 < precision <= 38`, and `scale <= precision`."
+ "Decimal(precision = {precision}, scale = {scale}) should satisfy
`0 < precision <= 76`, and `scale <= precision`."
)
+ } else if precision > DECIMAL128_MAX_PRECISION
+ && precision <= DECIMAL256_MAX_PRECISION
+ {
+ Ok(DataType::Decimal256(precision, scale))
Review Comment:
👍
--
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]