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

StringType of "String" causes logicalType converters to be ignored for field

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.9.0
    • 1.9.2
    • java, logical types
    • None

    Description

      I have the avro maven plugin configured like this:

                  <plugin>
                      <groupId>org.apache.avro</groupId>
                      <artifactId>avro-maven-plugin</artifactId>
                      <version>${avro.version}</version>
                      <executions>
                          <execution>
                              <goals>
                                  <goal>schema</goal>
                              </goals>
                              <configuration>
                                  <stringType>String</stringType>
                                  <createSetters>false</createSetters>
                                  <enableDecimalLogicalType>true</enableDecimalLogicalType>
                                  <fieldVisibility>private</fieldVisibility>
                                  <customConversions>
                                      <conversion>
                                          org.apache.avro.Conversions$UUIDConversion
                                      </conversion>
                                  </customConversions>
                              </configuration>
                          </execution>
                      </executions>
                  </plugin>
      

      With the intention of using the provided UUIDConversion class on string fields set with the logicalType uuid. However, it seems like having stringType specified as String means the converter is ignored.

      If I comment out the line <stringType>String</stringType> then the converter is used as expected and the java classes have UUID types for those fields, but obviously all normal strings are now CharSequence objects.
       

      Attachments

        1. avro-issue-example.zip
          15 kB
          Chris Woodham

        Issue Links

          Activity

            People

              igreene Ivan Greene
              Woodham Chris Woodham
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: