Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why the avro generated java code has so many deprecated fileds

Tags:

avro

I am using avro-maven-plugin 1.8.1 to generate java code from schema,and all the fields are public and deprecated,like this:

  public class data_elements extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = 2829359487251568000L;
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("......");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  @Deprecated public java.lang.CharSequence timestamp;
  @Deprecated public double value;
  @Deprecated public java.lang.CharSequence op;
...
}

It makes confused and uncomfortable, does anyone know why it is like that?

like image 372
adeline Avatar asked Sep 21 '16 09:09

adeline


People also ask

How is Avro different from JSON?

Avro has a JSON like data model, but can be represented as either JSON or in a compact binary form. It comes with a very sophisticated schema description language that describes data. We think Avro is the best choice for a number of reasons: It has a direct mapping to and from JSON.

What is Java Avro?

Avro is a language independent, schema-based data serialization library. It uses a schema to perform serialization and deserialization. Moreover, Avro uses a JSON format to specify the data structure which makes it more powerful.

Is namespace mandatory in Avro schema?

@johndcal A namespace is not required within the avro schema source in Schema Registry.


1 Answers

If you pass in the fieldVisibility=private parameter then the @Deprecated should disappear and your fields will be private.

like image 51
Glide Avatar answered Sep 22 '22 07:09

Glide