<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.ClassCastException: org.apache.hadoop.hive.serde2.io.HiveDecimalWritable cannot be cast to org.apache.hadoop.io.LongWritable in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Failed-with-exception-java-io-IOException-org-apache-hadoop/m-p/198113#M81065</link>
    <description>&lt;P&gt;Hey &lt;A rel="user" href="https://community.cloudera.com/users/1842/lsundar19.html" nodeid="1842"&gt;@Sundar Lakshmanan&lt;/A&gt;!&lt;BR /&gt;Could you share with us the following output? &lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;describe formatted &amp;lt;table_name&amp;gt;;&lt;/PRE&gt;&lt;P&gt;Usually, this happens to mismatched types or some data overflowing the datatype.&lt;BR /&gt;Are you able to do a simple query?&lt;/P&gt;&lt;PRE&gt;select * from &amp;lt;table_name&amp;gt; limit 10;&lt;/PRE&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Sun, 29 Jul 2018 11:50:11 GMT</pubDate>
    <dc:creator>vmurakami</dc:creator>
    <dc:date>2018-07-29T11:50:11Z</dc:date>
    <item>
      <title>Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.ClassCastException: org.apache.hadoop.hive.serde2.io.HiveDecimalWritable cannot be cast to org.apache.hadoop.io.LongWritable</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Failed-with-exception-java-io-IOException-org-apache-hadoop/m-p/198111#M81063</link>
      <description />
      <pubDate>Tue, 24 Jul 2018 20:14:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Failed-with-exception-java-io-IOException-org-apache-hadoop/m-p/198111#M81063</guid>
      <dc:creator>lsundar19</dc:creator>
      <dc:date>2018-07-24T20:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.ClassCastException: org.apache.hadoop.hive.serde2.io.HiveDecimalWritable cannot be cast to org.apache.hadoop.io.LongWritable</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Failed-with-exception-java-io-IOException-org-apache-hadoop/m-p/198112#M81064</link>
      <description>&lt;P&gt;got the above error while select the records from hive table.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 20:15:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Failed-with-exception-java-io-IOException-org-apache-hadoop/m-p/198112#M81064</guid>
      <dc:creator>lsundar19</dc:creator>
      <dc:date>2018-07-24T20:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.ClassCastException: org.apache.hadoop.hive.serde2.io.HiveDecimalWritable cannot be cast to org.apache.hadoop.io.LongWritable</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Failed-with-exception-java-io-IOException-org-apache-hadoop/m-p/198113#M81065</link>
      <description>&lt;P&gt;Hey &lt;A rel="user" href="https://community.cloudera.com/users/1842/lsundar19.html" nodeid="1842"&gt;@Sundar Lakshmanan&lt;/A&gt;!&lt;BR /&gt;Could you share with us the following output? &lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;describe formatted &amp;lt;table_name&amp;gt;;&lt;/PRE&gt;&lt;P&gt;Usually, this happens to mismatched types or some data overflowing the datatype.&lt;BR /&gt;Are you able to do a simple query?&lt;/P&gt;&lt;PRE&gt;select * from &amp;lt;table_name&amp;gt; limit 10;&lt;/PRE&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jul 2018 11:50:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Failed-with-exception-java-io-IOException-org-apache-hadoop/m-p/198113#M81065</guid>
      <dc:creator>vmurakami</dc:creator>
      <dc:date>2018-07-29T11:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.ClassCastException: org.apache.hadoop.hive.serde2.io.HiveDecimalWritable cannot be cast to org.apache.hadoop.io.LongWritable</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Failed-with-exception-java-io-IOException-org-apache-hadoop/m-p/285601#M81066</link>
      <description>&lt;P&gt;No i cant view the result of this simple query&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Dec 2019 13:21:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Failed-with-exception-java-io-IOException-org-apache-hadoop/m-p/285601#M81066</guid>
      <dc:creator>raja1010</dc:creator>
      <dc:date>2019-12-14T13:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.ClassCastException: org.apache.hadoop.hive.serde2.io.HiveDecimalWritable cannot be cast to org.apache.hadoop.io.LongWritable</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Failed-with-exception-java-io-IOException-org-apache-hadoop/m-p/409051#M81067</link>
      <description>&lt;P&gt;Instead of select *, you can use the column names you got from describe statement and identify the column with the issue (the type can be helpful there)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 May 2025 11:58:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Failed-with-exception-java-io-IOException-org-apache-hadoop/m-p/409051#M81067</guid>
      <dc:creator>alvarolucas</dc:creator>
      <dc:date>2025-05-30T11:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.ClassCastException: org.apache.hadoop.hive.serde2.io.HiveDecimalWritable cannot be cast to org.apache.hadoop.io.LongWritable</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Failed-with-exception-java-io-IOException-org-apache-hadoop/m-p/409100#M81068</link>
      <description>&lt;P&gt;It does looks like query failed with&amp;nbsp;&lt;FONT color="#FF0000"&gt;ClassCastException&lt;FONT color="#000000"&gt;.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;It indicates that (&amp;nbsp;&lt;FONT color="#FF0000"&gt;org.apache.hadoop.hive.serde2.io.HiveDecimalWritable cannot be cast to org.apache.hadoop.io.LongWritable&lt;FONT color="#000000"&gt;&amp;nbsp;)&amp;nbsp;a mismatch between the data type Hive expects and the data type it's actually encountering while processing the query.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;From the Error trace , Hive treats a value as a DECIMAL(HiveDecimalWritable) but the metadata seems to be Long(LongWritable).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;One possible Reason might be &lt;STRONG&gt;Schema Mismatch:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;Hive table schema defines a column but the&amp;nbsp;underlying data file (e.g., Parquet, ORC, ...) for that column actually contains DECIMAL Values.&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;To validate ,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Run&amp;nbsp;&lt;STRONG&gt;DESCRIBE FORMATTED &amp;lt;your_table_name&amp;gt;;&amp;nbsp;&lt;/STRONG&gt;&amp;nbsp;for the table involved in the failing query.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;Pay close attention to the data types of all columns, especially those that might be involved in the conversion.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;Compare these Hive schema data types with the actual data types in your source data files. For example, &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;if you're using Parquet, use tools like &lt;STRONG&gt;parquet-tools&lt;/STRONG&gt; to inspect the schema of&amp;nbsp; Parquet files. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;if you're using ORC , use &lt;STRONG&gt;hive --orcfiledump&lt;/STRONG&gt;&amp;nbsp;to inspect the schema of orc files.&lt;BR /&gt;&lt;BR /&gt;Also make sure that Serde's pointing to valid underlying file formats.&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jun 2025 13:55:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Failed-with-exception-java-io-IOException-org-apache-hadoop/m-p/409100#M81068</guid>
      <dc:creator>ggangadharan</dc:creator>
      <dc:date>2025-06-02T13:55:49Z</dc:date>
    </item>
  </channel>
</rss>

