gandronchik commented on code in PR #2680:
URL: https://github.com/apache/arrow-datafusion/pull/2680#discussion_r888215687
##########
datafusion/sql/src/utils.rs:
##########
@@ -447,24 +447,16 @@ pub(crate) fn make_decimal_type(
precision: Option<u64>,
scale: Option<u64>,
) -> Result<DataType> {
- match (precision, scale) {
- (None, _) | (_, None) => {
- return Err(DataFusionError::Internal(format!(
- "Decimal(precision, scale) must both be specified, got ({:?},
{:?})",
- precision, scale
- )));
- }
- (Some(p), Some(s)) => {
- // Arrow decimal is i128 meaning 38 maximum decimal digits
- if (p as usize) > DECIMAL_MAX_PRECISION || s > p {
- return Err(DataFusionError::Internal(format!(
- "For decimal(precision, scale) precision must be less than
or equal to 38 and scale can't be greater than precision. Got ({}, {})",
- p, s
- )));
- } else {
- Ok(DataType::Decimal(p as usize, s as usize))
- }
- }
+ let scale = scale.unwrap_or(DECIMAL_DEFAULT_SCALE as u64) as usize;
Review Comment:
you are right. Actually only precision must not be larger than 38. I will
fix it tomorrow. Thank you
--
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]