avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Cutting (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1362) Avro schema array cannot reference previously defined record types
Date Thu, 15 Aug 2013 21:33:49 GMT

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

Doug Cutting commented on AVRO-1362:
------------------------------------

The syntax is incorrect.  The correct way to refer to a named schema is just with its name
as a string, not with {"type":<name>}.  The latter syntax may only be used with one
of the fixed set of Avro schema types (null, boolean int, long, float, double, string, bytes,
record, fixed, enum, array or map), not with user type names.  The C# implementation is non-standard
in accepting this syntax.
                
> Avro schema array cannot reference previously defined record types
> ------------------------------------------------------------------
>
>                 Key: AVRO-1362
>                 URL: https://issues.apache.org/jira/browse/AVRO-1362
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.4
>         Environment: Schema class - org.apache.avro:avro:1.7.4
> Also confirmed in Avro 1.7.5 (RC)
>            Reporter: Bill Baird
>
> The following schema compiles successfully in Avro(c#), but in Avro(Java)returns a "Type
not supported: Invoice" when parsing the "ListOfInvoices" array.  
> Problem appears to be in the parse method.  \{"items": "Invoice"\} does not properly
parse to find the "Invoice" type.
> {   "namespace": "SampleClasses",
>     "name": "Batch",
>     "type": "record",
>     "fields": [
> 		{ "name": "Invoices", "type": {
> 				"type": "array",
> 				"items": {
>                             "name": "Invoice",
>                             "type": "record",
>                             "fields": [
>                                 { "name": "Id", "type": "string" }
>                             ]
> 						}
> 				}
> 		},
> 		{ "name": "SingleInvoice", "type": "Invoice" },            // This reference to "Invoice"
works fine.
> 		{ "name": "ListOfInvoices", "type": {
> 				"type": "array", "items": {	"type": "Invoice" }    // Fails - does not get previous
definition of "Invoice"
> 			    }
> 		}
> 	]
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message