You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Nikeshh Baskaran (Jira)" <ji...@apache.org> on 2020/04/21 06:04:00 UTC
[jira] [Updated] (AVRO-2809) SD to Avro Conversion -
SchemaParseException: can't redefine roleNotesGroup
[ https://issues.apache.org/jira/browse/AVRO-2809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nikeshh Baskaran updated AVRO-2809:
-----------------------------------
Environment: (was: *I am working on converting xsd to avro schema*
*XSD snippet:*
{{<xsd:element name="*roleNotesGroup*"><xsd:complexType><xsd:sequence><xsd:element name="*roleNotesSubGroup*" minOccurs="0" maxOccurs="unbounded"><xsd:complexType><xsd:sequence><xsd:element name="*roleNotesGroup*" minOccurs="0" maxOccurs="unbounded"><xsd:complexType><xsd:sequence><xsd:element name="roleNotes" type="xsd:string" minOccurs="0"><xsd:annotation><xsd:appinfo><source application="CUSTOMER" field="REL.CUSTOMER"/><fieldPiiAttribute value="INDIRECT"/><fieldPiiPurpose value="LEGITIMATE"/><fieldPiiEraseOption value="NO.ACTION"/><fieldPiiAccessibility value="ACCESS PORTABLE"/></xsd:appinfo></xsd:annotation></xsd:element></xsd:sequence><xsd:attribute name="index" type="xsd:integer"/></xsd:complexType></xsd:element></xsd:sequence><xsd:attribute name="index" type="xsd:integer"/></xsd:complexType></xsd:element></xsd:sequence><xsd:attribute name="index" type="xsd:integer"/></xsd:complexType></xsd:element>}}
{{}}
I am using
*{{Schema schema = Schema.createRecord(name, null, null, false);}}*
to create a avro schema record. In the above xsd roleNotesGroup is a child of roleNotesSubGroup which is a child of roleNotesGroup. I can recursively obtain the avro schema till roleNotesSubGroup which is then converted to list.
*{{List<Schema.Field> is obtained recursively.}}*
{{}}
{{}}
Now the problem is when i try to add the Fields formed to the head element roleNotesGroup using
{{*Schema schema = Schema.createRecord(name, null, null, false);schema.setFields(schemaFields**);*}}
{{}}
*I get the following error : SchemaParseException: can't redefine roleNotesGroup*
*Is there any restriction in avro or avro conversion that the same names should not occur again?*)
> SD to Avro Conversion - SchemaParseException: can't redefine roleNotesGroup
> ---------------------------------------------------------------------------
>
> Key: AVRO-2809
> URL: https://issues.apache.org/jira/browse/AVRO-2809
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.9.2
> Reporter: Nikeshh Baskaran
> Priority: Blocker
>
> *I am working on converting xsd to avro schema*
>
> *XSD snippet:*
>
> {{<xsd:element name="*roleNotesGroup*"><xsd:complexType><xsd:sequence><xsd:element name="*roleNotesSubGroup*" minOccurs="0" maxOccurs="unbounded"><xsd:complexType><xsd:sequence><xsd:element name="*roleNotesGroup*" minOccurs="0" maxOccurs="unbounded"><xsd:complexType><xsd:sequence><xsd:element name="roleNotes" type="xsd:string" minOccurs="0"><xsd:annotation><xsd:appinfo><source application="CUSTOMER" field="REL.CUSTOMER"/><fieldPiiAttribute value="INDIRECT"/><fieldPiiPurpose value="LEGITIMATE"/><fieldPiiEraseOption value="NO.ACTION"/><fieldPiiAccessibility value="ACCESS PORTABLE"/></xsd:appinfo></xsd:annotation></xsd:element></xsd:sequence><xsd:attribute name="index" type="xsd:integer"/></xsd:complexType></xsd:element></xsd:sequence><xsd:attribute name="index" type="xsd:integer"/></xsd:complexType></xsd:element></xsd:sequence><xsd:attribute name="index" type="xsd:integer"/></xsd:complexType></xsd:element>}}
> {{}}
> I am using
> *{{Schema schema = Schema.createRecord(name, null, null, false);}}*
> to create a avro schema record. In the above xsd roleNotesGroup is a child of roleNotesSubGroup which is a child of roleNotesGroup. I can recursively obtain the avro schema till roleNotesSubGroup which is then converted to list.
>
> *{{List<Schema.Field> is obtained recursively.}}*
> {{}}
> {{}}
> Now the problem is when i try to add the Fields formed to the head element roleNotesGroup using
>
> {{*Schema schema = Schema.createRecord(name, null, null, false);schema.setFields(schemaFields**);*}}
> {{}}
> *I get the following error : SchemaParseException: can't redefine roleNotesGroup*
>
> *Is there any restriction in avro or avro conversion that the same names should not occur again?*
--
This message was sent by Atlassian Jira
(v8.3.4#803005)