[ 
https://issues.apache.org/jira/browse/GORA-170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13461875#comment-13461875
 ] 

Chris Gerken commented on GORA-170:
-----------------------------------

So over the weekend I finally got the source onto my machine where I applied 
this fix.  I'm getting past the problem where the offset is not zero, but I'm 
still getting the same error for a different reason.  The code is trying to 
extract the status which is an integer, but the ByteBuffer that comes out of 
the Avro object has one byte instead of the 4 expected by the 
IntegerSerializer.  I'm still trying to figure out why there's only one byte in 
the buffer, so this is still an open issue.
                
> Getting a BufferUnderflowException in class CassandraColumn, method 
> fromByteBuffer()
> ------------------------------------------------------------------------------------
>
>                 Key: GORA-170
>                 URL: https://issues.apache.org/jira/browse/GORA-170
>             Project: Apache Gora
>          Issue Type: Bug
>          Components: storage-cassandra
>    Affects Versions: 0.2.1
>         Environment: Not sure environment matters for this one but Ubuntu
>            Reporter: Chris Gerken
>            Priority: Blocker
>
> When using CassandraStore and GoraMapper to retrieve data previously stored 
> in Cassandra, a BufferUnderflowException is being thrown in method 
> fromByteBuffer() in class CassandraColumn.  This results in a complete 
> failure of the hadoop job trying to use the Cassandra data.
> The problem seems to be caused by an invalid assumption in the (de) 
> Serializer logic.  Serializers assume that the bytes in a ByteBuffer to be 
> deserialized start at offset 0 (zero) in the ByteBuffer's internal buffer.  
> In fact, there are times when a ByteBuffer passed back from  the 
> Hector/Thrift API will have its data start at a non-zero offset in its 
> buffer.  When serializers are given these non-zero offset ByteBuffers an 
> exception, usually BufferUnderflowException, is thrown.
> The suggested fix is to use the TbaseHelper class from Cassandra/Thrift:
>   import org.apache.thrift.TBaseHelper;
>   protected Object fromByteBuffer(Schema schema, ByteBuffer byteBuffer) {
>     Object value = null;
>     Serializer serializer = GoraSerializerTypeInferer.getSerializer(schema);
>     if (serializer == null) {
>       LOG.info("Schema is not supported: " + schema.toString());
>     } else {
>       ByteBuffer corrected = TBaseHelper.rightSize(byteBuffer);
>       value = serializer.fromByteBuffer(corrected);
>     }
>     return value;
>   }
>  

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

Reply via email to