sudssf opened a new issue #792: AvroSchemaUtil.toIceberg does not process 
logicalType during schema conversion
URL: https://github.com/apache/incubator-iceberg/issues/792
 
 
   Following is sample tests which shows that schema conversion from avro does 
not reflect logical type from avro schema.
   
   debugging shows that logical type is set in to props variable butis not set 
to `logicalType` instance veriable which is used by `SchemaToType`:165
   
   do we need to add code to check logical type from props?
   ```
   import org.apache.avro.LogicalType;
   import org.apache.avro.LogicalTypes;
   import org.apache.avro.Schema;
   import org.apache.iceberg.types.Type;
   import org.junit.Test;
   import java.io.IOException;
   import static org.junit.Assert.assertEquals;
   
   String oldAvro =
                   String.join("\n",
                           " { ",
                           " \"type\": \"record\", ",
                           " \"name\": \"ExampleRecord\", ",
                           " \"fields\" : [ ",
                           " {\"name\": \"myField\", \"type\": \"long\", 
\"logicalType\" : \"timestamp-micros\"}, ",
                           " {\"name\": \"myField1\", \"type\": \"long\", 
\"logicalType\" : \"timestamp-millis\"}, ",
                           " {\"name\": \"myField2\", \"type\": \"long\", 
\"logicalType\" : \"time-millis\"}, ",
                           " {\"name\": \"otherField\", \"type\": \"string\"} ",
                           " ] ",
                           " }");
   
           Schema.Parser parser = new Schema.Parser();
           Schema avroSchema = parser.parse(oldAvro);
           org.apache.iceberg.Schema iceSchema = 
AvroSchemaUtil.toIceberg(avroSchema);
           assertEquals(iceSchema.findField("myField2").type(), 
Type.PrimitiveType.TypeID.TIME);
           System.out.println(avroSchema.toString());
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to