Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UDAF: Extend more args to state_fields and groups_accumulator_supported and introduce ReversedUDAF #10525

Merged
merged 3 commits into from
May 16, 2024

Conversation

jayzhan211
Copy link
Contributor

@jayzhan211 jayzhan211 commented May 15, 2024

Which issue does this PR close?

Closes #10391.

Rationale for this change

This PR is pulled from #10484 and it has a similar rationale in #10391 but the changes in this PR are for #10484

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@jayzhan211 jayzhan211 added the api change Changes the API exposed to users of the crate label May 15, 2024
@github-actions github-actions bot added logical-expr Logical plan and expressions optimizer Optimizer rules core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) labels May 15, 2024
Signed-off-by: jayzhan211 <[email protected]>
@github-actions github-actions bot removed the sqllogictest SQL Logic Tests (.slt) label May 15, 2024
@jayzhan211 jayzhan211 marked this pull request as ready for review May 15, 2024 13:48
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.

Thanks @jayzhan211 -- I think this is a very nice PR 🙏

The only thing I think we should consider is reusing AccumulatorArgs rather than adding GroupsAccumulatorSupportedArgs

sort_exprs,
}
}
pub struct StateFieldsArgs<'a> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we please add doc comments to this explaining what it is for?


/// [`GroupsAccumulatorSupportedArgs`] contains information to determine if an
/// aggregate function supports the groups accumulator.
pub struct GroupsAccumulatorSupportedArgs {
Copy link
Contributor

Choose a reason for hiding this comment

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

I know the current implementation of groups_accumulator_supported only needs these two fields, but I can see in the future needing more of them

Is there any reason we can't just pass AccumulatorArgs to groups_accumulator_supported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could do this.

Signed-off-by: jayzhan211 <[email protected]>
Signed-off-by: jayzhan211 <[email protected]>
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.

Thanks @jayzhan211

@jayzhan211 jayzhan211 merged commit 5a8348f into apache:main May 16, 2024
23 checks passed
@jayzhan211 jayzhan211 deleted the udaf-args branch May 18, 2024 07:19
findepi pushed a commit to findepi/datafusion that referenced this pull request Jul 16, 2024
…orted` and introduce `ReversedUDAF` (apache#10525)

* extends args

Signed-off-by: jayzhan211 <[email protected]>

* reuse accumulator args

Signed-off-by: jayzhan211 <[email protected]>

* fix example

Signed-off-by: jayzhan211 <[email protected]>

---------

Signed-off-by: jayzhan211 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change Changes the API exposed to users of the crate core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants