<?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: Hive CAST functions return NULL values: in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-CAST-functions-return-NULL-values/m-p/143263#M44177</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/1842/lsundar19.html" nodeid="1842"&gt;@Sundar Lakshmanan&lt;/A&gt; Glad we found the problem.  If you are satisfied, please accept the original answer.  (That's how HCC works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Oct 2016 21:06:57 GMT</pubDate>
    <dc:creator>gkeys</dc:creator>
    <dc:date>2016-10-21T21:06:57Z</dc:date>
    <item>
      <title>Hive CAST functions return NULL values:</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-CAST-functions-return-NULL-values/m-p/143260#M44174</link>
      <description>&lt;P&gt;Hive CAST functions return NULL values:For example one of the staging area table  column have the data like &lt;/P&gt;&lt;P&gt;-21.475,00,&lt;/P&gt;&lt;P&gt;-26.609,00, &lt;/P&gt;&lt;P&gt;-21.932,47,&lt;/P&gt;&lt;P&gt;-17.300,00(String), My expected output would be like in landing area is &lt;/P&gt;&lt;P&gt;-21475,00,&lt;/P&gt;&lt;P&gt;-26609,00,&lt;/P&gt;&lt;P&gt;-21932,47,&lt;/P&gt;&lt;P&gt;-17300.00(decimal(12,2).&lt;/P&gt;&lt;P&gt;Staging area column's datatype : String&lt;/P&gt;&lt;P&gt;Landing area table column's datatype: decimal(12,2). &lt;/P&gt;&lt;P&gt;During data movement from staging to Landing area. i have used insert query with select statement like&lt;/P&gt;&lt;P&gt;SELECT CAST(regexp_replace(regexp_replace(column1,'\\.',''),',','.') as decimal(12,2)) FROM table_name;&lt;/P&gt;&lt;P&gt;the above query return null values. &lt;/P&gt;&lt;P&gt;Kindly do the needful.&lt;/P&gt;&lt;P&gt;Thanks in advance!!&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 20:20:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-CAST-functions-return-NULL-values/m-p/143260#M44174</guid>
      <dc:creator>lsundar19</dc:creator>
      <dc:date>2016-10-21T20:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Hive CAST functions return NULL values:</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-CAST-functions-return-NULL-values/m-p/143261#M44175</link>
      <description>&lt;P&gt;If your values have any text characters in them, Hive will return null if you try to cast them to decimal.  For example, if there is a trailing whitespace character it will look like a decimal but hive will see the text character (whitespace).&lt;/P&gt;&lt;P&gt;It looks like your values have commas after them.  If so, Hive will convert to null for reasons explained above.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 20:43:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-CAST-functions-return-NULL-values/m-p/143261#M44175</guid>
      <dc:creator>gkeys</dc:creator>
      <dc:date>2016-10-21T20:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: Hive CAST functions return NULL values:</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-CAST-functions-return-NULL-values/m-p/143262#M44176</link>
      <description>&lt;P&gt;Thanks for your input &lt;A rel="user" href="https://community.cloudera.com/users/11288/gkeys.html" nodeid="11288"&gt;@Greg Keys&lt;/A&gt; !!!&lt;/P&gt;&lt;P&gt;Yes the values has whitespace. So i used to trim the values before CAST. It's working as expected. &lt;/P&gt;&lt;P&gt;SELECT CAST(regexp_replace(regexp_replace(TRIM(column1),'\\.',''),',','.') as decimal(12,2)) FROM table_name;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 20:58:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-CAST-functions-return-NULL-values/m-p/143262#M44176</guid>
      <dc:creator>lsundar19</dc:creator>
      <dc:date>2016-10-21T20:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Hive CAST functions return NULL values:</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-CAST-functions-return-NULL-values/m-p/143263#M44177</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/1842/lsundar19.html" nodeid="1842"&gt;@Sundar Lakshmanan&lt;/A&gt; Glad we found the problem.  If you are satisfied, please accept the original answer.  (That's how HCC works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 21:06:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-CAST-functions-return-NULL-values/m-p/143263#M44177</guid>
      <dc:creator>gkeys</dc:creator>
      <dc:date>2016-10-21T21:06:57Z</dc:date>
    </item>
  </channel>
</rss>

