-
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
Add example for ScalarStructBuilder::new_null
, fix display for null
ScalarValue::Struct
#9238
Conversation
ScalarStructBuilder::new_null
ScalarStructBuilder::new_null
, fix display for null
ScalarValue::Struct
ScalarStructBuilder::new_null
, fix display for null
ScalarValue::Struct
ScalarStructBuilder::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.
👍
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.
@@ -3103,6 +3103,11 @@ impl fmt::Display for ScalarValue { | |||
// 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 |
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_null
internally so I wanted to document it in an example here.When I did the PR the display didn't match what I thought
new_null
did, so I fixed a bug in null display as wellWhat changes are included in this PR?
ScalarStructBuilder::new_null
ScalarValue::Struct
null displayAre these changes tested?
Yes, new test and by CI
Are there any user-facing changes?