Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avro Schema - what is "avro.java.string": "String"

Tags:

avro

I've got my Kafka Streams processing configuration for AUTO_REGISTER_SCHEMAS set to true.

I noticed in this auto generated schema it creates the following 2 types

{
      "name": "id",
      "type": {
        "type": "string",
        "avro.java.string": "String"
      }
},

Could someone please explain why it creates 2 types and what exactly "avro.java.string": "String" is.

Thanks

like image 212
userMod2 Avatar asked Apr 23 '18 05:04

userMod2


People also ask

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.

What is Avro schema?

Avro schema definitions are JSON records. Because it is a record, it can define multiple fields which are organized in a JSON array. Each such field identifies the field's name as well as its type. The type can be something simple, like an integer, or something complex, like another record.

What is Avro message format?

Avro is a row-oriented remote procedure call and data serialization framework developed within Apache's Hadoop project. It uses JSON for defining data types and protocols, and serializes data in a compact binary format.

How is Avro different from JSON?

It is based on a subset of the JavaScript Programming Language. Avro can be classified as a tool in the "Serialization Frameworks" category, while JSON is grouped under "Languages". Redsift, OTTLabs, and Mon Style are some of the popular companies that use JSON, whereas Avro is used by Liferay, LendUp, and BetterCloud.


1 Answers

By default Avro uses CharSequence for the String representation, the following syntax allows you to overwrite the default behavior and use java.lang.String as the String type for the instances of the fields declared like this

"type": {
        "type": "string",
        "avro.java.string": "String"
      }
like image 75
hlagos Avatar answered Oct 13 '22 22:10

hlagos