avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matheus Santana <edmatheus.sant...@gmail.com>
Subject Re: Avro Create Generic Type
Date Tue, 22 Dec 2015 23:07:12 GMT
> Does "velocity" here refer to the Apache Velocity template language
<https://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html#velocity_template_language_vtl:_an_introduction>
?

Yes. Velocity refers to the Apache Velocity project. The best two
references I could find were the user's guide (that you've already linked)
and the developer's guide
<https://velocity.apache.org/engine/releases/velocity-1.5/developer-guide.html>
.

> Also, any idea what templates get applied by default?

That depends on the types you're relying upon. For instance, if you're
compiling a simple protocol that uses only record schemas and Avro primite
types, then Avro compiler will need the protocol.vm and the record.vm
templates.

> does anyone know if there are plans to update the avro schema
specifications to support inheritance/if this is possible?

I would guess that this is, by now, beyond the purpose for the project.
There is this JIRA issue <https://issues.apache.org/jira/browse/AVRO-1763>
relating to inheritance on schema generation and I think that I've already
seen another analogous issue being rejected with these terms (beyond the
scope for the project).

Hopefully, we'll hear about this topic from project's maintainers soon.

On Mon, Dec 21, 2015 at 12:24 PM, Rushi <hrishi.engineer@gmail.com> wrote:

> I did in fact see the SO answer. Does "velocity" here refer to the Apache
> Velocity template language
> <https://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html#velocity_template_language_vtl:_an_introduction>?
> Also, any idea what templates get applied by default?
>
> I am not very familiar with the design principles behind Avro , but in
> general, does anyone know if there are plans to update the avro schema
> specifications to support inheritance/if this is possible?
>
> Thanks!
>
> On Sat, Dec 19, 2015 at 8:55 AM, Matheus Santana <
> edmatheus.santana@gmail.com> wrote:
>
>> You've probably already stumbled upon this but, just for the record, this
>> S.O. answer <http://stackoverflow.com/a/21035683/1287376> describes how
>> to configure avro-maven-plugin for templates customization.
>>
>> On Fri, Dec 18, 2015 at 9:36 PM, Rushi <hrishi.engineer@gmail.com> wrote:
>>
>>> Thanks, I am not familiar with the Velocity templates and how they are
>>> used, but it sounds like they may be of help. I will take a look.
>>>
>>> On Thu, Dec 17, 2015 at 6:20 PM, Matheus Santana <
>>> edmatheus.santana@gmail.com> wrote:
>>>
>>>> Hey, Rushi.
>>>>
>>>> AFAIK, there is no support for generating generic types or inheritance
>>>> relationship between types through Avro compiler.
>>>>
>>>> One thing that you can try is customize generated code by replacing
>>>> Velocity templates with your own (record.vm, for instance) and then achieve
>>>> the desired result (the generic type parameterization, in your case). Would
>>>> this fit your needs?
>>>>
>>>>
>>>> I am fairly certain that this is not possible currently, but thought I
>>>>> should ask anyway.
>>>>>
>>>>> In Avro, is there a way to create generic types using schema files? As
>>>>> an example, this is what I am looking to create:
>>>>>
>>>>> /**
>>>>>  * Autogenerated by Avro
>>>>>  *
>>>>>  * DO NOT EDIT DIRECTLY
>>>>>  */public class MyAvroType<T> {
>>>>>   private Object value;  // value will be of type T.}
>>>>>
>>>>> Here, this parameterized java class would be generated by the
>>>>> avro-maven-plugin or any other available plugin using the avsc files.
>>>>>
>>>>> What I am trying to solve is, to know the type of the value that will
>>>>> get stored in the avro object so that I can find out any class
>>>>> compatibility issues at compile time rather than at runtime.
>>>>>
>>>>> Thanks!
>>>>>
>>>>
>>>>
>>>
>>
>

Mime
View raw message