1

Tried one sample of handling a table in hbase from hive.

The CREATE EXTERNAL TABLE command was successful, but the select statement gives a class cast exception

ENV: hive 0.12.0, hbase 0.96.1, hadoop 2.2 , Ubuntu 12.04 on Virtual box

hive> SHOW TABLES;                                                                   
OK
hbatablese_myhive
Time taken: 0.309 seconds, Fetched: 1 row(s)
hive> SELECT * FROM hbatablese_myhive;
OK

**Failed with exception

java.io.IOException:java.lang.ClassCastException: org.apache.hadoop.hbase.client.Result cannot be cast to org.apache.hadoop.io.Writable**
Time taken: 1.179 seconds

hive> 

The same table on HBASE console:

hbase(main):002:0> scan 'myhive'
ROW                                   COLUMN+CELL                                                                                           



 row1                                 column=ratings:userid, timestamp=1392886585074, value=user1                                               
 row2                                 column=ratings:userid, timestamp=1392886606457, value=user2                                               
2 row(s) in 0.0520 seconds

1 Answer 1

1

There used to be a Writables.copyWritable(Result result, Result value) call in an old version of the next(Immutablebyteswritable key, Result value) method of TableRecordReaderImpl.java.

the copyWritable has been removed now and only works with Writable, Writable arguments.

To do a copy now, you need to use value.copyFrom(result). This will do a deep copy of the data from source to destination

I am guessing you have some library mismatch which is making these calls happen and trying to cast from Result, Result to Writable, Writable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.