java - Decimal datatype support in avro schema and generated files -


avro version 1.8.1.

we have below field in avro schema

"name" : "sale_price", "type" : ["bytes", "null"], "logicaltype": "decimal", "precision": 18, "scale": 17,

we have defined logicaltype decimal.

but when use avro-maven-plugin, not generate correct data type generated java files.

<plugin>     <groupid>org.apache.avro</groupid>     <artifactid>avro-maven-plugin</artifactid>     <version>1.8.1</version>     <configuration>         <stringtype>string</stringtype>         <enabledecimallogicaltype>true</enabledecimallogicaltype>     </configuration> </plugin> 

currently generates, java.nio.bytebuffer. how have correct data type generated java files.

as avro docs explain,

language implementations must ignore unknown logical types when reading, , should use underlying avro type.

a decimal logical type annotates avro bytes or fixed types.

hence in generated java files, decimal logical type represented in underlying avro type bytes, i.e., java.nio.bytebuffer


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -