Skip to content

Implement min max for dictionary types #15827

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

XiangpengHao
Copy link
Contributor

Which issue does this PR close?

  • Closes #.

Rationale for this change

I hit a run time error when passing a dictionary type to the min/max aggregation.

What changes are included in this PR?

This PR handles min/max for dictionary types.

Are these changes tested?

Yes

Are there any user-facing changes?

@github-actions github-actions bot added the functions Changes to functions implementation label Apr 23, 2025
@@ -1854,9 +1866,31 @@ mod tests {
#[test]
fn test_get_min_max_return_type_coerce_dictionary() -> Result<()> {
let data_type =
DataType::Dictionary(Box::new(DataType::Utf8), Box::new(DataType::Int32));
DataType::Dictionary(Box::new(DataType::Int32), Box::new(DataType::Utf8));
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 don't think Dict<Utf8, Int32> is a valid dictionary type, so I swapped the key and value. Maybe we should do something to only allow ArrowDictionaryKeyType as the key type, but it's not obvious how to enforce it with the current enum

Copy link
Contributor

@adriangb adriangb left a comment

Choose a reason for hiding this comment

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

Looks great to me!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
functions Changes to functions implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants