Common Java Errors

Here’s a common error which we’ve seen several times:

 

Failed with exception java.io.IOException:java.lang.ClassCastException: org.apache.hadoop.hive.ql.io.orc.OrcStruct cannot be cast to org.apache.hadoop.io.BinaryComparable

 

There’s an issue with doing a “show create table” and then executing the resulting “create table” statement if the table is ORC.

When you do the “show create table”, you get this:

STORED AS INPUTFORMAT

  ‘org.apache.hadoop.hive.ql.io.orc.OrcInputFormat’

OUTPUTFORMAT

  ‘org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat’

 

But if you create the table with those clauses, you will then get the casting error when selecting.  To fix this, you need to change your “create table” statement to just this:

               STORED AS ORC