yongkyunlee opened a new issue, #8209:
URL: https://github.com/apache/arrow-rs/issues/8209

   **Describe the bug**
   
   There is a bug in `arrow-avro` for an avro record that contains a default 
whose type is not string.
   
   The avro record schema should be converted to `Complex` schema (the comment 
says "A complex type such as record, array, map, etc.") but it is being 
converted to `Type` schema
   
   **To Reproduce**
   
   When we try to parse an avro schema that contains a field with int default 
value like
   ```
   {
     "type": "record",
       "name": "R",
       "fields": [
         {"name": "a", "type": "int", "default": 0}
       ]
   }
   ```
   by running
   ```
   let schema: Schema = serde_json::from_str(schema_json).expect("schema should 
parse");
       match &schema {
           Schema::Complex(ComplexType::Record(_)) => {}
           other => panic!("expected record schema, got: {:?}", other),
       }
   ```
   
   The code exists with error printing
   
   ```
   expected record schema, got: Type(Type { type: Ref("record"), attributes: 
Attributes { logical_type: None, additional: {"fields": Array [Object 
{"default": Number(0), "name": String("a"), "type": String("int")}], "name": 
String("R")} } })
   ```
   
   **Expected behavior**
   
   The schema should be something like
   
   ```
   Complex(Record(Record { name: "R", namespace: None, doc: None, aliases: [], 
fields: [Field { name: "a", doc: None, type: TypeName(Primitive(Int)), default: 
Some(Number(0)) }], attributes: Attributes { logical_type: None, additional: {} 
} }))
   ````
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->


-- 
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-unsubscr...@arrow.apache.org.apache.org

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

Reply via email to