You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2026/07/03 20:48:51 UTC

Re: [PR] fix(arrow-array): disallow creating `MapArray` with nullable key field [arrow-rs]

alamb commented on code in PR #10272:
URL: https://github.com/apache/arrow-rs/pull/10272#discussion_r3521798134


##########
arrow-array/src/array/map_array.rs:
##########
@@ -109,6 +110,16 @@ impl MapArray {
             )));
         }
 
+        // The Arrow spec requires the "key" field to be non-nullable
+        // <https://github.com/apache/arrow/blob/98347d233f03bcf4d116d77f1769d498902b1fc8/format/Schema.fbs#L138>
+        if entries.fields()[0].is_nullable() {

Review Comment:
   Should we check the data type? Or maybe just the actual contents of the array (`null_count() > 0`)?



##########
arrow-array/src/array/map_array.rs:
##########
@@ -109,6 +110,16 @@ impl MapArray {
             )));
         }
 
+        // The Arrow spec requires the "key" field to be non-nullable
+        // <https://github.com/apache/arrow/blob/98347d233f03bcf4d116d77f1769d498902b1fc8/format/Schema.fbs#L138>
+        if entries.fields()[0].is_nullable() {

Review Comment:
   I worry that the data_type is not always set super precisely (as in there may be some code that claims the key is "nullable" for convenience, but in reality the key is not nullable)
   
   🤔 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org