<?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 date time problem in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/hive-date-time-problem/m-p/139955#M39947</link>
    <description>&lt;P&gt;hi all&lt;/P&gt;&lt;P&gt;i have problem, when i am loading the multiple date format data in single file to hive table &lt;/P&gt;&lt;P&gt;i have the following sample input file(a.txt)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;a|20-11-2015 22:07&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;b|wed, jul 23, '04&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;c|2016-05-11T05:04:25+0000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;d|wed 2016-05-11T05:04:25+0000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;i created the table in hive &lt;/P&gt;&lt;PRE&gt;hive&amp;gt; create table tmp(a string, b string) row format delimited fields terminated by'|';&lt;/PRE&gt;&lt;PRE&gt;hive&amp;gt; load data local inpath 'a.txt' overwrite into table tmp;
hive&amp;gt; create table mytime(a string, b timestamp);
hive&amp;gt; insert into table mytime select a, from_unixtime(unix_timestamp(b, 'dd-MM-yyyy HH:mm')) from tmp;&lt;/PRE&gt;&lt;P&gt;by using above query only one format date is loaded  remaining format date shows null.&lt;/P&gt;&lt;P&gt;how to load if single file  having different date formats  as shown in above a.txt  to hive tables &lt;/P&gt;&lt;P&gt;please try to resolve this problem&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;&lt;P&gt;with regards,&lt;/P&gt;&lt;P&gt;swathi&lt;/P&gt;</description>
    <pubDate>Mon, 12 Sep 2016 12:22:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2016-09-12T12:22:25Z</dc:date>
    <item>
      <title>hive date time problem</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/hive-date-time-problem/m-p/139953#M39945</link>
      <description>&lt;P&gt;i have problem, when i am loading data in hive table &lt;/P&gt;&lt;P&gt;i have the following sample input file(a.txt)&lt;/P&gt;&lt;P&gt;a,20-11-2015 22:07&lt;/P&gt;&lt;P&gt;b,17-08-2015 09:45&lt;/P&gt;&lt;P&gt;i created the table in hive &lt;/P&gt;&lt;P&gt;create table mytime(a string, b timestamp) row format delimited fields terminated by ',';&lt;/P&gt;&lt;P&gt;load data local inpath 'a.txt' overwrite into table mytime; &lt;/P&gt;&lt;P&gt;select* from mytime;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="7404-untitled.png" style="width: 646px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/21797iCC3328EC2ED88683/image-size/medium?v=v2&amp;amp;px=400" role="button" title="7404-untitled.png" alt="7404-untitled.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;it showing null values.&lt;/P&gt;&lt;P&gt;please give me suggestion to solve this problem.&lt;/P&gt;&lt;P&gt;thanks in advance. &lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 08:24:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/hive-date-time-problem/m-p/139953#M39945</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-08-19T08:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: hive date time problem</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/hive-date-time-problem/m-p/139954#M39946</link>
      <description>&lt;P&gt;You need an additional, temporary table to read your input file, and then some date conversion:&lt;/P&gt;&lt;PRE&gt;hive&amp;gt; create table tmp(a string, b string) row format delimited fields terminated by ',';
hive&amp;gt; load data local inpath 'a.txt' overwrite into table tmp;
hive&amp;gt; create table mytime(a string, b timestamp);
hive&amp;gt; insert into table mytime select a, from_unixtime(unix_timestamp(b, 'dd-MM-yyyy HH:mm')) from tmp;
hive&amp;gt; select * from mytime;
a 2015-11-20 22:07:00
b 2015-08-17 09:45:00
&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Sep 2016 18:36:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/hive-date-time-problem/m-p/139954#M39946</guid>
      <dc:creator>pminovic</dc:creator>
      <dc:date>2016-09-07T18:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: hive date time problem</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/hive-date-time-problem/m-p/139955#M39947</link>
      <description>&lt;P&gt;hi all&lt;/P&gt;&lt;P&gt;i have problem, when i am loading the multiple date format data in single file to hive table &lt;/P&gt;&lt;P&gt;i have the following sample input file(a.txt)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;a|20-11-2015 22:07&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;b|wed, jul 23, '04&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;c|2016-05-11T05:04:25+0000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;d|wed 2016-05-11T05:04:25+0000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;i created the table in hive &lt;/P&gt;&lt;PRE&gt;hive&amp;gt; create table tmp(a string, b string) row format delimited fields terminated by'|';&lt;/PRE&gt;&lt;PRE&gt;hive&amp;gt; load data local inpath 'a.txt' overwrite into table tmp;
hive&amp;gt; create table mytime(a string, b timestamp);
hive&amp;gt; insert into table mytime select a, from_unixtime(unix_timestamp(b, 'dd-MM-yyyy HH:mm')) from tmp;&lt;/PRE&gt;&lt;P&gt;by using above query only one format date is loaded  remaining format date shows null.&lt;/P&gt;&lt;P&gt;how to load if single file  having different date formats  as shown in above a.txt  to hive tables &lt;/P&gt;&lt;P&gt;please try to resolve this problem&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;&lt;P&gt;with regards,&lt;/P&gt;&lt;P&gt;swathi&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2016 12:22:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/hive-date-time-problem/m-p/139955#M39947</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-09-12T12:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: hive date time problem</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/hive-date-time-problem/m-p/139956#M39948</link>
      <description>&lt;P&gt;Hi Swathi,&lt;/P&gt;&lt;P&gt;As per my understanding, source date should be in any one format. Then only date conversion will work properly.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 20:34:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/hive-date-time-problem/m-p/139956#M39948</guid>
      <dc:creator>atulwagh01</dc:creator>
      <dc:date>2016-09-13T20:34:23Z</dc:date>
    </item>
  </channel>
</rss>

