You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Nick B (Jira)" <ji...@apache.org> on 2021/01/03 08:08:00 UTC

[jira] [Created] (ARROW-11114) [Java] Metadata serialization is broken for Field class

Nick B created ARROW-11114:
------------------------------

             Summary: [Java] Metadata serialization is broken for Field class
                 Key: ARROW-11114
                 URL: https://issues.apache.org/jira/browse/ARROW-11114
             Project: Apache Arrow
          Issue Type: Bug
          Components: Java
    Affects Versions: 2.0.0
            Reporter: Nick B


org.apache.arrow.vector.types.pojo.Field uses asymmetric serialization and deserialization for the metadata field, causing it to fail to deserialize with the following error:
{noformat}
Exception in thread "main" com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.ArrayList` out of START_OBJECT tokenException in thread "main" com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.ArrayList` out of START_OBJECT token at [Source: (File); line: 10, column: 20] (through reference chain: org.apache.arrow.vector.types.pojo.Schema["fields"]->java.util.ArrayList[0]->org.apache.arrow.vector.types.pojo.Field["metadata"]) {noformat}
This is because the class [serializes metadata|https://github.com/apache/arrow/blob/dfef236f7587e4168ac1e07bd09e42d9373beb70/java/vector/src/main/java/org/apache/arrow/vector/types/pojo/Field.java#L274] as {{Map<String, String>}} but [expects to deserialize it|https://github.com/apache/arrow/blob/dfef236f7587e4168ac1e07bd09e42d9373beb70/java/vector/src/main/java/org/apache/arrow/vector/types/pojo/Field.java#L87] as {{List<Map<String, String>>}}. 

MCVE: [https://gist.github.com/nbruno/983cb7faf41dc20a0810ae80fe33562d]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)