You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Christophe Le Saec (Jira)" <ji...@apache.org> on 2022/08/03 13:00:00 UTC

[jira] [Commented] (AVRO-2796) Generated schema class can't be compiled: code too large

    [ https://issues.apache.org/jira/browse/AVRO-2796?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17574719#comment-17574719 ] 

Christophe Le Saec commented on AVRO-2796:
------------------------------------------

Model on [^record.avsc] sounds tricky. [^recordfixed.avsc] model just replaces long lists of fields like "prop1", "prop2" ... "prop100" ... by one field props that is an array of ... And it's enough to make it works. No needs to have sub-records like "mobile", "city" ... even if it could be better with.

So, what about closing this ticket ?

> Generated schema class can't be compiled: code too large
> --------------------------------------------------------
>
>                 Key: AVRO-2796
>                 URL: https://issues.apache.org/jira/browse/AVRO-2796
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.9.2
>         Environment: {code:java}
> $ uname -a
> Linux barlnx 5.4.28-gentoo-PRI #1 SMP PREEMPT Mon Mar 30 19:39:16 EEST 2020 x86_64 Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz GenuineIntel GNU/Linux{code}
> {code:java}
> $ java -version
> java version "1.8.0_202"
> Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
> Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode){code}
>            Reporter: DMYTRO TRUNYKOV
>            Priority: Major
>         Attachments: record.avsc, recordfixed.avsc
>
>
> Hi,
> I have a schema (see the attach) that can be compiled into Java source code and then compiled by javac.
> This works for the AVRO release 1.8.2, but fails with the 1.9.2.
> Below are examples.
> Happy path (AVRO version 1.8.2):
> {code:java}
> $ java -jar avro-tools-1.8.2.jar compile -string schema record.avsc generated_sources/
> Input files to compile:
>  record.avsc
> log4j:WARN No appenders could be found for logger (AvroVelocityLogChute).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
> $ javac -cp avro-tools-1.8.2.jar generated_sources/example/avro/therecord.java
> $ tree generated_sources/
> generated_sources/
> └── example
>  └── avro
>  ├── therecord$1.class
>  ├── therecord$Builder.class
>  ├── therecord.class
>  └── therecord.java
> {code}
>  
> Unhappy path (AVRO version 1.9.2):
> {code:java}
> $ java -jar avro-tools-1.9.2.jar compile -string schema record.avsc generated_sources/
> Input files to compile:
>  record.avsc
> 20/04/12 13:51:27 WARN velocity.deprecation: configuration key 'resource.loader' has been deprecated in favor of 'resource.loaders'
> 20/04/12 13:51:27 WARN velocity.deprecation: configuration key 'class.resource.loader.class' has been deprecated in favor of 'resour
> ce.loader.class.class'
> 20/04/12 13:51:27 WARN velocity.deprecation: configuration key 'file.resource.loader.class' has been deprecated in favor of 'resourc
> e.loader.file.class'
> 20/04/12 13:51:27 WARN velocity.deprecation: configuration key 'file.resource.loader.path' has been deprecated in favor of 'resource
> .loader.file.path'
> 20/04/12 13:51:27 WARN velocity.deprecation: configuration key 'runtime.references.strict' has been deprecated in favor of 'runtime.
> strict_mode.enable'
> 20/04/12 13:51:27 WARN velocity.deprecation: configuration key 'space.gobbling' has been deprecated in favor of 'parser.space_gobbling'
> 20/04/12 13:51:27 WARN specific.SpecificCompiler: Record 'example.avro.therecord' contains more than 254 parameters which exceeds the JVM spec for the number of permitted constructor arguments. Clients must rely on the builder pattern to create objects instead. For more info see JIRA ticket AVRO-1642.
> $ javac -cp avro-tools-1.9.2.jar generated_sources/example/avro/therecord.java
> generated_sources/example/avro/therecord.java:24600: error: code too large
>  private Builder(example.avro.therecord.Builder other) {
>  ^
> generated_sources/example/avro/therecord.java:90993: error: code too large
>  @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in)
>  ^
> 2 errors
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)