Apache Avro: map uses CharSequence as key

前端 未结 6 1440
别跟我提以往
别跟我提以往 2020-12-05 15:42

I am using Apache Avro.

My schema has map type:

{\"name\": \"MyData\", 
  \"type\" :  {\"type\": \"map\", 
              \"values\":{
                        


        
6条回答
  •  死守一世寂寞
    2020-12-05 16:39

    This JIRA discussion is relevant. The main point of CharSequence still being used is backwards-compatability.

    And like Charles Forsythe pointed out, there has been added a workaround for when String is necessary, by setting the string property in the schema.

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

    The default type here is their own Utf8 class. In addition to manual specification and the pom.xml setting, there is even an avro-tools compile option for it, the -string option:

    java -jar avro-tools.1.7.5.jar compile -string schema /path/to/schema .
    

提交回复
热议问题