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/09/15 11:04:49 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #7565: First and Last Accumulators should update with state row excluding is_set flag

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


##########
datafusion/physical-expr/src/aggregate/first_last.rs:
##########
@@ -550,4 +559,72 @@ mod tests {
         assert_eq!(last_accumulator.evaluate()?, ScalarValue::Int64(Some(12)));
         Ok(())
     }
+
+    #[test]
+    fn test_first_last_state_after_merge() -> Result<()> {
+        let ranges: Vec<(i64, i64)> = vec![(0, 10), (1, 11), (2, 13)];
+        // create 3 ArrayRefs between each interval e.g from 0 to 9, 1 to 10, 2 to 12
+        let arrs = ranges
+            .into_iter()
+            .map(|(start, end)| {
+                Arc::new(Int64Array::from((start..end).collect::<Vec<_>>())) as ArrayRef

Review Comment:
   I think you can collect the array directly
   
   ```suggestion
                   Arc::new((start..end).collect::<Int64Array>())) as ArrayRef
   ```



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