Return-Path: X-Original-To: apmail-avro-dev-archive@www.apache.org Delivered-To: apmail-avro-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ED8C910B88 for ; Wed, 4 Dec 2013 18:24:53 +0000 (UTC) Received: (qmail 4654 invoked by uid 500); 4 Dec 2013 18:24:53 -0000 Delivered-To: apmail-avro-dev-archive@avro.apache.org Received: (qmail 4527 invoked by uid 500); 4 Dec 2013 18:24:53 -0000 Mailing-List: contact dev-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@avro.apache.org Delivered-To: mailing list dev@avro.apache.org Received: (qmail 4517 invoked by uid 99); 4 Dec 2013 18:24:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Dec 2013 18:24:52 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of christophe.taton@gmail.com designates 209.85.215.171 as permitted sender) Received: from [209.85.215.171] (HELO mail-ea0-f171.google.com) (209.85.215.171) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Dec 2013 18:24:47 +0000 Received: by mail-ea0-f171.google.com with SMTP id h10so10803664eak.2 for ; Wed, 04 Dec 2013 10:24:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=mylA2Wi0AFAsXeLjbyOSeEIlHemwK/JYFS9rE6PKD/8=; b=aqcj944DKowreAagmTtQxmH7eaWlAiyzkrLeiMTVKNR5M2aPH69FgmFK7GgxonOAkK mjCxXUkcT9z1Eb90RKnHVCyfUCh4XEqj8zu/zKlaVsrFTXwYdH/3eJjpXWYH6GwytV2c HV5P9SRa4hF6Ehvuxiv96vi7hgsI9koVpWh6U+rbSfoi7KB7rgAsY5GirGTeaEe1UHgR GXr9XhHkqPWlXMNRYBxalZuSCnhZsYrwbr1EDPgEj2u+Z3OcYHdhohAUvbGLs/Lajr4D N27kjv4lrtNqh5jVtDaBqFZB7tRuMa1uCsDAxLvs2cFrm2x1+NQzeMetvyZ9rKppRzOz OJ7A== X-Received: by 10.14.47.75 with SMTP id s51mr5329724eeb.97.1386181466489; Wed, 04 Dec 2013 10:24:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.14.88.197 with HTTP; Wed, 4 Dec 2013 10:24:06 -0800 (PST) In-Reply-To: References: From: Christophe Taton Date: Wed, 4 Dec 2013 10:24:06 -0800 Message-ID: Subject: Re: Effort towards Avro 2.0? To: dev@avro.apache.org Content-Type: multipart/alternative; boundary=001a11c3bc56e788a004ecb9851d X-Virus-Checked: Checked by ClamAV on apache.org --001a11c3bc56e788a004ecb9851d Content-Type: text/plain; charset=UTF-8 On Tue, Dec 3, 2013 at 7:49 AM, Doug Cutting wrote: > On Mon, Dec 2, 2013 at 1:42 PM, Christophe Taton > wrote: > > - New extension data type, similar to ProtocolBuffer extensions > (incompatible change). > > Extensions might be implemented as something like: > > {"type":"record", "name":"extension", "fields":[ > {"name":"fingerprint", "type": {"type":"fixed", "size":16}}, > {"name":"payload", "type":"bytes"} > ] > } > > One could then use this with: > > {"type":"record", "name":"Foo", "fields":[ > {"name":"bar", "type":"extension"} > ] > } > > The implementation could then find the schema for the extension at > runtime given its fingerprint. The reader could have a table mapping > fingerprints to schemas. > > In particular, the specific compiler, when it sees a schema like: > > > {"type":"record", "name":"Bar", "isExtension":true, "fields":[ > {"name":"x", "type":"long"} > ] > } > > Might emit code to add entries to the extension mapping table used by > SpecificDatumReader, e.g.: > > static { > SpecificData.addExtension(getSchema()); > } > > Might something like this work? > Yes, this is very much the idea. In a prototype I made a few months ago, I found allowing the user to specify the fingerprint schema useful : in some scenario, an extension could be prefixed by a string that contains the JSON schema; in some other scenario, I may want to use fingerprints to identify the schema of the extension; in some other cases, I may want to use some external mapping maintained by another system (eg. the schema repository worked on in AVRO-1124). C. --001a11c3bc56e788a004ecb9851d--