Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-2628

SpecificCompiler erases Logical Types when string type is set to StringType.String

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.9.0, 1.8.2, 1.9.1
    • None
    • java
    • None

    Description

      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;
      }

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              matthias.mutam Matthias Klein
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: