update after some research.

It seems, that given configuration excerpt from my first mail actually
works. The `@AvroGenerated` class will generate String, and try to cast
Utf8 to String.

The generated code looks like this:

public void put(int field$, Object value$) {
        switch(field$) {
        case 0:
            this.someField = (String)value$;

which is indeed incorrect.

According to:

https://issues.apache.org/jira/browse/AVRO-2702

this should be solved in 1.10 (which it is not, incorrect code is still
generated). And if someone (like myself) is bound to 1.9.2 because of
confluent, there is no fix for this minor version branch at all. There are
some workarounds, but they do not cover all usecases, and for me the
situation has the only solution of just accepting avro-team decision, that
Utf8 is my favorite type now, and have to fix gazillion places in rather
huge project, which is just awesome.

po 21. 6. 2021 v 11:17 odesílatel Martin Mucha <alfon...@gmail.com> napsal:

> It seems, that transition 1.8.2->1.9.2 brings backwards incomatibility and
>
> <configuration>
>               <stringType>String</stringType>
>
> which did work to change generation from CharSequence to String, does not
> work any more. Within 15 minutes search I'm not unable to find literary any
> documentation of this plugin, so I don't know if there is some new way how
> to configure it for avro 1.9.2 and newer.
>
> Can someone advice?
> Thanks.
>

Reply via email to