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


##########
datafusion/physical-expr/src/aggregate/first_last.rs:
##########
@@ -259,8 +295,20 @@ impl FirstValueAccumulator {
                 options: Some(req.options),
             })
             .collect::<Vec<_>>();
-        let indices = lexsort_to_indices(&sort_columns, Some(1))?;
-        Ok((!indices.is_empty()).then_some(indices.value(0) as _))
+
+        if self.is_ignore_null {
+            let indices = lexsort_to_indices(&sort_columns, 
Some(value.len()))?;

Review Comment:
   Fixed. Thanks!



##########
datafusion/physical-expr/src/aggregate/first_last.rs:
##########
@@ -54,6 +55,24 @@ impl FirstValue {
         input_data_type: DataType,
         ordering_req: LexOrdering,
         order_by_data_types: Vec<DataType>,
+    ) -> Self {
+        Self::with_ignore_null(
+            expr,
+            name,
+            input_data_type,
+            ordering_req,
+            order_by_data_types,
+            false,
+        )
+    }
+
+    pub fn with_ignore_null(

Review Comment:
   Changed. Thanks for the suggestion!



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