Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 48DE7200C02 for ; Fri, 20 Jan 2017 23:32:35 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 477B3160B48; Fri, 20 Jan 2017 22:32:35 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 91F20160B34 for ; Fri, 20 Jan 2017 23:32:34 +0100 (CET) Received: (qmail 65452 invoked by uid 500); 20 Jan 2017 22:32:33 -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 65441 invoked by uid 99); 20 Jan 2017 22:32:33 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Jan 2017 22:32:33 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 35285181B9D for ; Fri, 20 Jan 2017 22:32:33 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id OuIzSqSvxeOr for ; Fri, 20 Jan 2017 22:32:30 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id C0CAE5FB5D for ; Fri, 20 Jan 2017 22:32:29 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 4BDF5E0292 for ; Fri, 20 Jan 2017 22:32:28 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id A128425295 for ; Fri, 20 Jan 2017 22:32:26 +0000 (UTC) Date: Fri, 20 Jan 2017 22:32:26 +0000 (UTC) From: "Victor Mota (JIRA)" To: dev@avro.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AVRO-1335) C++ should support field default values MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 20 Jan 2017 22:32:35 -0000 [ https://issues.apache.org/jira/browse/AVRO-1335?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15832518#comment-15832518 ] Victor Mota commented on AVRO-1335: ----------------------------------- The patch fixes this issue, there's just a one line change that causes the issue Peter documented ^. If you change the call below in NodeRecord::printJson: leafAttributes_.get(i)->printDefaultToJson(defaultValues[i], os, depth); to leafAttributes_.get(i)->printDefaultToJson(defaultValues[i], os, depth, false); Then Pierre's patch works. Would be great to have this fixed in the latest release, field default values is a very crucial feature that is missing in the C++ library. > C++ should support field default values > --------------------------------------- > > Key: AVRO-1335 > URL: https://issues.apache.org/jira/browse/AVRO-1335 > Project: Avro > Issue Type: Improvement > Components: c++ > Affects Versions: 1.7.4 > Reporter: Bin Guo > Attachments: AVRO-1335.patch > > > We found that resolvingDecoder could not provide bidirectional compatibility between different version of schemas. > Especially for records, for example: > {code:title=First schema} > { > "type": "record", > "name": "TestRecord", > "fields": [ > { > "name": "MyData", > "type": { > "type": "record", > "name": "SubData", > "fields": [ > { > "name": "Version1", > "type": "string" > } > ] > } > }, > { > "name": "OtherData", > "type": "string" > } > ] > } > {code} > {code:title=Second schema} > { > "type": "record", > "name": "TestRecord", > "fields": [ > { > "name": "MyData", > "type": { > "type": "record", > "name": "SubData", > "fields": [ > { > "name": "Version1", > "type": "string" > }, > { > "name": "Version2", > "type": "string" > } > ] > } > }, > { > "name": "OtherData", > "type": "string" > } > ] > } > {code} > Say, node A knows only the first schema and node B knows the second schema, and the second schema has more fields. > Any data generated by node B can be resolved by first schema 'cause the additional field is marked as skipped. > But data generated by node A can not be resolved by second schema and throws an exception *"Don't know how to handle excess fields for reader."* > This is because data is resolved exactly according to the auto-generated codec_traits which trying to read the excess field. > The problem is we just can not only ignore the excess field in record, since the data after the troublesome record also needs to be resolved. > Actually this problem stucked us for a very long time. -- This message was sent by Atlassian JIRA (v6.3.4#6332)