-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add example for ScalarStructBuilder::new_null, fix display for null ScalarValue::Struct
#9238
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
Conversation
ScalarStructBuilder::new_nullScalarStructBuilder::new_null, fix display for null ScalarValue::Struct
ScalarStructBuilder::new_null, fix display for null ScalarValue::StructScalarStructBuilder::new_null, fix display for null ScalarValue::Struct
| /// Note this is different from a struct where each of the specified fields | ||
| /// are null (e.g. `{a: NULL}`) | ||
| /// |
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.
👍
viirya
left a comment
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.
Looks good to me.
| // ScalarValue Struct should always have a single element | ||
| assert_eq!(struct_arr.len(), 1); | ||
|
|
||
| if struct_arr.null_count() == struct_arr.len() { |
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.
This is the bug fix
| let batch = RecordBatch::try_from_iter(vec![("s", arr as _)]).unwrap(); | ||
|
|
||
| #[rustfmt::skip] | ||
| let expected = [ |
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.
This shows that new_null really does create a null value (and thus the change to impl Display is correct)
|
FYI @jayzhan211 |
jayzhan211
left a comment
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.
LGTM
Which issue does this PR close?
Follow on to #9229
related to #9227
Rationale for this change
@NGA-TRAN asked internally about exactly what
ScalarStructBuilder::new_nullinternally so I wanted to document it in an example here.When I did the PR the display didn't match what I thought
new_nulldid, so I fixed a bug in null display as wellWhat changes are included in this PR?
ScalarStructBuilder::new_nullScalarValue::Structnull displayAre these changes tested?
Yes, new test and by CI
Are there any user-facing changes?