Matthias Klein created AVRO-2628:
------------------------------------
Summary: 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.1, 1.8.2, 1.9.0
Reporter: Matthias Klein
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)