Werner Daehn created AVRO-2871:
----------------------------------
Summary: Support more datatypes via logical types plus convenience
features
Key: AVRO-2871
URL: https://issues.apache.org/jira/browse/AVRO-2871
Project: Apache Avro
Issue Type: Improvement
Components: java
Affects Versions: 1.9.2
Reporter: Werner Daehn
I have created a list of logical datatypes for easier integration with other
systems, primarily databases, and wonder if and how others might be interested
in that.
Looking for input which of the options you would prefer:
# I keep it embedded in my project, others cannot use it. No interest by you.
# Add a library on top of Avro
# Add it to the Avro library, which helps registering the logical types
automatically
Any advice?
[https://github.com/rtdi/connectorbase/tree/master/pipelinefoundation/src/main/java/io/rtdi/bigdata/connector/pipeline/foundation/avrodatatypes]
Note: Code needs some cleanup.
*Detailed feature*
Currently there is quite a break between native datatypes and logical
datatypes. For example the user has to read the schema, then find the Avro
datatype, then check if a logical datatype is defined on top of it.
Also setting values is coding wise apparently very simple with a
record.put("REVENUE", 1234.56) but fails at runtime as the decimal is not a
BigDecimal converted into a byte array.
If all datatypes are logical datatypes, this can be made simpler for the user.
Hence I created logical datatypes for the base datatypes plus all common
database datatypes. Examples are NVARCHAR(100), CLOB, ST_POINT,
VARCHAR(100),... all the usual candidates needed for databases.
The purpose of these logical types are:
* Richer metadata
* Simpler data assignment (e,g, decimal datatype can get a Java int,
biginteger, bigdecimal,..)
* Simpler datatype mapping from Avro-to-JDBC and vice versa
* One code line required for finding the exact datatype
--
This message was sent by Atlassian Jira
(v8.3.4#803005)