Return-Path: Delivered-To: apmail-hadoop-avro-dev-archive@minotaur.apache.org Received: (qmail 54604 invoked from network); 13 Jan 2010 02:40:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Jan 2010 02:40:17 -0000 Received: (qmail 11478 invoked by uid 500); 13 Jan 2010 02:40:16 -0000 Delivered-To: apmail-hadoop-avro-dev-archive@hadoop.apache.org Received: (qmail 11359 invoked by uid 500); 13 Jan 2010 02:40:16 -0000 Mailing-List: contact avro-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: avro-dev@hadoop.apache.org Delivered-To: mailing list avro-dev@hadoop.apache.org Received: (qmail 11048 invoked by uid 99); 13 Jan 2010 02:40:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jan 2010 02:40:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jan 2010 02:40:14 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 6145D234C04C for ; Tue, 12 Jan 2010 18:39:54 -0800 (PST) Message-ID: <279079335.202331263350394397.JavaMail.jira@brutus.apache.org> Date: Wed, 13 Jan 2010 02:39:54 +0000 (UTC) From: "Thiruvalluvan M. G. (JIRA)" To: avro-dev@hadoop.apache.org Subject: [jira] Created: (AVRO-313) Default values for fields or records and array (or map) don't work with ResolvingDecoder MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Default values for fields or records and array (or map) don't work with ResolvingDecoder ---------------------------------------------------------------------------------------- Key: AVRO-313 URL: https://issues.apache.org/jira/browse/AVRO-313 Project: Avro Issue Type: Bug Components: java Reporter: Thiruvalluvan M. G. Assignee: Thiruvalluvan M. G. If the writer's and reader's schema are different and reader's schema defines a field with a default while the writer's does not have that field, the ResolovingDecoder returns the default value for the field to the reader. This is accomplished by replacing the actual InputStream with the one that has the default value. Remember the actual input stream didn't have a value for the field. Now the original input stream is restored by an implicit action called DEFAULT_END_ACTION. If the record is the last in a slice of an array(or a map), the code used to see (after consuming the record) if there are any more entries in the array(map). This check should happen on the original input stream. Since the input stream has not been restored, the check happens on the default-value input stream causing error. The following patch solves this by consuming all "trailing" implicit actions before looking for further entries in the array(map). There was already a method Parser.processImplicitActions() which consumed _all_ implicit actions. It turns out one needs to consume only the trailing implicit action. So I renamed the method to processTrailingImplicitActions and changed the code to meet the new specification. I also added a couple of tests that catch the problem. First apply the patch for the tests, you'd see the problem. Then apply the fix and see that the problem go away. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.