Skip to content

Conversation

@jonmmease
Copy link
Contributor

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.

Add avg to custom window frame tests
@github-actions github-actions bot added core Core DataFusion crate physical-expr Changes to the physical-expr crates labels Jan 7, 2023
Copy link
Contributor

@ozankabak ozankabak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for the contribution!

Comment on lines +165 to +166
let delta = sum_batch(values, &self.sum.get_datatype())?;
self.sum = self.sum.sub(&delta)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ozankabak
Copy link
Contributor

@mustafasrepo, PTAL

@alamb
Copy link
Contributor

alamb commented Jan 8, 2023

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

@mustafasrepo
Copy link
Contributor

LGTM thanks @jonmmease.

@jonmmease
Copy link
Contributor Author

Can this be merged? Thanks!

@alamb alamb merged commit 13fb42e into apache:master Jan 10, 2023
@alamb
Copy link
Contributor

alamb commented Jan 10, 2023

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

@ursabot
Copy link

ursabot commented Jan 10, 2023

Benchmark runs are scheduled for baseline = 42f7dd5 and contender = 13fb42e. 13fb42e is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate physical-expr Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support custom window frame with AVG aggregate function

5 participants