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

IDL parsing does not support arbitrary logical types

    XMLWordPrintableJSON

Details

    Description

      When parsing Avro IDL in code, the resulting protocol types (schemas) have no logical types defined, when though the properties for them are set.

       

      Example IDL:

      protocol P {
      	record R {
      		@logicalType("timestamp-micros") long uTime;
      	}
      }

       

      The following test fails on the second assert: 

      @Test
      public void validateIdlLogicalTypeParsing() {
        final ClassLoader cl = Thread.currentThread().getContextClassLoader();
        Idl idl = new Idl(cl.getResourceAsStream("logicalTypes.avdl"), "UTF-8");
        Protocol protocol = idl.CompilationUnit();
      
        Schema fieldSchema = protocol.getType("R").getField("uTime").schema();
      
        Assert.assertEquals("timestamp-micros", fieldSchema.getObjectProp("logicalType"));
        Assert.assertNotNull(fieldSchema.getLogicalType());
      }
      

       

      A minimal proof is attached.

      Attachments

        1. avro2976.zip
          4 kB
          Oscar Westra van Holthe - Kind

        Issue Links

          Activity

            People

              opwvhk Oscar Westra van Holthe - Kind
              opwvhk Oscar Westra van Holthe - Kind
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 10m
                  3h 10m