Skip to content

fix: dataframe function count_all with alias #17282

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

Merged
merged 4 commits into from
Aug 24, 2025

Conversation

Loaki07
Copy link
Contributor

@Loaki07 Loaki07 commented Aug 22, 2025

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Yes

Are there any user-facing changes?

@github-actions github-actions bot added the core Core DataFusion crate label Aug 22, 2025
@Loaki07
Copy link
Contributor Author

Loaki07 commented Aug 22, 2025

@kosiew pls review

@kosiew
Copy link
Contributor

kosiew commented Aug 22, 2025

LGTM.

note: This is a re-implementation of #17253

Copy link
Contributor

@kosiew kosiew left a comment

Choose a reason for hiding this comment

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

Thanks @Loaki07 for working on this.

Comment on lines 1787 to 1796
// Unwrap all alias layers to get to the underlying aggregate function
let (name, human_display, e) = match e {
Expr::Alias(Alias { expr, name, .. }) => {
(Some(name.clone()), String::default(), expr.as_ref())
Expr::Alias(Alias { name, .. }) => {
let unaliased = e.clone().unalias_nested().data;
(
Some(name.clone()),
e.human_display().to_string(),
unaliased.clone(),
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Follow up action:
This is useful to be extracted to a helper function eg
Expr::unwrap_alias.

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 @Loaki07 and @kosiew

@Loaki07 Loaki07 requested a review from alamb August 24, 2025 10:35
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 @Loaki07 and @kosiew

@kosiew kosiew merged commit 4925e6c into apache:main Aug 24, 2025
27 checks passed
@Loaki07 Loaki07 deleted the fix/count_all_alias_error_1 branch August 24, 2025 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants