java.lang.ClassCastException: cannot be cast to

Apache's JIRA Issue Tracker | Sushanth Sowmyan | 2 years ago
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Attempting to write to a HCatalog defined table backed by the AvroSerde fails with the following stacktrace: {code} java.lang.ClassCastException: cannot be cast to at$1.write( at org.apache.hcatalog.mapreduce.FileRecordWriterContainer.write( at org.apache.hcatalog.mapreduce.FileRecordWriterContainer.write( at org.apache.hcatalog.pig.HCatBaseStorer.putNext( at org.apache.hcatalog.pig.HCatStorer.putNext( at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigOutputFormat$PigRecordWriter.write( at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigOutputFormat$PigRecordWriter.write( at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.write( at org.apache.hadoop.mapreduce.task.TaskInputOutputContextImpl.write( {code} The proximal cause of this failure is that the AvroContainerOutputFormat's signature mandates a LongWritable key and HCat's FileRecordWriterContainer forces a NullWritable. I'm not sure of a general fix, other than redefining HiveOutputFormat to mandate a WritableComparable. It looks like accepting WritableComparable is what's done in the other Hive OutputFormats, and there's no reason AvroContainerOutputFormat couldn't also be changed, since it's ignoring the key. That way fixing things so FileRecordWriterContainer can always use NullWritable could get spun into a different issue? The underlying cause for failure to write to AvroSerde tables is that AvroContainerOutputFormat doesn't meaningfully implement getRecordWriter, so fixing the above will just push the failure into the placeholder RecordWriter.

    Apache's JIRA Issue Tracker | 2 years ago | Sushanth Sowmyan
    java.lang.ClassCastException: cannot be cast to
  2. 0

    Writing to Avro backed HCatalog table using mapreduce

    Stack Overflow | 2 years ago
    java.lang.ClassCastException: cannot be cast to

    Root Cause Analysis

    1. java.lang.ClassCastException cannot be cast to

    2. Hive Query Language
      1 frame
    3. org.apache.hcatalog
      1. org.apache.hcatalog.mapreduce.FileRecordWriterContainer.write(
      2. org.apache.hcatalog.mapreduce.FileRecordWriterContainer.write(
      3. org.apache.hcatalog.pig.HCatBaseStorer.putNext(
      4. org.apache.hcatalog.pig.HCatStorer.putNext(
      4 frames
    4. org.apache.pig
      1. org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigOutputFormat$PigRecordWriter.write(
      2. org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigOutputFormat$PigRecordWriter.write(
      2 frames
    5. Hadoop
      1. org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.write(
      2. org.apache.hadoop.mapreduce.task.TaskInputOutputContextImpl.write(
      2 frames