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

Switch to Threaded View
HBase >> mail # user >> The Problems When Retrieving By BinaryComparator


Copy link to this message
-
Re: The Problems When Retrieving By BinaryComparator
Mr Gupta,

Yes, you are right. After changing Bytes.toBytes(1000) to
Bytes.toBytes(1000L), it works fine.

However, the following exception still exists.

     [java] Exception in thread "main" java.lang.IllegalArgumentException:
offset (0) + length (8) exceed the capacity of the array: 2
     [java]  at
org.apache.hadoop.hbase.util.Bytes.explainWrongLengthOrOffset(Bytes.java:527)
     [java]  at org.apache.hadoop.hbase.util.Bytes.toLong(Bytes.java:505)
     [java]  at org.apache.hadoop.hbase.util.Bytes.toLong(Bytes.java:478)
     [java]  at
com.greatfree.testing.hbase.OrderedQualifierValue.main(Unknown Source)

After searching on the Web, one said it was possible that int type was
inserted into the table while retrieving the long value. I created the
table again and inserted the long type. But I still got the exception. I am
trying to solve the problem.

Thanks so much!
Bing
On Sat, Feb 25, 2012 at 8:31 AM, T Vinod Gupta <[EMAIL PROTECTED]>wrote:

> when you do  Bytes.toBytes(1000), you are not telling it whether 1000 is
> integer or long.. you have to be super careful here..
> i didnt read the flow fully but this caught my eye immediate.. try
> repopulating properly and use proper types when using Bytes.
>
> thanks
>
> On Fri, Feb 24, 2012 at 4:25 PM, Bing Li <[EMAIL PROTECTED]> wrote:
>
>> Dear all,
>>
>> I created a table as follows. I need to retrieve by the column of
>> "Salary",
>> which is a long type data. Some errors are got as follows.
>>
>> ROW                                 COLUMN+CELL
>>
>>  Classmate1                         column=ClassmateFamily:Address,
>> timestamp=1330118559432, value=Canada
>>  Classmate1                         column=ClassmateFamily:Age,
>> timestamp=1330118559429, value=42
>>  Classmate1                         column=ClassmateFamily:Career,
>> timestamp=1330118559431, value=Faculty
>>  Classmate1                         column=ClassmateFamily:Hobby,
>> timestamp=1330118559433, value=Soccer
>>  Classmate1                         column=ClassmateFamily:Name,
>> timestamp=1330118559427, value=Bing
>>  Classmate1                         column=ClassmateFamily:Salary,
>> timestamp=1330121577483, value=\x00\x00\x00\x00\x00\x00\x03\xEA  (1002 -
>> long)
>>  Classmate2                         column=ClassmateFamily:Address,
>> timestamp=1330118559436, value=US
>>  Classmate2                         column=ClassmateFamily:Age,
>> timestamp=1330118559434, value=52
>>  Classmate2                         column=ClassmateFamily:Career,
>> timestamp=1330118559435, value=Educator
>>  Classmate2                         column=ClassmateFamily:Hobby,
>> timestamp=1330118559437, value=Music
>>  Classmate2                         column=ClassmateFamily:Name,
>> timestamp=1330118559433, value=GreatFree
>>  Classmate2                         column=ClassmateFamily:Salary,
>> timestamp=1330118559393, value=\x00\x00\x00\x00\x00\x00\x05\xDC  (1500 -
>> long)
>>  Classmate3                         column=ClassmateFamily:Address,
>> timestamp=1330118559440, value=US
>>  Classmate3                         column=ClassmateFamily:Age,
>> timestamp=1330118559438, value=100
>>  Classmate3                         column=ClassmateFamily:Career,
>> timestamp=1330118559439, value=Researcher
>>  Classmate3                         column=ClassmateFamily:Hobby,
>> timestamp=1330118559442, value=Science
>>  Classmate3                         column=ClassmateFamily:Name,
>> timestamp=1330118559437, value=LBLabs
>>  Classmate3                         column=ClassmateFamily:Salary,
>> timestamp=1330118559397, value=\x00\x00\x00\x00\x00\x00\x07\x08  (1800 -
>> long)
>>  Classmate4                         column=ClassmateFamily:Address,
>> timestamp=1330118559445, value=Baoji
>>  Classmate4                         column=ClassmateFamily:Age,
>> timestamp=1330118559443, value=41
>>  Classmate4                         column=ClassmateFamily:Career,
>> timestamp=1330118559444, value=Lawyer
>>  Classmate4                         column=ClassmateFamily:Hobby,