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

Missing customEncode method for Java class generated from schema with logical type timestamp-millis

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.10.2
    • None
    • java
    • None
    • Java version:

      OpenJDK Runtime Environment AdoptOpenJDK-16.0.1+9 (build 16.0.1+9)
      OpenJDK 64-Bit Server VM AdoptOpenJDK-16.0.1+9 (build 16.0.1+9, mixed mode, sharing)

      MacOs default console

    Description

      I'm trying to compile avro schema to java class with the command:

      java -jar avro-tools-1.10.2.jar compile schema 

      Prepared schema is as follows:

      {
        "type": "record",
        "name": "TableChangeAvro",
        "fields": [
        {
           "name": "ownerProjectId",
           "type": "string"
         },
         {
            "name": "dataset",
            "type": "string"
         },
         {
            "name": "table",
            "type": "string"
          },
         {
            "name": "timestamp",
            "type" : {
              "type" : "long",
              "logicalType" : "timestamp-millis"
             }
          }
        ]
      }

      The schema compiles successfully to Java class (attached), but the class has missing methods:

      public void customEncode(Encoder out) throws IOException

      public void customDecode(ResolvingDecoder in) throws IOException

       

      Because of that, I'm unable to use it for Google Pub/Sub publication as intended. The problem occurs for the schema only when the type with timestamp-millis logical type is included.

       

      Attachments

        1. TableChangeAvro.java
          16 kB
          Jakub Hałun

        Activity

          People

            Unassigned Unassigned
            jakub.halun Jakub Hałun
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: