Skip to content

Commit

Permalink
fix: entries field is non-nullable (#4808)
Browse files Browse the repository at this point in the history
  • Loading branch information
wjones127 authored Sep 10, 2023
1 parent b4997bc commit 77455d4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
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.
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

0 comments on commit 77455d4

Please sign in to comment.