Return-Path: X-Original-To: apmail-avro-user-archive@www.apache.org Delivered-To: apmail-avro-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 145A418674 for ; Mon, 21 Dec 2015 15:24:57 +0000 (UTC) Received: (qmail 78489 invoked by uid 500); 21 Dec 2015 15:24:56 -0000 Delivered-To: apmail-avro-user-archive@avro.apache.org Received: (qmail 78414 invoked by uid 500); 21 Dec 2015 15:24:56 -0000 Mailing-List: contact user-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@avro.apache.org Delivered-To: mailing list user@avro.apache.org Received: (qmail 78403 invoked by uid 99); 21 Dec 2015 15:24:55 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Dec 2015 15:24:55 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 9E9181A0144 for ; Mon, 21 Dec 2015 15:24:54 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.88 X-Spam-Level: ** X-Spam-Status: No, score=2.88 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id FIzkY-nyrnXr for ; Mon, 21 Dec 2015 15:24:45 +0000 (UTC) Received: from mail-ig0-f177.google.com (mail-ig0-f177.google.com [209.85.213.177]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 619C12050A for ; Mon, 21 Dec 2015 15:24:45 +0000 (UTC) Received: by mail-ig0-f177.google.com with SMTP id jw2so38006177igc.1 for ; Mon, 21 Dec 2015 07:24:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=wBvXfnUYGqSvQ+AIz+j7SUzGT2P5mnWe0HHmWSTGnnA=; b=PsxKKw0dv1Y3+hT5b8BNrONi3K2cJ00hicdjYV7h1fCy0qjN1X34DQ6i/wZrUPGOhg a85pNFDeZ3y4ztLAHxbQ352ZEkDPdNDJiPptwM9N5oc9tmA1XBHMzB2NGX0zXA6v7Goo 1AGaTf0r18Z9cxbZbXSyW/nZ3n+hZ2gJGjn0yz4Q4YC73OMh3YujPY+XYBxg3RHnzShF 98drVyuEjb5lltQS3Ma4+uPzIPLWgS1kR15fmsRwocaZKSXbsLu0Ol+Ytl970kiaiMOE fdQBG+YOObWTO4o8mWE/G93caFb72Ui1CFUnBM+AuiJ+GB4Thpl3xZaFe+cy6GQUBWRE VQQQ== MIME-Version: 1.0 X-Received: by 10.50.129.99 with SMTP id nv3mr8460407igb.96.1450711484823; Mon, 21 Dec 2015 07:24:44 -0800 (PST) Received: by 10.107.56.131 with HTTP; Mon, 21 Dec 2015 07:24:44 -0800 (PST) In-Reply-To: References: Date: Mon, 21 Dec 2015 09:24:44 -0600 Message-ID: Subject: Re: Avro Create Generic Type From: Rushi To: user@avro.apache.org Content-Type: multipart/alternative; boundary=047d7b3a91e6b99be805276a1624 --047d7b3a91e6b99be805276a1624 Content-Type: text/plain; charset=UTF-8 I did in fact see the SO answer. Does "velocity" here refer to the Apache Velocity template language ? 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 describes how > to configure avro-maven-plugin for templates customization. > > On Fri, Dec 18, 2015 at 9:36 PM, Rushi 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 { >>>> 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! >>>> >>> >>> >> > --047d7b3a91e6b99be805276a1624 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I did in fact see the SO answer. Does &quo= t;velocity" here refer to the Apache Velocity=C2=A0template language? Also, any ide= a what templates get applied by default?

I am not very familiar with the design principle= s behind Avro , but in general, does anyone know if there are plans to upda= te the avro schema specifications to support inheritance/if this is possibl= e?

Thanks!

On Sat, = Dec 19, 2015 at 8:55 AM, Matheus Santana <edmatheus.santana@gmai= l.com> wrote:
You've probably already stumbled upon this but, just for the record= , this S.O. answer describes how to configure avro-maven-plugin for temp= lates customization.

On Fri, Dec 18, 2015 at 9:= 36 PM, Rushi <hrishi.engineer@gmail.com> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">
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 <edmat= heus.santana@gmail.com> wrote:
Hey, Rushi.

AFAIK,= there is no support for generating generic types or inheritance relationsh= ip 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 gene= ric type parameterization, in your case). Would this fit your needs?


I am fairly certain that this is not possible c= urrently, 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
 *=20
 * DO NOT EDIT DIRECTLY
 */
public class MyAvroType<T> {
  private Object value;  // value will be of type T.
}=

Here, this parameteri= zed java class would be generated by the avro-maven-plugin or any other ava= ilable plugin using the=C2=A0avsc=C2=A0files.

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 ou= t any class compatibility issues at compile time rather than at runtime.

Thanks!





--047d7b3a91e6b99be805276a1624--