HuaHuaY commented on issue #49114:
URL: https://github.com/apache/arrow/issues/49114#issuecomment-3839473577

   There is another bug when reading such schema:
   
   ```thrift
     required group list_of_maps (LIST) {
       repeated group array (MAP) {
         repeated group key_value (MAP_KEY_VALUE) {
           required binary key (STRING);
           required binary value (STRING);
         }
       }
     }
   ```
   
   ```java
       Schema schema = new Schema.Parser().parse("{"
           + "\"type\":\"record\","
           + "\"name\":\"complex_record\","
           + "\"fields\":["
           + "  {\"name\":\"list_of_maps\", \"type\":{\"type\":\"array\", 
\"items\":{\"type\":\"map\", \"values\":\"string\"}}}"
           + "]"
           + "}");
   
       // list<map<string,string>>
       // We create a GenericData.Array using the schema for the 'list_of_maps' 
field
       Schema listOfMapsSchema = schema.getField("list_of_maps").schema();
       record.put("list_of_maps", new GenericData.Array<Map<String, String>>(2, 
listOfMapsSchema) {
         {
           add(new HashMap<String, String>() {
             {
               put("listKey1", "listVal1");
             }
           });
           add(new HashMap<String, String>() {
             {
               put("listKey2", "listVal2");
             }
           });
         }
       });
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to