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 73265200B51 for ; Mon, 18 Jul 2016 02:24:27 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 718DB160A6C; Mon, 18 Jul 2016 00:24:27 +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 B74E8160A6B for ; Mon, 18 Jul 2016 02:24:26 +0200 (CEST) Received: (qmail 61821 invoked by uid 500); 18 Jul 2016 00:24:20 -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 61787 invoked by uid 99); 18 Jul 2016 00:24:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jul 2016 00:24:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 93CF12C036F for ; Mon, 18 Jul 2016 00:24:20 +0000 (UTC) Date: Mon, 18 Jul 2016 00:24:20 +0000 (UTC) From: "Yibing Shi (JIRA)" To: dev@avro.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (AVRO-1883) Schema validator cannot find broken backwards compatibility in Union type elements MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 18 Jul 2016 00:24:27 -0000 [ https://issues.apache.org/jira/browse/AVRO-1883?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Yibing Shi updated AVRO-1883: ----------------------------- Attachment: AVRO-1883.1.patch > Schema validator cannot find broken backwards compatibility in Union type elements > ---------------------------------------------------------------------------------- > > Key: AVRO-1883 > URL: https://issues.apache.org/jira/browse/AVRO-1883 > Project: Avro > Issue Type: Bug > Affects Versions: 1.8.1 > Reporter: Yibing Shi > Priority: Critical > Attachments: AVRO-1883.1.patch > > > Consider below 2 schemas: > *Schema 1*: > {noformat} > [ > { > "type": "record", > "name": "rec1", > "fields": [ > { > "name": "age", > "type": "long" > } > ] > }, > { > "type": "record", > "name": "rec2", > "fields": [ > { > "name": "username", > "type": "string" > } > ] > } > ] > {noformat} > *Schema 2*: > {noformat} > [ > { > "type": "record", > "name": "rec1", > "fields": [ > { > "name": "age", > "type": "long" > }, > { > "name": "address", > "type": "string" > } > ] > }, > { > "type": "record", > "name": "rec2", > "fields": [ > { > "name": "username", > "type": "string" > } > ] > } > ] > {noformat} > The {{rec1}} field in these 2 unions are not compatible, because the {{address}} field of {{rec1}} in the second one is not nullable. However, if we check them with validate like below, validator doesn't return any error: > {code} > final SchemaValidator backwardValidator = new SchemaValidatorBuilder().canReadStrategy().validateLatest(); > final Schema schema1 = new Schema.Parser().parse(schema1Str); > final Schema schema2 = new Schema.Parser().parse(schema2Str); > backwardValidator.validate(schema2, Arrays.asList(schema1)); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)