<?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 Date Interval in Hive in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Date-Interval-in-Hive/m-p/228344#M190204</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to convert a postgres Greenplum function to Hive and encountered the below problem:&lt;/P&gt;&lt;P&gt;cast(from_unixtime(unix_timestamp(current_timestamp - interval 1 Month 9 days),'YYYYMM') as int)&lt;/P&gt;&lt;P&gt;This is working in pyspark when I use a Hive context but the same is failing in Ambari. Can anyone explain this? What should we use instead of interval to reduce 1 month and 9 days? We cant use 39 days as this will sometimes be 39 and sometimes 40&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Souveek&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jun 2018 19:18:26 GMT</pubDate>
    <dc:creator>souveekray</dc:creator>
    <dc:date>2018-06-27T19:18:26Z</dc:date>
    <item>
      <title>Date Interval in Hive</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Date-Interval-in-Hive/m-p/228344#M190204</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to convert a postgres Greenplum function to Hive and encountered the below problem:&lt;/P&gt;&lt;P&gt;cast(from_unixtime(unix_timestamp(current_timestamp - interval 1 Month 9 days),'YYYYMM') as int)&lt;/P&gt;&lt;P&gt;This is working in pyspark when I use a Hive context but the same is failing in Ambari. Can anyone explain this? What should we use instead of interval to reduce 1 month and 9 days? We cant use 39 days as this will sometimes be 39 and sometimes 40&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Souveek&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 19:18:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Date-Interval-in-Hive/m-p/228344#M190204</guid>
      <dc:creator>souveekray</dc:creator>
      <dc:date>2018-06-27T19:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Date Interval in Hive</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Date-Interval-in-Hive/m-p/228345#M190205</link>
      <description>&lt;P&gt;Hey &lt;A rel="user" href="https://community.cloudera.com/users/83246/souveekray.html" nodeid="83246"&gt;@Souveek Ray&lt;/A&gt;!&lt;/P&gt;&lt;P&gt;What about this?&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;select date_add(add_months(current_timestamp,-1),-9);&lt;/PRE&gt;Hope this helps!</description>
      <pubDate>Thu, 28 Jun 2018 06:23:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Date-Interval-in-Hive/m-p/228345#M190205</guid>
      <dc:creator>vmurakami</dc:creator>
      <dc:date>2018-06-28T06:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Date Interval in Hive</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Date-Interval-in-Hive/m-p/228346#M190206</link>
      <description>&lt;P&gt;Thanks a lot, this worked. but for my requirement I used the below syntax&lt;/P&gt;&lt;P&gt;from_unixtime(unix_timestamp(date_add(add_months(current_timestamp,-1),-9) ,'yyyy-MM-dd'), 'yyyyMM')&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Souveek&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 14:13:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Date-Interval-in-Hive/m-p/228346#M190206</guid>
      <dc:creator>souveekray</dc:creator>
      <dc:date>2018-07-02T14:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Date Interval in Hive</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Date-Interval-in-Hive/m-p/228347#M190207</link>
      <description>&lt;P&gt;Good to know &lt;A rel="user" href="https://community.cloudera.com/users/83246/souveekray.html" nodeid="83246"&gt;@Souveek Ray&lt;/A&gt; !&lt;BR /&gt;Please if the issue is solved, I'd kindly ask you to accept as an answer. Doing this will help other users to find the answer and will engage the contributors to keep doing the good job &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 14:17:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Date-Interval-in-Hive/m-p/228347#M190207</guid>
      <dc:creator>vmurakami</dc:creator>
      <dc:date>2018-07-02T14:17:21Z</dc:date>
    </item>
  </channel>
</rss>

