viirya commented on code in PR #9411:
URL: https://github.com/apache/arrow-datafusion/pull/9411#discussion_r1508558833


##########
datafusion/physical-expr/src/aggregate/first_last.rs:
##########
@@ -249,7 +274,18 @@ impl FirstValueAccumulator {
         };
         if self.requirement_satisfied {
             // Get first entry according to the pre-existing ordering (0th 
index):
-            return Ok((!value.is_empty()).then_some(0));
+            if self.is_ignore_null {
+                // If ignoring nulls, find the first non-null value.
+                for i in 0..value.len() {
+                    if !value.is_null(i) {
+                        return Ok((!value.is_empty()).then_some(i));

Review Comment:
   Once you enter this loop, I think `value` is not empty.



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

Reply via email to