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

Minor: Make schema of grouping set columns nullable #8248

Merged
merged 3 commits into from
Nov 18, 2023

Conversation

markusa380
Copy link
Contributor

@markusa380 markusa380 commented Nov 17, 2023

Which issue does this PR close?

Closes #8247.

Rationale for this change

In our project using datafusion, we have a specific optimizer rule that combines an aggregation into a different node.
We noticed that when creating the results using RecordBatch::try_new(...) using the schmea of the aggregation, it fails as it expects the columns to be non-nullable if the input column is non-nullable in case of grouping sets, although naturally all rows that do not belong to the "current" grouping set are null for that column.

So, this PR will force the field created from a grouping set to be nullable.

What changes are included in this PR?

Are these changes tested?

Added a unit test.

Are there any user-facing changes?

No.

@github-actions github-actions bot added the logical-expr Logical plan and expressions label Nov 17, 2023
@markusa380 markusa380 changed the title Make schema of grouping set columns nullable Minor: Make schema of grouping set columns nullable Nov 17, 2023
Copy link
Contributor

@Dandandan Dandandan left a comment

Choose a reason for hiding this comment

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

Seems right to me :)

@yukkit
Copy link
Contributor

yukkit commented Nov 17, 2023

it works for me. 👍

@github-actions github-actions bot added optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt) labels Nov 17, 2023
@markusa380
Copy link
Contributor Author

@Dandandan could you approve the workflows again? I had to fix some tests.

@alamb alamb merged commit 8f48053 into apache:main Nov 18, 2023
22 checks passed
@alamb
Copy link
Contributor

alamb commented Nov 18, 2023

Thanks @markusa380 and @Dandandan and @yukkit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Grouping set output schema is not always nullable
4 participants