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: entries field is non-nullable #4808

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions arrow-array/src/array/map_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ impl MapArray {
Arc::new(Field::new(
"entries",
entry_struct.data_type().clone(),
true,
false,
)),
false,
);
Expand Down Expand Up @@ -477,7 +477,7 @@ mod tests {
Arc::new(Field::new(
"entries",
entry_struct.data_type().clone(),
true,
false,
)),
false,
);
Expand Down Expand Up @@ -523,7 +523,7 @@ mod tests {
Arc::new(Field::new(
"entries",
entry_struct.data_type().clone(),
true,
false,
)),
false,
);
Expand Down Expand Up @@ -645,7 +645,7 @@ mod tests {
Arc::new(Field::new(
"entries",
entry_struct.data_type().clone(),
true,
false,
)),
false,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ fn canonicalize_schema(schema: &Schema) -> Schema {
let key_field = Arc::new(Field::new(
"key",
first_field.data_type().clone(),
first_field.is_nullable(),
false,
));
let second_field = fields.get(1).unwrap();
let value_field = Arc::new(Field::new(
Expand All @@ -135,8 +135,7 @@ fn canonicalize_schema(schema: &Schema) -> Schema {

let fields = Fields::from([key_field, value_field]);
let struct_type = DataType::Struct(fields);
let child_field =
Field::new("entries", struct_type, child_field.is_nullable());
let child_field = Field::new("entries", struct_type, false);

Arc::new(Field::new(
field.name().as_str(),
Expand Down
4 changes: 2 additions & 2 deletions arrow-ipc/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,7 @@ mod tests {
let keys_field = Arc::new(Field::new_dict(
"keys",
DataType::Dictionary(Box::new(DataType::Int8), Box::new(DataType::Utf8)),
true,
true, // It is technically not legal for this field to be null.
Copy link
Member

@viirya viirya Sep 10, 2023

Choose a reason for hiding this comment

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

This cannot be set to false?

Copy link
Member Author

Choose a reason for hiding this comment

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

The test itself has null values in the test case. Perhaps I should modify the test case?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I got what you mean. Okay to keep it as is.

1,
false,
));
Expand All @@ -1506,7 +1506,7 @@ mod tests {
Arc::new(Field::new(
"entries",
entry_struct.data_type().clone(),
true,
false,
)),
false,
);
Expand Down
2 changes: 1 addition & 1 deletion arrow-json/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ mod tests {
Arc::new(Field::new(
"entries",
entry_struct.data_type().clone(),
true,
false,
)),
false,
);
Expand Down
2 changes: 1 addition & 1 deletion arrow-schema/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ mod tests {

// Construct a map array from the above two
let map_data_type =
DataType::Map(Arc::new(Field::new("entries", entry_struct, true)), true);
DataType::Map(Arc::new(Field::new("entries", entry_struct, false)), true);

let arrow_schema = FFI_ArrowSchema::try_from(map_data_type).unwrap();
assert!(arrow_schema.map_keys_sorted());
Expand Down
Loading