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

[jira] [Updated] (AVRO-3749) incorrect conflicting field when field name starts with symbols

     [ https://issues.apache.org/jira/browse/AVRO-3749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christophe Le Saec updated AVRO-3749:
-------------------------------------
    Status: Patch Available  (was: Open)

> incorrect conflicting field when field name starts with symbols
> ---------------------------------------------------------------
>
>                 Key: AVRO-3749
>                 URL: https://issues.apache.org/jira/browse/AVRO-3749
>             Project: Apache Avro
>          Issue Type: Bug
>    Affects Versions: 1.11.1
>            Reporter: Joseph Price
>            Assignee: Christophe Le Saec
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When a field name has leading symbolic characters, it is detected as a conflicting name, causing the generated java method to be suffixed with "$1". Although the generated code is usable, I encountered this when trying to a use a Debezium schema from Flink, where flink's AvroTypeInfo class fails to generated a Flink schema due to an apparent limitation in handling of special characters in method names. Here is an example schema that exhibits the issue:
> {code:java}
> {
>   "name": "Value",
>   "type": "record",
>   "fields": [
>     {
>       "name": "__deleted",
>       "type": "string"
>     }
>   ]
> }{code}
> The code causing the spurious conflict detection is here:
> [https://github.com/apache/avro/blob/master/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L1262-L1264]
> I was able to work around it with a locally published version that checks for isAlphanumeric on the first letter, but that doesn't handle the indent of the code, since I assume a correct implementation would generate mangled names even for conflicting methods that start with symbols, e.g.
>  
> {code:java}
> __deleted -> getDeleted
> __Deleted -> getDeleted$1
> {code}
>  
> So, find first alphanumeric char, then apply the transformation to find dupes.



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