org.apache.avro.SchemaParseException: Illegal character in: return$
See original GitHub issueHi,
Given:
@namespace( "foo.bar" )
protocol AProtocol {
record A {
union { null, int } id = null;
union { null, string } return = null;
}
}
- Using:
addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.0.0-RC17")
It gets compiled to (correct and working):
case class A(id: Option[Int] = None, `return`: Option[String] = None)
- Using:
addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.0.0-RC18")
It gets compiled to:
case class A(id: Option[Int] = None, return$: Option[String] = None)
In my case I eventually get following exception:
vulcan.AvroException$$anon$1: org.apache.avro.SchemaParseException: Illegal character in: return$
at vulcan.AvroException$.apply(AvroException.scala:18)
at vulcan.AvroError$$anon$3.throwable(AvroError.scala:282)
at fs2.kafka.vulcan.AvroDeserializer$.$anonfun$using$extension$3(AvroDeserializer.scala:55)
Caused by: org.apache.avro.SchemaParseException: Illegal character in: return$
at org.apache.avro.Schema.validateName(Schema.java:1566)
at org.apache.avro.Schema.access$400(Schema.java:91)
at org.apache.avro.Schema$Field.<init>(Schema.java:546)
at org.apache.avro.Schema$Field.<init>(Schema.java:585)
Only workaround I’ve found is sticking to RC17
version.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
apache kafka - Getting Illegal initial character: in schema parsing
I guess, the problem is, you are using a dot (.) in name field(connect.name). Which is not allowed . Take a look at...
Read more >org.apache.avro.SchemaParseException Java Examples
This page shows Java code examples of org.apache.avro. ... c == '_')) { throw new SchemaParseException("Illegal character in: " + name + "...
Read more >org.apache.avro.SchemaParseException java code examples
Best Java code snippets using org.apache.avro. ... origin: apache/avro ... throw new SchemaParseException("Illegal character in: "+name); } return name; }.
Read more >Getting Illegal character error while building job
Getting below error while building job. org.talend.commons.exception.PersistenceException: org.apache.avro.SchemaParseException: Illegal ...
Read more >Solved: NiFi SchemaParseException: Illegal initial charact...
when using the MergeContent processor I'm getting an avro.SchemaParseException due to $ characters in a nested attribute name ($.Snapshot.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Awesome, thanks very much for the eyes and the fix. Released as avrohugger 1.0.0 and sbt-avrohugger 2.0.0
Hi,
I had a quick look and I think we don’t need to do any config for this. It would be breaking change, but it would break a bug that’s there right now. I added PR here, right now it’s failing.
The only places where I found we may need $ is scavro interop, but that’s actually using different mangling strategy: list of keywords, and here calling avro-compiler.
So in this PR instead I switched to mangling by backticks, and doing that only on scala keywords, as we don’t need to do that on Java keywords.
I didn’t test thorougly scavro part but everything still looks OK, and it fixes my problem.
(edit: Also #85 would be fixed)
Happy to hear your feedback.
Cheers