[
https://issues.apache.org/jira/browse/AVRO-2628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16975131#comment-16975131
]
Ryan Skraba commented on AVRO-2628:
-----------------------------------
Hello, this seems to be a duplicate of AVRO-2548. The associated PR
https://github.com/apache/avro/pull/655 looks quite a bit like your proposed
solution!
> SpecificCompiler erases Logical Types when string type is set to
> StringType.String
> ----------------------------------------------------------------------------------
>
> Key: AVRO-2628
> URL: https://issues.apache.org/jira/browse/AVRO-2628
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.9.0, 1.8.2, 1.9.1
> Reporter: Matthias Klein
> Priority: Major
>
> SpecificCompiler::compile(Schema) always calls addStringType on the Schema
> first. If SpecificCompiler::stringType is not StringType.String, this is a
> No-Op and Custom Conversions work as desired. However, if stringType IS set
> to StringType.String, the Schema is deep copied to patch the String Types
> (why?), thereby loosing all Logical Types. This, in turn, prevents
> Conversions from being applied.
> A possible fix (haven't tried yet) might be to add
> {{private Schema addStringType(Schema s, Map<Schema, Schema> seen) {}}
> {{ }}
> {{...}}
> {{ result.addAllProps(s);}}
> {{+ result.SetLogicalType(s.getLogicalType());}}
> {{ seen.put(s, result);}}
> {{ return result;}}
> {{}}}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)