Skip to content

Conversation

@martin-g
Copy link
Member

Follow-up of #17726 (review)

Which issue does this PR close?

Rationale for this change

Using Some(true), Some(false) and None for the number of nulls in an array are not very clear.
Using an enum with a well named variants is clearer.

What changes are included in this PR?

Introduce a local scoped enum for the needs of the function.

Are these changes tested?

The change reuses the tests from #18047

Are there any user-facing changes?

No

@github-actions github-actions bot added the physical-plan Changes to the physical-plan crate label Oct 14, 2025
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 @martin-g

FYI @ashdnazg

@ashdnazg
Copy link
Contributor

ashdnazg commented Oct 14, 2025

My code was copied from https://github.com/apache/datafusion/blob/main/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs#L142 and there are similar matches in the other files in the module as well, so might as well use the enum in them as well.

@martin-g
Copy link
Member Author

I've updated all files in multi_group_by module which were using Option<bool>.

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 @martin-g and @ashdnazg

@alamb alamb added this pull request to the merge queue Oct 15, 2025
Merged via the queue into apache:main with commit 057583d Oct 15, 2025
28 checks passed
@martin-g martin-g deleted the use-enum-for-clarity branch October 15, 2025 11:49
tobixdev pushed a commit to tobixdev/datafusion that referenced this pull request Nov 2, 2025
…n array (apache#18048)

* chore: Use an enum to express the different kinds of nullability in an array

Follow-up of apache#17726 (review)

* Use the Nulls enum also in .../multi_group_by/primitive.rs

* Use the Nulls enum in .../multi_group_by/bytes[_view].rs as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use an enum to express the nullability of an array

3 participants