You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Alexandre Normand (JIRA)" <ji...@apache.org> on 2012/09/11 02:04:07 UTC

[jira] [Updated] (AVRO-1153) Exception when trying to write object with Nullable field that is of Stringable type

     [ https://issues.apache.org/jira/browse/AVRO-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexandre Normand updated AVRO-1153:
------------------------------------

    Description: 
There seems to be an issue with [stringable fields|https://issues.apache.org/jira/browse/AVRO-1146] that are nullable. I'm mostly using ReflectData.AllowNull in my real usage of this feature and I'm seeing it fail with this:
{code}
org.apache.avro.AvroRuntimeException: Unknown datum type: 10
	at org.apache.avro.generic.GenericData.getSchemaName(GenericData.java:574)
	at org.apache.avro.generic.GenericData.resolveUnion(GenericData.java:539)
	at org.apache.avro.generic.GenericDatumWriter.resolveUnion(GenericDatumWriter.java:137)
	at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:70)
	at org.apache.avro.reflect.ReflectDatumWriter.write(ReflectDatumWriter.java:104)
	at org.apache.avro.generic.GenericDatumWriter.writeRecord(GenericDatumWriter.java:105)
	at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:65)
	at org.apache.avro.reflect.ReflectDatumWriter.write(ReflectDatumWriter.java:104)
	at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:57)
{code}

Here's a quick test that shows this problem:
{code}
public static class N1 {
      BigDecimal number;
  }

  @Test public void testNullableStringableField() throws Exception {
      N1 datum = new N1();
      datum.number = BigDecimal.TEN;

      checkBinary(ReflectData.AllowNull.get(), ReflectData.AllowNull.get().getSchema(N1.class), datum, false);
  }
{code}

  was:
There seems to be an issue with stringable fields that are nullable. I'm mostly using ReflectData.AllowNull in my real usage of this feature and I'm seeing it fail with this:
{code}
org.apache.avro.AvroRuntimeException: Unknown datum type: 10
	at org.apache.avro.generic.GenericData.getSchemaName(GenericData.java:574)
	at org.apache.avro.generic.GenericData.resolveUnion(GenericData.java:539)
	at org.apache.avro.generic.GenericDatumWriter.resolveUnion(GenericDatumWriter.java:137)
	at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:70)
	at org.apache.avro.reflect.ReflectDatumWriter.write(ReflectDatumWriter.java:104)
	at org.apache.avro.generic.GenericDatumWriter.writeRecord(GenericDatumWriter.java:105)
	at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:65)
	at org.apache.avro.reflect.ReflectDatumWriter.write(ReflectDatumWriter.java:104)
	at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:57)
{code}

Here's a quick test that shows this problem:
{code}
public static class N1 {
      BigDecimal number;
  }

  @Test public void testNullableStringableField() throws Exception {
      N1 datum = new N1();
      datum.number = BigDecimal.TEN;

      checkBinary(ReflectData.AllowNull.get(), ReflectData.AllowNull.get().getSchema(N1.class), datum, false);
  }
{code}

    
> Exception when trying to write object with Nullable field that is of Stringable type
> ------------------------------------------------------------------------------------
>
>                 Key: AVRO-1153
>                 URL: https://issues.apache.org/jira/browse/AVRO-1153
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.2
>            Reporter: Alexandre Normand
>
> There seems to be an issue with [stringable fields|https://issues.apache.org/jira/browse/AVRO-1146] that are nullable. I'm mostly using ReflectData.AllowNull in my real usage of this feature and I'm seeing it fail with this:
> {code}
> org.apache.avro.AvroRuntimeException: Unknown datum type: 10
> 	at org.apache.avro.generic.GenericData.getSchemaName(GenericData.java:574)
> 	at org.apache.avro.generic.GenericData.resolveUnion(GenericData.java:539)
> 	at org.apache.avro.generic.GenericDatumWriter.resolveUnion(GenericDatumWriter.java:137)
> 	at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:70)
> 	at org.apache.avro.reflect.ReflectDatumWriter.write(ReflectDatumWriter.java:104)
> 	at org.apache.avro.generic.GenericDatumWriter.writeRecord(GenericDatumWriter.java:105)
> 	at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:65)
> 	at org.apache.avro.reflect.ReflectDatumWriter.write(ReflectDatumWriter.java:104)
> 	at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:57)
> {code}
> Here's a quick test that shows this problem:
> {code}
> public static class N1 {
>       BigDecimal number;
>   }
>   @Test public void testNullableStringableField() throws Exception {
>       N1 datum = new N1();
>       datum.number = BigDecimal.TEN;
>       checkBinary(ReflectData.AllowNull.get(), ReflectData.AllowNull.get().getSchema(N1.class), datum, false);
>   }
> {code}

--
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