avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Elliot West (JIRA)" <j...@apache.org>
Subject [jira] [Created] (AVRO-1963) Redefined records should fail fast
Date Tue, 29 Nov 2016 17:05:58 GMT
Elliot West created AVRO-1963:

             Summary: Redefined records should fail fast
                 Key: AVRO-1963
                 URL: https://issues.apache.org/jira/browse/AVRO-1963
             Project: Avro
          Issue Type: Bug
    Affects Versions: 1.8.1, 1.7.7
            Reporter: Elliot West

h2. Overview
It is currently possible to build an invalid {{Schema}} instance using the {{SchemaBuilder}},
without any error being thrown. The schema in question is invalid because of redefined record
types. These are not picked up by the {{SchemaBuilder}}. Failure eventually occurs when calling
the {{Schema.toString()}} method.

I suggest that failure should occur much earlier such as at the point of introduction of the
redeclared record name in the case of {{SchemaBuilder}}. This would make it easier for users
to better determine the point of origin of their schema issues.

Note that there does not appear to be a similar issue with the {{Schema.parse(String)}} method
which fails fast as expected.

h2. Test case
{code:title=Test case}
    Schema a = SchemaBuilder.record("A").fields().optionalInt("y").endRecord();
    Schema b = SchemaBuilder.record("A").fields().optionalString("x").endRecord();
    Schema s = SchemaBuilder
    // Does not fail
    // Fails with org.apache.avro.SchemaParseException: Can't redefine: A

This message was sent by Atlassian JIRA

View raw message