You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mustafasrepo (via GitHub)" <gi...@apache.org> on 2023/05/31 21:09:16 UTC

[GitHub] [arrow-datafusion] mustafasrepo commented on a diff in pull request #6503: Bug fix, First accumulator multiple batch aware

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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org