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

ASF GitHub Bot updated AVRO-2771:
---------------------------------
    Labels: pull-request-available  (was: )

> 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.0, 1.9.1, 1.9.2
>            Reporter: Chris Dessonville
>            Assignee: Oscar Westra van Holthe - Kind
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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.
>  
> NOTE: This is not unique to my/my company's use case - someone on SO also hit 
> this: 
> [https://stackoverflow.com/questions/56977080/avro-1-9-0-failed-to-compile-generated-java-code-with-error-message-cannot-find]



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to