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

Fix #8507: Non-null sub-field on nullable struct-field has wrong nullity #8623

Merged

Conversation

marvinlanhenke
Copy link
Contributor

Which issue does this PR close?

Closes #8507.

Rationale for this change

If parent struct is nullable; sub-fields should also be.

What changes are included in this PR?

As suggested in #8507:
I added a test to reproduce the bug with the schema described.
Then I introduced a simple guard clause to check if the parent col is nullable; if it is return early.

Are these changes tested?

Change is tested by test_nested_schema_nullability.

Are there any user-facing changes?

No.

@github-actions github-actions bot added the logical-expr Logical plan and expressions label Dec 22, 2023
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 for this contribution @marvinlanhenke -- it makes sense to me

let schema = DFSchema::new_with_metadata(vec![fields], HashMap::new()).unwrap();

let expr = col("parent").field("child");
assert_eq!(expr.nullable(&schema).unwrap(), true);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@alamb
Copy link
Contributor

alamb commented Dec 22, 2023

@marvinlanhenke it looks like there is a clippy error preventing a clean CI run: https://github.com/apache/arrow-datafusion/actions/runs/7299570999/job/19905117841?pr=8623

Is there any chance you can fix that so we can merge this PR?

@marvinlanhenke
Copy link
Contributor Author

@alamb thanks for the approval - i just committed the clippy-fix

@alamb alamb merged commit df2e1e2 into apache:main Dec 23, 2023
22 checks passed
@alamb
Copy link
Contributor

alamb commented Dec 23, 2023

THanks again @marvinlanhenke

@marvinlanhenke marvinlanhenke deleted the fix_wrong_nullity_on_nullable_struct_field branch December 23, 2023 12:10
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

non-null sub-field on nullable struct-field has wrong nullity.
3 participants