[ 
https://issues.apache.org/jira/browse/AVRO-2174?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael A. Smith updated AVRO-2174:
-----------------------------------
    Description: 
The Avro spec does not allow for spaces *' '*  in enums. However, Python Avro 
does not error out or reject enums with spaces in them.

This is an example enum schema which was accepted by the python package:

{code}
{
  "symbols": [
    "top left",
    "top center",
    "top right",
    "center left",
    "center center",
    "center right",
    "bottom left",
    "bottom center",
    "bottom right"
  ],
  "type": "enum",
  "namespace": "",
  "name": "postion_enum"
}
{code}

The same schema, when read by the Java library errors out at *top left* as 
expected:

{code}

Caused by: org.shaded.apache.avro.SchemaParseException: Illegal character in: 
top left
 at org.shaded.apache.avro.Schema.validateName(Schema.java:1151)
 at org.shaded.apache.avro.Schema.access$200(Schema.java:81)
 at org.shaded.apache.avro.Schema$EnumSchema.<init>(Schema.java:749)
 at org.shaded.apache.avro.Schema.parse(Schema.java:1300)
 at org.shaded.apache.avro.Schema.parse(Schema.java:1340)
 at org.shaded.apache.avro.Schema.parse(Schema.java:1269)
 at org.shaded.apache.avro.Schema$Parser.parse(Schema.java:1032)
 at org.shaded.apache.avro.Schema$Parser.parse(Schema.java:1020)

{code}

  was:
The Avro spec does not allow for spaces *' '*  in enums. However, Python Avro 
does not error out or reject enums with spaces in them.

This is an example of a part of a schema which was accepted by the python 
package:

{code}

{
"default": null,
"type": [
"null",
{
"symbols": [
"top left",
"top center",
"top right",
"center left",
"center center",
"center right",
"bottom left",
"bottom center",
"bottom right"
],
"type": "enum",
"namespace": "",
"name": "postion_enum"
}

{code}

 

The same schema, when read by the Java library errors out at *top left* as 
expected:

{code}

Caused by: org.shaded.apache.avro.SchemaParseException: Illegal character in: 
top left
 at org.shaded.apache.avro.Schema.validateName(Schema.java:1151)
 at org.shaded.apache.avro.Schema.access$200(Schema.java:81)
 at org.shaded.apache.avro.Schema$EnumSchema.<init>(Schema.java:749)
 at org.shaded.apache.avro.Schema.parse(Schema.java:1300)
 at org.shaded.apache.avro.Schema.parse(Schema.java:1340)
 at org.shaded.apache.avro.Schema.parse(Schema.java:1269)
 at org.shaded.apache.avro.Schema$Parser.parse(Schema.java:1032)
 at org.shaded.apache.avro.Schema$Parser.parse(Schema.java:1020)

{code}


> Enums with spaces are accepted
> ------------------------------
>
>                 Key: AVRO-2174
>                 URL: https://issues.apache.org/jira/browse/AVRO-2174
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: python
>    Affects Versions: 1.8.2
>            Reporter: Harshal Dalvi
>            Priority: Major
>
> The Avro spec does not allow for spaces *' '*  in enums. However, Python Avro 
> does not error out or reject enums with spaces in them.
> This is an example enum schema which was accepted by the python package:
> {code}
> {
>   "symbols": [
>     "top left",
>     "top center",
>     "top right",
>     "center left",
>     "center center",
>     "center right",
>     "bottom left",
>     "bottom center",
>     "bottom right"
>   ],
>   "type": "enum",
>   "namespace": "",
>   "name": "postion_enum"
> }
> {code}
> The same schema, when read by the Java library errors out at *top left* as 
> expected:
> {code}
> Caused by: org.shaded.apache.avro.SchemaParseException: Illegal character in: 
> top left
>  at org.shaded.apache.avro.Schema.validateName(Schema.java:1151)
>  at org.shaded.apache.avro.Schema.access$200(Schema.java:81)
>  at org.shaded.apache.avro.Schema$EnumSchema.<init>(Schema.java:749)
>  at org.shaded.apache.avro.Schema.parse(Schema.java:1300)
>  at org.shaded.apache.avro.Schema.parse(Schema.java:1340)
>  at org.shaded.apache.avro.Schema.parse(Schema.java:1269)
>  at org.shaded.apache.avro.Schema$Parser.parse(Schema.java:1032)
>  at org.shaded.apache.avro.Schema$Parser.parse(Schema.java:1020)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to