You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2023/01/07 18:46:36 UTC

[GitHub] [arrow-datafusion] jonmmease opened a new pull request, #4846: Implement retract_batch for AvgAccumulator

jonmmease opened a new pull request, #4846:
URL: https://github.com/apache/arrow-datafusion/pull/4846

   # Which issue does this PR close?
   
   Closes #4845.
   
   # What changes are included in this PR?
   
   Adds an implementation of `retract_batch` to `AvgAccumulator` that is identical to the implementation for `SumAccumulator`.
   
   # Are these changes tested?
   
     I added `AVG` to a couple of existing tests that previously failed with `"Retractable Accumulator hasn't been implemented..."` error.
   
   # Are there any user-facing changes?
   `AVG` can now be used in window expressions with custom frames.


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


[GitHub] [arrow-datafusion] ozankabak commented on a diff in pull request #4846: Implement retract_batch for AvgAccumulator

Posted by GitBox <gi...@apache.org>.
ozankabak commented on code in PR #4846:
URL: https://github.com/apache/arrow-datafusion/pull/4846#discussion_r1064041043


##########
datafusion/physical-expr/src/aggregate/average.rs:
##########
@@ -154,6 +159,14 @@ impl Accumulator for AvgAccumulator {
         Ok(())
     }
 
+    fn retract_batch(&mut self, values: &[ArrayRef]) -> Result<()> {
+        let values = &values[0];
+        self.count -= (values.len() - values.data().null_count()) as u64;
+        let delta = sum_batch(values, &self.sum.get_datatype())?;
+        self.sum = self.sum.sub(&delta)?;

Review Comment:
   I like giving a name to the change (i.e. `delta`). I suggest doing the same in `update_batch`.



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


[GitHub] [arrow-datafusion] jonmmease commented on pull request #4846: Implement retract_batch for AvgAccumulator

Posted by GitBox <gi...@apache.org>.
jonmmease commented on PR #4846:
URL: https://github.com/apache/arrow-datafusion/pull/4846#issuecomment-1376058138

   Can this be merged? Thanks!


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


[GitHub] [arrow-datafusion] ursabot commented on pull request #4846: Implement retract_batch for AvgAccumulator

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #4846:
URL: https://github.com/apache/arrow-datafusion/pull/4846#issuecomment-1376794889

   Benchmark runs are scheduled for baseline = 42f7dd50913c4f6b6d830b88d55dfd4a8d16d44f and contender = 13fb42efec4b5ab7f9aa251f1705fdcf89057d23. 13fb42efec4b5ab7f9aa251f1705fdcf89057d23 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/faa29f51a2314df2957bc566903cb458...597674ce0c554b6c87821768e1a80ede/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/a3b2097585e04c51bc17dfaba323e635...5d9e1bc44e204f3a982e1786fd6bcc0b/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/76c4557b831b456184c5e76d92fb0cd7...89f47298cf844a66bbb6ea7f935e19d3/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/7b369e15214b45baa689fef51fe6e0d3...89d3d1c9c5af48c39a55df97f307a4c4/)
   Buildkite builds:
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


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


[GitHub] [arrow-datafusion] ozankabak commented on pull request #4846: Implement retract_batch for AvgAccumulator

Posted by GitBox <gi...@apache.org>.
ozankabak commented on PR #4846:
URL: https://github.com/apache/arrow-datafusion/pull/4846#issuecomment-1374593994

   @mustafasrepo, PTAL


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


[GitHub] [arrow-datafusion] alamb commented on pull request #4846: Implement retract_batch for AvgAccumulator

Posted by GitBox <gi...@apache.org>.
alamb commented on PR #4846:
URL: https://github.com/apache/arrow-datafusion/pull/4846#issuecomment-1374781021

   Thank you for contribution @jonmmease  and for the review @ozankabak ❤️ 


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


[GitHub] [arrow-datafusion] mustafasrepo commented on pull request #4846: Implement retract_batch for AvgAccumulator

Posted by GitBox <gi...@apache.org>.
mustafasrepo commented on PR #4846:
URL: https://github.com/apache/arrow-datafusion/pull/4846#issuecomment-1375344163

   LGTM thanks @jonmmease.


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


[GitHub] [arrow-datafusion] alamb commented on pull request #4846: Implement retract_batch for AvgAccumulator

Posted by GitBox <gi...@apache.org>.
alamb commented on PR #4846:
URL: https://github.com/apache/arrow-datafusion/pull/4846#issuecomment-1376789846

   Sorry for the delay @jonmmease  -- thanks again for the contributions!


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


[GitHub] [arrow-datafusion] alamb merged pull request #4846: Implement retract_batch for AvgAccumulator

Posted by GitBox <gi...@apache.org>.
alamb merged PR #4846:
URL: https://github.com/apache/arrow-datafusion/pull/4846


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