Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
HBase >> mail # user >> HBase thrift API - Mutation store a float in a column


+
Nicolas Seyvet 2013-05-03, 13:23
+
manoj p 2013-05-03, 13:31
+
Nicolas Seyvet 2013-05-03, 13:35
Copy link to this message
-
Re: HBase thrift API - Mutation store a float in a column
Looking at
http://docs.oracle.com/javase/6/docs/api/java/nio/ByteBuffer.html#putFloat(float):

... into this buffer at the current position, and then increments the
position by four.

In TBaseHelper:

  public static int byteBufferToByteArray(ByteBuffer byteBuffer, byte[]
target, int offset) {

    int remaining = byteBuffer.remaining();

    System.arraycopy(byteBuffer.array(),

        byteBuffer.arrayOffset() + byteBuffer.position(),
I think you need to rewind before calling mutation.setValue().

On Fri, May 3, 2013 at 6:35 AM, Nicolas Seyvet
<[EMAIL PROTECTED]>wrote:

> The initial value is 12.0, the resulting is always =\x00\x00\x00\x00
>
> Even if I put something bigger or smaller.
>
> -----Original Message-----
> From: manoj p [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 03, 2013 3:31 PM
> To: [EMAIL PROTECTED]
> Subject: Re: HBase thrift API - Mutation store a float in a column
>
> HBase stores values as byte arrays. When a float value is converted to
> byte, there is a possibility of data truncation.
>
> I guess the precision loss that happens due to data truncation might be
> the reason for getting the same value 0 repeatedly.
>
> BR/Manoj
>
+
Nicolas Seyvet 2013-05-03, 13:58
+
Ted Yu 2013-05-03, 14:13
+
Nicolas Seyvet 2013-05-03, 14:28