You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Chris Dessonville (Jira)" <ji...@apache.org> on 2020/03/05 18:38:00 UTC

[jira] [Created] (AVRO-2771) Java 1.9.X doesn't allow having Error in a Record

Chris Dessonville created AVRO-2771:
---------------------------------------

             Summary: Java 1.9.X doesn't allow having Error in a Record
                 Key: AVRO-2771
                 URL: https://issues.apache.org/jira/browse/AVRO-2771
             Project: Apache Avro
          Issue Type: Bug
          Components: java
    Affects Versions: 1.9.2, 1.9.1, 1.9.0
            Reporter: Chris Dessonville


While trying to upgrade from AVRO 1.8.2 to 1.9.X, we hit an unexpected compilation error.  The same code works fine in 1.8.2 and even sends over the wire correctly, so it's definitely been supported historically.  The issue occurs when you put an {{error}} inside of a {{record}}.  I've created a project (further below) to show the issue.

 

The errors seen is this:
{code:java}
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/chris/git/github/cddude229/avro-1-9-x-error-in-record/target/generated-sources/avro/MyRecord.java:[324,19] cannot find symbol
  symbol:   method customEncode(org.apache.avro.io.Encoder)
  location: variable someError of type MyError
[ERROR] /Users/chris/git/github/cddude229/avro-1-9-x-error-in-record/target/generated-sources/avro/MyRecord.java:[336,21] cannot find symbol
  symbol:   method customDecode(org.apache.avro.io.ResolvingDecoder)
  location: variable someError of type MyError
[ERROR] /Users/chris/git/github/cddude229/avro-1-9-x-error-in-record/target/generated-sources/avro/MyRecord.java:[345,25] cannot find symbol
  symbol:   method customDecode(org.apache.avro.io.ResolvingDecoder)
  location: variable someError of type MyError
[INFO] 3 errors {code}
 

 

Sample project: [https://github.com/cddude229/avro-1-9-x-error-in-record]

 

Commands you can use (defaults to 1.8.2 since that compiles):
{code:java}
mvn install -Davro.version=1.9.2
mvn install -Davro.version=1.8.2{code}
 

In terms of solutions, I'd love to see the old behavior restored.  However, if avro is moving to stop supporting an {{error}} in a {{record}}, then I'd suggest that this be a schema validation/error then, instead of while compiling Java.



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