GH-51231: [C++][Acero] Keep input nullability information for direct field projections - #51691
Open
FadyYosry77 wants to merge 1 commit into
Open
FadyYosry77 wants to merge 1 commit into
FadyYosry77 wants to merge 1 commit into
Conversation
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
ProjectNode creates output column definitions with the requested output name and the type of the bound expression for that column. Nullability information is available from the input schema but is not copied during output column creation; thus, output columns are nullable by default.
As a result, projecting a nonnullable column from the input schema produces a nullable column in the output schema, even when only that column is projected. An identity projection may therefore produce a schema incompatible with its input.
GH-51231 restricts this change to top-level input fields.
What changes does this PR contain?
For direct projections of top-level fields, the ProjectNode class now uses the nullability of the input field to determine the nullability of the output field.
The projected field name and type of the bound expression remain unchanged.
Computed fields and nested field references continue to have their current nullable behavior. This pull request does not include full expression nullability inference.
A regression test covers:
Are these changes tested?
Yes.
The regression test checks the schemas created. It failed with the old implementation and passed with the new implementation.
Local validation included:
The targeted regression analysis was conducted with:
The larger Acero test set was evaluated with:
Substrait integration was not built locally. The regression test is defined at the native Acero ProjectNode level.
Are there any visible user impacts?
Yes. Top-level field projections copy the nullable attribute from input fields to output fields.
This change only alters the projected schema. Projected values remain the same.
There are no changes to public API or ABI signatures.
Was AI involved in this PR?
Yes. AI tools were used to assist with the investigation, implementation and test drafting, review, and preparation of this description.
I reproduced the issue locally and reviewed the patch, verifying that the test case failed without the patch and passed with the patch, and ran the listed C++ tests and style checks.
PR code and description by:
Reviewed before submission by: