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 4A8C8200B6B for ; Mon, 18 Jul 2016 01:46:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 490BA160A6B; Sun, 17 Jul 2016 23:46:22 +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 94458160A6C for ; Mon, 18 Jul 2016 01:46:21 +0200 (CEST) Received: (qmail 36290 invoked by uid 500); 17 Jul 2016 23:46: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 36257 invoked by uid 99); 17 Jul 2016 23:46:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 17 Jul 2016 23:46:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 716B12C0031 for ; Sun, 17 Jul 2016 23:46:20 +0000 (UTC) Date: Sun, 17 Jul 2016 23:46:20 +0000 (UTC) From: "Yibing Shi (JIRA)" To: dev@avro.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (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: Sun, 17 Jul 2016 23:46:22 -0000 Yibing Shi created AVRO-1883: -------------------------------- Summary: 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 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)