avro icon indicating copy to clipboard operation
avro copied to clipboard

AVRO-3377: Deserialization of record of mangled Java class throws ClassCastException

Open kylec32 opened this issue 3 years ago • 3 comments

The biggest change in this code is moving the mangling code from the compiler project to the core avro project in order to facilitate mangling at deserialization time.

Jira

  • [X] My PR addresses the following Avro Jira issues and references them in the PR title. For example, "AVRO-1234: My Avro PR"
    • https://issues.apache.org/jira/browse/AVRO-3377

Tests

  • [X] My PR adds the following unit tests OR does not need testing for this extremely good reason:
    • TestSpecificData.testCanGetClassOfMangledType

Commits

  • [X] My commits all reference Jira issues in their subject lines. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Documentation

  • [X] In case of new functionality, my PR adds documentation that describes how to use it.
    • All the public functions and the classes in the PR contain Javadoc that explain what it does

kylec32 avatar Feb 08 '22 22:02 kylec32

Hey, is it still planned to merge this in 1.11.2? Is there a workaround in the meantime?

antoin-m avatar Aug 31 '22 14:08 antoin-m

PR approved (as code for mangle is moved from SpecificCompiler to SpecificData) with some remarks :

  • Mangle can transform word with point as "dummy.int.float" into "dummy.int$.float$" for example, as unmangle method only apply on last char (==> "dummy.int$.float" in our case).
  • Mangle only applies to reserved word, so transform "dummy$" to itself, while unmangle apply to all word (==> "dummy" in our case).
  • As it's a lot of static method, it may could be extract in external class.

clesaec avatar Sep 01 '22 06:09 clesaec

I'm also looking for a workaround until this ticket is implemented.

jeeger avatar Sep 15 '22 11:09 jeeger

Hey, any idea of when this will be merged/released or any sample/tips on a workaround?

hmsantos avatar Dec 19 '23 12:12 hmsantos

@hmsantos, i'm sorry, i forgot this PR, at this time, i didn't had right to merge PR. Nevertheless, you have to resolve conflict before merging.

clesaec avatar Dec 19 '23 13:12 clesaec

@kylec32 can you please resolve the conflicts in your PR? Thanks

hmsantos avatar Dec 20 '23 11:12 hmsantos