avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "konstantin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1903) Java package/class bindings for specific records
Date Fri, 18 Nov 2016 07:20:58 GMT

    [ https://issues.apache.org/jira/browse/AVRO-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15676018#comment-15676018

konstantin commented on AVRO-1903:

Hey Frederic,

I see little value in adding this complexity (and possible bugs and issues) to Avro.

* Java 9 will allow you to alias' imports.
* Schema's should be agnostic to language details

Regarding the patch/implementation detail, I have concerns:

* Relies on both class's generated by specific maven plugin, some people use some alternative
generation in other build tools such as sbt, as well as the runtime Avro version.
* What occurs where i have a shared generated java bundle, yet some users are on a previous
Avro 1.8.x runtime version (mainly due to other third class libraries, depending on them,
Storm, Spark, general Hadoop eco-sphere)
* Does this work with other languages such as Scala, Clojure that generally build/reuse java
* There is no testing.

Also it be great to have a discussion thread on this.

> Java package/class bindings for specific records
> ------------------------------------------------
>                 Key: AVRO-1903
>                 URL: https://issues.apache.org/jira/browse/AVRO-1903
>             Project: Avro
>          Issue Type: New Feature
>          Components: java
>    Affects Versions: 1.8.1
>            Reporter: Frederic Boucher
>         Attachments: AVRO-1903.patch
> Naming convention of the Avro schemas we create are not always in line with the Java
coding convention. The maven-plugin to generate specific record classes should provide a way
to bind namespace or schema names to a custom Java package or class name.
> We have implemented a solution where we can add bindings into the maven-plugin configuration:
> One to one binding:
> <binding>
>     <from>com.namspace.order.state</from>
>     <to>com.package.Order</to>
> </binding>
> It will create a class "Order" into package "com.package" for schema "state" and namespace
> Reg-exp based binding:
> <binding>
>     <from>com.namespace.order.([a-zA-Z]+)</from>
>     <to>com.package.order.Order$1</to>
> </binding>
> Bindings are matched in order, which means the most specific bindings have to be put
before the generic ones.

This message was sent by Atlassian JIRA

View raw message