You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "wgtmac (via GitHub)" <gi...@apache.org> on 2023/04/24 08:36:54 UTC

[GitHub] [arrow] wgtmac opened a new issue, #35297: [C++][IPC] Schema deserialization does not preserve metadata of map field

wgtmac opened a new issue, #35297:
URL: https://github.com/apache/arrow/issues/35297

   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   The code below does not deal with field metadata like `nullable` and `metadata` of key and item sub-fields of map type.
   
   ```cpp
   Status ConcreteTypeFromFlatbuffer(flatbuf::Type type, const void* type_data,
                                     FieldVector children, std::shared_ptr<DataType>* out) {
     switch (type) {
       case flatbuf::Type::NONE:
         return Status::Invalid("Type metadata cannot be none");
       ...
       case flatbuf::Type::Map:
         if (children.size() != 1) {
           return Status::Invalid("Map must have exactly 1 child field");
         }
         if (children[0]->nullable() || children[0]->type()->id() != Type::STRUCT ||
             children[0]->type()->num_fields() != 2) {
           return Status::Invalid("Map's key-item pairs must be non-nullable structs");
         }
         if (children[0]->type()->field(0)->nullable()) {
           return Status::Invalid("Map's keys must be non-nullable");
         } else {
           auto map = static_cast<const flatbuf::Map*>(type_data);
           *out = std::make_shared<MapType>(children[0]->type()->field(0)->type(),
                                            children[0]->type()->field(1)->type(),
                                            map->keysSorted());
         }
         return Status::OK();
       ...
       default:
         return Status::Invalid("Unrecognized type: " + ToChars(static_cast<int>(type)));
     }
   }
   ```
   
   The issue can be easily reproduced by a roundtrip test of schema serialization with a non-null map item field.
   
   ### Component(s)
   
   C++


-- 
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: issues-unsubscribe@arrow.apache.org.apache.org

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


[GitHub] [arrow] wjones127 closed issue #35297: [C++][IPC] Schema deserialization does not preserve metadata of map field

Posted by "wjones127 (via GitHub)" <gi...@apache.org>.
wjones127 closed issue #35297: [C++][IPC] Schema deserialization does not preserve metadata of map field
URL: https://github.com/apache/arrow/issues/35297


-- 
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: issues-unsubscribe@arrow.apache.org

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