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

TimestampMillisConversion added incorrectly to generated java for timestamp-micros logicalType

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 1.9.2
    • Fix Version/s: None
    • Component/s: java
    • Labels:
      None
    • Environment:
      • Apache Avro Version [1.10.0]
      • Java Version [11]

      Description

      Steps to reproduce :

      1. Using the avro-compiler jar generate code with the following avsc:
           
      {
        "type": "record",
        "name": "Messages",
        "namespace": "com.somedomain",
        "fields": [
          {
            "name": "not_optional_micros",
            "type": {
              "type": "long",
              "logicalType": "timestamp-micros"
            }
          },
          {
            "name": "optional_date_micros",
            "type": [
              "null",
              {
                "type": "long",
                "logicalType": "timestamp-micros"
              }
            ],
            "default": null
          }
            ]
      }
      

       

      Actual results:
      In the generated code, the conversion type added to the MODEL$ object incorrect. Timestamp*Millis*Conversion is added instead of TimestampMicrosConversion.
       

      static {
          MODEL$.addLogicalTypeConversion(new org.apache.avro.data.TimeConversions.TimestampMillisConversion());
        }
      

       

      Expected results:
      Based on the above avsc the following is expected.
       

        static {
          MODEL$.addLogicalTypeConversion(new org.apache.avro.data.TimeConversions.TimestampMicrosConversion());
        }
      

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                pdebuitlear Pádraig de Buitléar
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: