6

I'm generating records using Avro IDL.

Setting my String types to String and setting fieldVisibility to PRIVATE, with this input:

record MyRecord {
        @java-class("java.util.HashSet")  array<string> flagged;
}

Avro generates

@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class MyRecord extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = -7930925833711109001L;
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"MyRecord\",\"namespace\":\"com.example\",\"fields\":[{\"name\":\"flagged\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"java-class\":\"java.util.HashSet\"}}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
   private java.util.List<java.lang.String> flagged;

I expected:

   private java.util.HashSet<java.lang.String> flagged;

Is it possible to make an array work with Set semantics?

Mykel Alvis
  • 1,048
  • 11
  • 14

0 Answers0