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/03/13 15:44:00 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #5560: refactor: add more error info when array is empty

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


##########
datafusion/physical-expr/src/aggregate/median.rs:
##########
@@ -151,7 +151,12 @@ impl Accumulator for MedianAccumulator {
                 // ignore null values
                 .filter(|v| !v.is_null())
                 .cloned(),
-        )?;
+        )
+        .map_err(|_| {
+            DataFusionError::Execution(
+                "median requires at least one non-null value".into(),
+            )
+        })?;

Review Comment:
   I think so.
   
   What about explicitly checking for all nulls with something like:
   
   ```rust
   if  !self.all_values
                   .iter()
                   .any(|v| !v.is_null()) {
   .. raise error here
   }
   ```
                   



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