[ 
https://issues.apache.org/jira/browse/AVRO-3216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17469231#comment-17469231
 ] 

ASF subversion and git services commented on AVRO-3216:
-------------------------------------------------------

Commit b76a437b970889255703ff48f7ee5981dfbcc17a in avro's branch 
refs/heads/master from Martin Grigorov
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=b76a437 ]

AVRO-3216 Reuse records' schema by name (#1345)

* AVRO-3197 Fallback to the 'type' when the logical type does not support the 
type

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3197 Allow only when the "type" is "string"

* AVRO-3197 Handle problematic complex type for date/time logical types

Read the complex type recursively. It seems Avro Java may produce {"type": 
{"type": "string", "avro.java.string": "String"}, "logicalType": 
"timestamp-millis"}}, i.e. logicalType is on the same level as the outer "type"

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3216 Allow to reuse record's schema by name

* AVRO-3216 Extend the test case to do more assertions

* AVRO-3216 Print err with Debug

> Rust: failure reading multiple use of named schemas in file
> -----------------------------------------------------------
>
>                 Key: AVRO-3216
>                 URL: https://issues.apache.org/jira/browse/AVRO-3216
>             Project: Apache Avro
>          Issue Type: Bug
>            Reporter: Guðjón
>            Assignee: Martin Tzvetanov Grigorov
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.12.0
>
>         Attachments: weather-complex.avro
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> I have an avro file that contains records of a specific schema. The file is 
> written using the java implementation, with the generated classes. 
> The schema itself uses named schemas in a way where two or more fields use 
> the same named schema. A good example of this could be this weather schema 
> {code:json}
> {
>       "doc": "A weather reading.",
>       "name": "Weather",
>       "namespace": "test",
>       "type": "record",
>       "fields": [
>               {
>                       "name": "station",
>                       "type": "string"
>               },
>               {
>                       "name": "max_temp",
>                       "type": "Temp"
>               },
>               {
>                       "name": "min_temp",
>                       "type": "Temp"
>               }
>       ]
> }
> {code}
> with the named schema Temp being 
> {code:json}
> {
>       "doc": "A temperature reading.",
>       "name": "Temp",
>       "namespace": "test",
>       "type": "record",
>       "fields": [
>               {
>                       "name": "temp",
>                       "type": "long"
>               }
>       ]
> }
> {code}
> The schema that is written in the file inlines the Temp schema in the case of 
> the first field (max_temp) but references it by name in the second field 
> (min_temp). In both java and python implementations it manages to read the 
> file correctly but the avro-rs crate fails on the second field with a message:
> {noformat}
> panicked at 'Failure reading file: Unknown primitive type: Temp'
> {noformat}
> The attached file weather-complex.avro is a file written using the java 
> library with generated classes and contains one record. 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to