[ https://issues.apache.org/jira/browse/AVRO-1340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16429851#comment-16429851 ]
Adam Bellemare edited comment on AVRO-1340 at 4/8/18 7:03 PM: -------------------------------------------------------------- [~cutting] - Thanks for the code solution above - however, I notice that my simple.avdl fails when trying that code (this is actually exactly pretty much what I had when I got stuck and couldn't find a way out). The results below show the compiler/src/test/idl/input/simple.avdl file failing: {code:java} ------------------------------------------------------- T E S T S ------------------------------------------------------- Running org.apache.avro.compiler.idl.TestIdl Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.397 sec <<< FAILURE! - in org.apache.avro.compiler.idl.TestIdl runTests(org.apache.avro.compiler.idl.TestIdl) Time elapsed: 0.336 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<...ame":"Kind","doc":"A[ kind of record.","symbols":["FOO","BAR","BAZ"],"aliases":["org.foo.KindOf"]},{"type":"fixed","name":"MD5","doc":"An MD5 hash.]","size":16,"foo":"b...> but was:<...ame":"Kind","doc":"A[n MD5 hash.","symbols":["FOO","BAR","BAZ"],"aliases":["org.foo.KindOf"]}, {"type":"fixed","name":"MD5]","size":16,"foo":"b...> at org.apache.avro.compiler.idl.TestIdl.runTests(TestIdl.java:95) {code} It looks like the comment for the Fixed MD5 get parsed into the Kind enum. Did you not get this error? I have just pulled down the latest avro code today and have built my branch off of master. If you do not see this error though it would be very reassuring and I would just need to figure out why my tests are protesting. As for [~howellbridger]'s two points about using the Default notation vs adding a new syntax, I can't really provide much insight one way or another on which I think would be better. I am open to suggestions if we do not wish to go with a format like: {code:java} enum Foo {A,B,C} = C {code} Thanks for your help so far everyone was (Author: abellemare): [~cutting] - Thanks for the code solution above - however, I notice that my simple.avdl fails when trying that code (this is actually exactly pretty much what I had when I got stuck and couldn't find a way out). The results below show the compiler/src/test/idl/input/simple.avdl file failing: ``` ------------------------------------------------------- T E S T S ------------------------------------------------------- Running org.apache.avro.compiler.idl.TestIdl Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.397 sec <<< FAILURE! - in org.apache.avro.compiler.idl.TestIdl runTests(org.apache.avro.compiler.idl.TestIdl) Time elapsed: 0.336 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<...ame":"Kind","doc":"A[ kind of record.","symbols":["FOO","BAR","BAZ"],"aliases":["org.foo.KindOf"]},\{"type":"fixed","name":"MD5","doc":"An MD5 hash.]","size":16,"foo":"b...> but was:<...ame":"Kind","doc":"A[n MD5 hash.","symbols":["FOO","BAR","BAZ"],"aliases":["org.foo.KindOf"]},{"type":"fixed","name":"MD5]","size":16,"foo":"b...> at org.apache.avro.compiler.idl.TestIdl.runTests(TestIdl.java:95) ``` It looks like the comment for the Fixed MD5 get parsed into the Kind enum. Did you not get this error? I have just pulled down the latest avro code today and have built my branch off of master. If you do not see this error though it would be very reassuring and I would just need to figure out why my tests are protesting. As for [~howellbridger]'s two points about using the Default notation vs adding a new syntax, I can't really provide much insight one way or another on which I think would be better. I am open to suggestions if we do not wish to go with a format like: ``` enum Foo \{A,B,C} = C ``` Thanks for your help so far everyone > use default to allow old readers to specify default enum value when > encountering new enum symbols > ------------------------------------------------------------------------------------------------- > > Key: AVRO-1340 > URL: https://issues.apache.org/jira/browse/AVRO-1340 > Project: Avro > Issue Type: Improvement > Components: spec > Environment: N/A > Reporter: Jim Donofrio > Priority: Minor > > The schema resolution page says: > > if both are enums: > > if the writer's symbol is not present in the reader's enum, then an > error is signalled. > This makes it difficult to use enum's because you can never add a enum value > and keep old reader's compatible. Why not use the default option to refer to > one of enum values so that when a old reader encounters a enum ordinal it > does not recognize, it can default to the optional schema provided one. If > the old schema does not provide a default then the older reader can continue > to fail as it does today. -- This message was sent by Atlassian JIRA (v7.6.3#76005)