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 2BDADDCBB for ; Sat, 1 Sep 2012 05:46:16 +0000 (UTC) Received: (qmail 26678 invoked by uid 500); 1 Sep 2012 05:46:15 -0000 Delivered-To: apmail-avro-dev-archive@avro.apache.org Received: (qmail 26327 invoked by uid 500); 1 Sep 2012 05:46:09 -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 26279 invoked by uid 99); 1 Sep 2012 05:46:07 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Sep 2012 05:46:07 +0000 Date: Sat, 1 Sep 2012 16:46:07 +1100 (NCT) From: "Alexandre Normand (JIRA)" To: dev@avro.apache.org Message-ID: <301310498.26397.1346478367741.JavaMail.jiratomcat@arcas> In-Reply-To: <1054186942.25561.1346453587485.JavaMail.jiratomcat@arcas> Subject: [jira] [Updated] (AVRO-1146) Can't use ReflectData to get schema when the type has a BigDecimal field MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AVRO-1146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Alexandre Normand updated AVRO-1146: ------------------------------------ Labels: newbie (was: ) Status: Patch Available (was: Open) One problem is that all subclasses of java.lang.Number are considered primitives in ReflectData.createSchema. Since BigDecimal and BigInteger are not actual primitives, I made the check more precise to actually check for all 9 primitive classes. I've added a map of wrapper classes to primitive types to make the code cleaner but I'm not sure this fits the coding style. It could very well just be a long series of {code} if (c == Void.class || c == Integer.class || ... {code} I've made it so that BigDecimal and BigInteger are handled as Stringable types, which they are. I've also added a test for this in TestReflect. > Can't use ReflectData to get schema when the type has a BigDecimal field > ------------------------------------------------------------------------ > > Key: AVRO-1146 > URL: https://issues.apache.org/jira/browse/AVRO-1146 > Project: Avro > Issue Type: Bug > Components: java > Affects Versions: 1.7.0 > Reporter: Alexandre Normand > Labels: newbie > Attachments: TestReflectDataWithBigDecimal.java > > > I'm using avro Reflection API for a specific use case and I have a bug where if the object I'm trying to get the Schema for has a field of type BigDecimal. Because BigDecimal extends java.lang.Number, we try to create a primitive schema for it but fail doing so with the following error: > *{{org.apache.avro.AvroRuntimeException: Not a Specific class: class java.math.BigDecimal}}* > I'm attaching a unit test that shows the problem with a basic type that has a single BigDecimal field. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira