mustafasrepo commented on code in PR #6503:
URL: https://github.com/apache/arrow-datafusion/pull/6503#discussion_r1212317393


##########
datafusion/physical-expr/src/aggregate/first_last.rs:
##########
@@ -112,25 +112,35 @@ impl PartialEq<dyn Any> for FirstValue {
 #[derive(Debug)]
 struct FirstValueAccumulator {
     first: ScalarValue,
+    // At the beginning, `is_set` is `false`, this means `first` is not seen 
yet.
+    // Once we see (`is_set=true`) first value, we do not update `first`.
+    is_set: bool,

Review Comment:
   I have considered this option, however, during `evaluate` call if `first` is 
`None`. We need to return `NULL` for appropriate type, such as 
`ScalarValue::Int64(None)` if type is `Int64`. However, datatype is only 
available during initialization. If we want to use `Option` for `first`, we may 
need to store data type also. Hence I opted for this approach



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