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/19 14:59:37 UTC

[GitHub] [arrow-datafusion] alamb opened a new pull request, #6721: Fix up some `DataFusionError::Internal` errors with correct type

alamb opened a new pull request, #6721:
URL: https://github.com/apache/arrow-datafusion/pull/6721

   # Which issue does this PR close?
   Closes https://github.com/apache/arrow-datafusion/issues/6108
   
   
   # Rationale for this change
   See rationale on https://github.com/apache/arrow-datafusion/issues/6108
   
   # What changes are included in this PR?
   
   Change errors that don't indicate a code bug in DataFusion to Execution or Plan
   
   I did review all errors so far, but there is no way to avoid them getting in and there are some uses of `DataFusionError::Internal` that I am not 100% sure are correct but I think this is better than what we currently have
   
   # Are these changes tested?
   yes, existing tests
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   # Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->


-- 
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


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

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #6721:
URL: https://github.com/apache/arrow-datafusion/pull/6721#discussion_r1235622262


##########
datafusion/execution/src/task.rs:
##########
@@ -138,7 +138,7 @@ impl FunctionRegistry for TaskContext {
         let result = self.scalar_functions.get(name);
 
         result.cloned().ok_or_else(|| {
-            DataFusionError::Internal(format!(
+            DataFusionError::Plan(format!(

Review Comment:
   prob we could have short methods
   ```
   plan_err(text)
   execution_err(text)
   ...
   ``` 
   to replace wordy
   ```
               DataFusionError::Plan(format!(
                  text
               ))
   ```



##########
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:
   should be here Execution as well? 



-- 
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


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

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6721:
URL: https://github.com/apache/arrow-datafusion/pull/6721#issuecomment-1598792708

   cc @wolffcm I am making progress


-- 
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


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

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #6721:
URL: https://github.com/apache/arrow-datafusion/pull/6721#discussion_r1237515380


##########
datafusion/execution/src/task.rs:
##########
@@ -138,7 +138,7 @@ impl FunctionRegistry for TaskContext {
         let result = self.scalar_functions.get(name);
 
         result.cloned().ok_or_else(|| {
-            DataFusionError::Internal(format!(
+            DataFusionError::Plan(format!(

Review Comment:
   I tried to implement this idea in https://github.com/apache/arrow-datafusion/pull/6740 but I found them harder / less easy to use



-- 
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


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

Posted by "alamb (via GitHub)" <gi...@apache.org>.
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


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

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #6721:
URL: https://github.com/apache/arrow-datafusion/pull/6721#discussion_r1237424720


##########
datafusion/execution/src/task.rs:
##########
@@ -138,7 +138,7 @@ impl FunctionRegistry for TaskContext {
         let result = self.scalar_functions.get(name);
 
         result.cloned().ok_or_else(|| {
-            DataFusionError::Internal(format!(
+            DataFusionError::Plan(format!(

Review Comment:
   It is an excellent idea. I will try to do this



-- 
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


[GitHub] [arrow-datafusion] alamb merged pull request #6721: Fix up some `DataFusionError::Internal` errors with correct type

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #6721:
URL: https://github.com/apache/arrow-datafusion/pull/6721


-- 
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