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

add @Nullable annotation to specify union with null

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3.0
    • 1.3.1
    • java
    • None

    Description

      HDFS now includes a class (HdfsFileStatus) with a field (symlink) whose type is byte[] but which is null for non-symlinks. For most other types, we could annotate this with something like @Union(

      {Void.class, Foo.class}

      ) to declare that the field may be null. But there is unfortunately no way to refer to the class of byte[] in an annotation. So, instead, I propose to add an annotation that permits the specification of an arbitrary schema. In this case, the annotation would then be @AvroSchema("[\"null\",\bytes\"").

      Attachments

        1. AVRO-432.patch
          8 kB
          Doug Cutting
        2. AVRO-432.patch
          6 kB
          Doug Cutting
        3. AVRO-432.patch
          5 kB
          Doug Cutting

        Issue Links

          Activity

            People

              cutting Doug Cutting
              cutting Doug Cutting
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: