julianpeeters / avrohugger

Generate Scala case class definitions from Avro schemas
Apache License 2.0
202 stars 120 forks source link

AvroGenerateSpecific can generate a schema$ val with length beyond JVM constant limit #167

Closed natefitzgerald closed 12 months ago

natefitzgerald commented 1 year ago

My organization has a bad habit of using really big Avro schemas. What we found happens is that when AvroGenerateSpecific is used to generate specific records, the val that is added to the companion class ends up beyond the ~65k character length limit for compile-time constant strings, the length of which is encoded as a u2 unsigned int, see here . I can't link the schema here but it's about 100k characters.

(avro_schemas/compile:compileIncremental) java.lang.IllegalArgumentException: Maximum String literal length exceeded

I have a somewhat janky solution that I'm planning to PR to this repo but just in case I don't get around to it this is an issue.

julianpeeters commented 1 year ago

Ok great, thank you for the report

julianpeeters commented 12 months ago

https://github.com/julianpeeters/avrohugger/pull/182