You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/06/20 18:23:33 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #6721: Fix up some `DataFusionError::Internal` errors with correct type

alamb commented on code in PR #6721:
URL: https://github.com/apache/arrow-datafusion/pull/6721#discussion_r1235652729


##########
datafusion/physical-expr/src/aggregate/utils.rs:
##########
@@ -60,25 +60,25 @@ pub fn calculate_result_decimal_for_avg(
                     if new_value >= target_min && new_value <= target_max {
                         Ok(ScalarValue::Decimal128(Some(new_value), *p, *s))
                     } else {
-                        Err(DataFusionError::Internal(
+                        Err(DataFusionError::Execution(
                             "Arithmetic Overflow in AvgAccumulator".to_string(),
                         ))
                     }
                 } else {
                     // can't convert the lit decimal to the returned data type
-                    Err(DataFusionError::Internal(
+                    Err(DataFusionError::Execution(
                         "Arithmetic Overflow in AvgAccumulator".to_string(),
                     ))
                 }
             } else {
                 // can't convert the lit decimal to the returned data type
-                Err(DataFusionError::Internal(
+                Err(DataFusionError::Execution(
                     "Arithmetic Overflow in AvgAccumulator".to_string(),
                 ))
             }
         }
         other => Err(DataFusionError::Internal(format!(

Review Comment:
   I think this error is if `calculate_result_decimal_for_avg` gets called with a non `DataType::Decimal` argument, which I *think* the type dispatch is supposed to prevent.
   
   Thus I think `Internal` is still the appropriate error in this area



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org