<?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: Delete partition Hive error in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336700#M232354</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/95985"&gt;@Jmeks&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I assume the partitioning column for this table is literally named as "date". Please note that "date" is a reserved word in Hive (see the &lt;A href="https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl#LanguageManualDDL-Keywords,Non-reservedKeywordsandReservedKeywords" target="_self"&gt;docs&lt;/A&gt; for reference), so it is not recommended to use it in table names and column identifiers. If you really need to use it as an identifier, then encapsulate it within backticks. For example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ALTER TABLE customer_transaction_extract DROP IF EXISTS PARTITION (`date`="2019-11-13");&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Best regards,&amp;nbsp;Miklos&lt;/P&gt;</description>
    <pubDate>Mon, 21 Feb 2022 10:38:16 GMT</pubDate>
    <dc:creator>mszurap</dc:creator>
    <dc:date>2022-02-21T10:38:16Z</dc:date>
    <item>
      <title>Delete partition Hive error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336688#M232349</link>
      <description>&lt;P&gt;Hi guys, i am trying some hive partitions but i am getting the following errors. kindly help figure out the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;0: jdbc:hive2://svdt5hadoopms02.bigdatadev.sa&amp;gt; ALTER TABLE customer_transaction_extract DROP IF EXISTS PARTITION (date='date=2019-11-13') PURGE;&lt;BR /&gt;Error: Error while compiling statement: FAILED: ParseException line 1:67 cannot recognize input near 'date' '=' ''date=2019-11-13'' in drop partition statement (state=42000,code=40000)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;0: jdbc:hive2://svdt5hadoopms02.bigdatadev.sa&amp;gt; ALTER TABLE customer_transaction_extract DROP IF EXISTS PARTITION (date='date="2019-11-13"') PURGE;&lt;BR /&gt;Error: Error while compiling statement: FAILED: ParseException line 1:67 cannot recognize input near 'date' '=' ''date="2019-11-13"'' in drop partition statement (state=42000,code=40000)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;0: jdbc:hive2://svdt5hadoopms02.bigdatadev.sa&amp;gt; ALTER TABLE customer_transaction_extract DROP IF EXISTS PARTITION (date=`2019-11-13`) PURGE;&lt;BR /&gt;Error: Error while compiling statement: FAILED: ParseException line 1:67 cannot recognize input near 'date' '=' '2019-11-13' in drop partition statement (state=42000,code=40000)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;0: jdbc:hive2://svdt5hadoopms02.bigdatadev.sa&amp;gt; ALTER TABLE customer_transaction_extract DROP IF EXISTS PARTITION (date &amp;gt;='1648-10-03', date &amp;lt;='2022-02-15') ;&lt;BR /&gt;Error: Error while compiling statement: FAILED: ParseException line 1:67 cannot recognize input near 'date' '&amp;gt;=' ''1648-10-03'' in drop partition statement (state=42000,code=40000)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;0: jdbc:hive2://svdt5hadoopms02.bigdatadev.sa&amp;gt; ALTER TABLE customer_transaction_extract DROP IF EXISTS PARTITION (date &amp;gt;='1648-10-03');&lt;BR /&gt;Error: Error while compiling statement: FAILED: ParseException line 1:67 cannot recognize input near 'date' '&amp;gt;=' ''1648-10-03'' in drop partition statement (state=42000,code=40000)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;0: jdbc:hive2://svdt5hadoopms02.bigdatadev.sa&amp;gt; ALTER TABLE customer_transaction_extract DROP PARTITION (date &amp;gt;='1644948900', date &amp;lt;='1644949001');&lt;BR /&gt;Error: Error while compiling statement: FAILED: ParseException line 1:57 cannot recognize input near 'date' '&amp;gt;=' ''1644948900'' in drop partition statement (state=42000,code=40000)&lt;BR /&gt;&lt;BR /&gt;0: jdbc:hive2://svdt5hadoopms02.bigdatadev.sa&amp;gt; ALTER TABLE customer_transaction_extract DROP PARTITION (date &amp;gt;='1644948900', date &amp;lt;='1644949001');&lt;BR /&gt;Error: Error while compiling statement: FAILED: ParseException line 1:57 cannot recognize input near 'date' '&amp;gt;=' ''164494&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 07:48:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336688#M232349</guid>
      <dc:creator>Jmeks</dc:creator>
      <dc:date>2022-02-21T07:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Delete partition Hive error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336700#M232354</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/95985"&gt;@Jmeks&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I assume the partitioning column for this table is literally named as "date". Please note that "date" is a reserved word in Hive (see the &lt;A href="https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl#LanguageManualDDL-Keywords,Non-reservedKeywordsandReservedKeywords" target="_self"&gt;docs&lt;/A&gt; for reference), so it is not recommended to use it in table names and column identifiers. If you really need to use it as an identifier, then encapsulate it within backticks. For example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ALTER TABLE customer_transaction_extract DROP IF EXISTS PARTITION (`date`="2019-11-13");&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Best regards,&amp;nbsp;Miklos&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 10:38:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336700#M232354</guid>
      <dc:creator>mszurap</dc:creator>
      <dc:date>2022-02-21T10:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Delete partition Hive error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336705#M232356</link>
      <description>&lt;P&gt;Hi Miklos,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate your help but using your code still throws the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;| date=2019-11-13 |&lt;BR /&gt;| date=2022-02-15 |&lt;BR /&gt;| date=2022-02-16 |&lt;BR /&gt;| date=2022-02-17 |&lt;BR /&gt;| date=2022-02-19 |&lt;BR /&gt;| date=2022-02-20 |&lt;BR /&gt;| date=__HIVE_DEFAULT_PARTITION__ |&lt;BR /&gt;+----------------------------------+&lt;BR /&gt;790 rows selected (0.284 seconds)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;0: jdbc:hive2://svdt5hadoopms02.bigdatadev.sa&amp;gt; ALTER TABLE customer_transaction_extract DROP IF EXISTS PARTITION (`date`="2019-11-13");&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Error: Error while compiling statement: FAILED: SemanticException Unexpected unknown partitions for (date = DATE'2019-11-13') (state=42000,code=40000)&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 12:17:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336705#M232356</guid>
      <dc:creator>Jmeks</dc:creator>
      <dc:date>2022-02-21T12:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Delete partition Hive error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336717#M232359</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/95985"&gt;@Jmeks&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Can you clarify which CDH/HDP/CDP version do you have?&lt;/P&gt;&lt;P&gt;What is the datatype of that "&lt;SPAN&gt;date" partitioning column?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The mentioned syntax works for both string and date datatypes in CDH 6.x.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 15:50:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336717#M232359</guid>
      <dc:creator>mszurap</dc:creator>
      <dc:date>2022-02-21T15:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Delete partition Hive error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336758#M232377</link>
      <description>&lt;P&gt;Hi mszurap,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;i use HDP-3.1.0.0. the data type for the `date` partitioning column is date&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 11:17:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336758#M232377</guid>
      <dc:creator>Jmeks</dc:creator>
      <dc:date>2022-02-22T11:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: Delete partition Hive error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336768#M232379</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/95985"&gt;@Jmeks&lt;/a&gt;&amp;nbsp;,Please check again how the table has been created or how those partitions were created ("describe formatted &amp;lt;table&amp;gt; partition &amp;lt;partspec&amp;gt;"), as the same is still working for me even on HDP 3.1.0:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;create table mdatetest (col1 string) partitioned by (`date` date) location '/tmp/md';

alter table mdatetest add partition (`date`="2022-02-22");



show partitions mdatetest;

+------------------+
| partition |
+------------------+
| date=2022-02-22 |
+------------------+



alter table mdatetest drop partition (`date`="2022-02-22");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 12:57:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336768#M232379</guid>
      <dc:creator>mszurap</dc:creator>
      <dc:date>2022-02-22T12:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Delete partition Hive error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336996#M232455</link>
      <description>&lt;P&gt;Many Thanks. I finally managed to delete the partitions using your code&lt;/P&gt;</description>
      <pubDate>Thu, 24 Feb 2022 10:17:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Delete-partition-Hive-error/m-p/336996#M232455</guid>
      <dc:creator>Jmeks</dc:creator>
      <dc:date>2022-02-24T10:17:34Z</dc:date>
    </item>
  </channel>
</rss>

