-
Notifications
You must be signed in to change notification settings - Fork 832
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
Ensure StructArrays check nullability of fields #3205
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,8 +37,8 @@ use std::sync::Arc; | |
/// | ||
/// let string_builder = builder.keys(); | ||
/// string_builder.append_value("joe"); | ||
/// string_builder.append_null(); | ||
/// string_builder.append_null(); | ||
/// string_builder.append_value("n1"); | ||
/// string_builder.append_value("n2"); | ||
/// string_builder.append_value("mark"); | ||
/// | ||
/// let int_builder = builder.values(); | ||
|
@@ -58,7 +58,7 @@ use std::sync::Arc; | |
/// ); | ||
/// assert_eq!( | ||
/// *arr.keys(), | ||
/// StringArray::from(vec![Some("joe"), None, None, Some("mark")]) | ||
/// StringArray::from(vec![Some("joe"), Some("n1"), Some("n2"), Some("mark")]) | ||
/// ); | ||
/// ``` | ||
#[derive(Debug)] | ||
|
@@ -286,8 +286,8 @@ mod tests { | |
|
||
let string_builder = builder.keys(); | ||
string_builder.append_value("joe"); | ||
string_builder.append_null(); | ||
string_builder.append_null(); | ||
string_builder.append_value("n1"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably add an error to MapArrayBuilder so that it returns a meaningful error if you try to create a keys array with nulls. I believe this may overlap somewhat with #1697 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can give this a shot, but probably won't get much progress until the weekend, so can open a separate PR if needed |
||
string_builder.append_value("n2"); | ||
string_builder.append_value("mark"); | ||
|
||
let int_builder = builder.values(); | ||
|
@@ -312,9 +312,8 @@ mod tests { | |
|
||
let expected_string_data = ArrayData::builder(DataType::Utf8) | ||
.len(4) | ||
.null_bit_buffer(Some(Buffer::from(&[9_u8]))) | ||
.add_buffer(Buffer::from_slice_ref([0, 3, 3, 3, 7])) | ||
.add_buffer(Buffer::from_slice_ref(b"joemark")) | ||
.add_buffer(Buffer::from_slice_ref([0, 3, 5, 7, 11])) | ||
.add_buffer(Buffer::from_slice_ref(b"joen1n2mark")) | ||
.build() | ||
.unwrap(); | ||
|
||
|
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 actually highlights a somewhat fun issue that I'm also running into with the row format (#3159), namely how to create a null
StructArray
with children that aren't nullable. I think new_null_array should discard the null mask for its children, but I'm not 100% sure. I need to think a bit more on this