Skip to content

feat: support min/max for struct #15667

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chenkovsky
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

datafusion doesn't support min/max for struct.

What changes are included in this PR?

modify min_max.rs to support it.

the performance for struct is worse than primitive types. does anyone have suggestions about optimizing it.

Are these changes tested?

UT

Are there any user-facing changes?

NO

@chenkovsky chenkovsky marked this pull request as ready for review April 10, 2025 04:13
@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Apr 10, 2025
_ => min_max_batch!(values, min),
})
}

fn min_max_batch_struct(array: &ArrayRef, ordering: Ordering) -> Result<ScalarValue> {
Copy link
Contributor

Choose a reason for hiding this comment

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

What definition of "greater / less than" does this use? I think figuring out how to compare structs (like what does it mean for one struct to be bigger than the other) was not clear

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated partial_cmp_struct to make it more clear.

@alamb
Copy link
Contributor

alamb commented Apr 10, 2025

the performance for struct is worse than primitive types. does anyone have suggestions about optimizing it.

Do make it faster you could implement a GroupsAccumulator

@github-actions github-actions bot added the common Related to common crate label Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Related to common crate functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

min/max aggregation function for struct
2 participants