You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2023/09/10 11:45:19 UTC

[arrow-rs] branch master updated: fix: entries field is non-nullable (#4808)

This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new 77455d48cd fix: entries field is non-nullable (#4808)
77455d48cd is described below

commit 77455d48cd6609045a4728ba908123de9d0b62fd
Author: Will Jones <wi...@gmail.com>
AuthorDate: Sun Sep 10 04:45:14 2023 -0700

    fix: entries field is non-nullable (#4808)
---
 arrow-array/src/array/map_array.rs                               | 8 ++++----
 arrow-integration-testing/src/bin/arrow-json-integration-test.rs | 5 ++---
 arrow-ipc/src/reader.rs                                          | 4 ++--
 arrow-json/src/writer.rs                                         | 2 +-
 arrow-schema/src/ffi.rs                                          | 2 +-
 5 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/arrow-array/src/array/map_array.rs b/arrow-array/src/array/map_array.rs
index fca49cd783..77a7b9d4d5 100644
--- a/arrow-array/src/array/map_array.rs
+++ b/arrow-array/src/array/map_array.rs
@@ -330,7 +330,7 @@ impl MapArray {
             Arc::new(Field::new(
                 "entries",
                 entry_struct.data_type().clone(),
-                true,
+                false,
             )),
             false,
         );
@@ -477,7 +477,7 @@ mod tests {
             Arc::new(Field::new(
                 "entries",
                 entry_struct.data_type().clone(),
-                true,
+                false,
             )),
             false,
         );
@@ -523,7 +523,7 @@ mod tests {
             Arc::new(Field::new(
                 "entries",
                 entry_struct.data_type().clone(),
-                true,
+                false,
             )),
             false,
         );
@@ -645,7 +645,7 @@ mod tests {
             Arc::new(Field::new(
                 "entries",
                 entry_struct.data_type().clone(),
-                true,
+                false,
             )),
             false,
         );
diff --git a/arrow-integration-testing/src/bin/arrow-json-integration-test.rs b/arrow-integration-testing/src/bin/arrow-json-integration-test.rs
index 2c36e8d9b8..db5df8b58a 100644
--- a/arrow-integration-testing/src/bin/arrow-json-integration-test.rs
+++ b/arrow-integration-testing/src/bin/arrow-json-integration-test.rs
@@ -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(
@@ -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(),
diff --git a/arrow-ipc/src/reader.rs b/arrow-ipc/src/reader.rs
index 96cb4393ba..75c91be21d 100644
--- a/arrow-ipc/src/reader.rs
+++ b/arrow-ipc/src/reader.rs
@@ -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,
         ));
@@ -1506,7 +1506,7 @@ mod tests {
             Arc::new(Field::new(
                 "entries",
                 entry_struct.data_type().clone(),
-                true,
+                false,
             )),
             false,
         );
diff --git a/arrow-json/src/writer.rs b/arrow-json/src/writer.rs
index a918f44b54..a5b5a78190 100644
--- a/arrow-json/src/writer.rs
+++ b/arrow-json/src/writer.rs
@@ -1385,7 +1385,7 @@ mod tests {
             Arc::new(Field::new(
                 "entries",
                 entry_struct.data_type().clone(),
-                true,
+                false,
             )),
             false,
         );
diff --git a/arrow-schema/src/ffi.rs b/arrow-schema/src/ffi.rs
index cd3c207a56..a17dbe769f 100644
--- a/arrow-schema/src/ffi.rs
+++ b/arrow-schema/src/ffi.rs
@@ -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());