-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix #8507: Non-null sub-field on nullable struct-field has wrong nullity #8623
Conversation
There was a problem hiding this 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
datafusion/expr/src/expr_schema.rs
Outdated
let schema = DFSchema::new_with_metadata(vec![fields], HashMap::new()).unwrap(); | ||
|
||
let expr = col("parent").field("child"); | ||
assert_eq!(expr.nullable(&schema).unwrap(), true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@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? |
@alamb thanks for the approval - i just committed the |
THanks again @marvinlanhenke |
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.