Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Map output mapreduce to Hive table

Highlighted

Map output mapreduce to Hive table

Explorer
Hi. I have a mapReduce that is writing a sequence file. These sequence object is custom object developed by me "com.masfworld.MyClass". So, I´m trying to map the output of my mapreduce to a hive table such as:
CREATE EXTERNAL TABLE test_seq(id string)STORED AS SEQUENCEFILE
LOCATION '/pathOutputMapReduce'
ADD JAR 'MyComponent.jar' => This jar contains "com.masfworld.MyClass"
Then, when I try to do a select it returns an error:
SELECT * from test_seq limit 2;
Failed with exception java.io.IOException:java.lang.ClassCastException: com.masfworld.MyClass cannot be cast to org.apache.hadoop.io.BinaryComparable
Can someone help me? Thanks!!!
2 REPLIES 2

Re: Map output mapreduce to Hive table

New Contributor

verify that whether "MyClass" is the implementing of WritableComparable or any other classes those supports WritableComparable. If not, make MyClass implementing it and try again.

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class BinaryComparable
extends Object
implements Comparable<BinaryComparable>

Interface supported by WritableComparable types supporting ordering/permutation by a representative set of bytes.

,

verify the super class of myclass and confirm that whether it is extended from any WritableComparable or any other class that support WritableComparable like Text.

Re: Map output mapreduce to Hive table

Explorer

Yes, my class implements WritableComparable but it doesn't work

Don't have an account?
Coming from Hortonworks? Activate your account here