Skip to content

Conversation

@shruti2522
Copy link
Contributor

@shruti2522 shruti2522 commented Mar 28, 2025

Which issue does this PR close?

Rationale for this change

Enable support for averaging Duration type

What changes are included in this PR?

Added accumulator to compute the Avg of Duration types, would add support for GroupsAccumulator in a follow-up PR.

Are these changes tested?

Yes.

Are there any user-facing changes?

Yes.

@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Mar 28, 2025
@alamb
Copy link
Contributor

alamb commented Apr 7, 2025

Ping @shruti2522 -- this one looks pretty close

@alamb
Copy link
Contributor

alamb commented Apr 7, 2025

I think you need to update the signature of Avg to support the new type as well

@github-actions github-actions bot added the logical-expr Logical plan and expressions label Apr 17, 2025
@shruti2522 shruti2522 marked this pull request as ready for review April 17, 2025 05:34
@shruti2522
Copy link
Contributor Author

I think you need to update the signature of Avg to support the new type as well

@alamb this one's ready for review whenever you get a chance.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you very much @shruti2522 -- this code looks really nice. I think we need a few more tests but then it will be ready to merge

Thank you so much. This is great

statement ok
drop table dict_test;

# avg_duartion
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# avg_duartion
# avg_duration

@shruti2522 shruti2522 marked this pull request as draft April 18, 2025 11:15
@shruti2522 shruti2522 marked this pull request as ready for review April 18, 2025 12:47
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @shruti2522

@alamb alamb merged commit 76a4c60 into apache:main Apr 19, 2025
27 checks passed
nirnayroy pushed a commit to nirnayroy/datafusion that referenced this pull request May 2, 2025
* Support Accumulator for avg duration

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

Labels

functions Changes to functions implementation logical-expr Logical plan and expressions sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants