<?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: not able to use '_' in column name or cannot use reserved keywords in column name in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/not-able-to-use-in-column-name-or-cannot-use-reserved/m-p/376873#M243042</link>
    <description>&lt;P&gt;Both the below queries should work by default. I have checked by running them against CDP 7.2.17.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;create external table testkeyword1( `transform` string)
create external table testunderscore1( `_name` string, `_id` string);&lt;/LI-CODE&gt;&lt;P&gt;What is the Apache Hive or CDP/CDH/HDP version you are using?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Sep 2023 15:28:48 GMT</pubDate>
    <dc:creator>cravani</dc:creator>
    <dc:date>2023-09-26T15:28:48Z</dc:date>
    <item>
      <title>not able to use '_' in column name or cannot use reserved keywords in column name</title>
      <link>https://community.cloudera.com/t5/Support-Questions/not-able-to-use-in-column-name-or-cannot-use-reserved/m-p/376856#M243034</link>
      <description>&lt;P&gt;Hello Team,&lt;BR /&gt;&lt;BR /&gt;I am trying to use the underscore "_" in the column name example "_name" but the create statement is failing. i also wanted to use the reserved keywords example "transform" as column name but that is also not working.&lt;BR /&gt;&lt;BR /&gt;I tried setting the values for keyword and for identifiers while running command still it is giving me error when running via beeline&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following are the commands and the error that i am getting&amp;nbsp; :&lt;/P&gt;&lt;P&gt;Command : sudo -u hive beeline -u "jdbc:hive2://cdp1:2181,cdp2:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;;principal=hive/_HOST@hdpcluster.test" -n hive --showHeader=false --outputformat=tsv2 -e "SET hive.support.quoted.identifiers=column;use jayesh; create external table testkeyword1( `transform` string);";&lt;BR /&gt;&lt;BR /&gt;error :&amp;nbsp;Error: Error while compiling statement: FAILED: ParseException line 1:45 cannot recognize input near ')' '&amp;lt;EOF&amp;gt;' '&amp;lt;EOF&amp;gt;' in column type (state=42000,code=40000)&lt;BR /&gt;------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Command :&amp;nbsp;sudo -u hive beeline -u "jdbc:hive2://cdp1.:2181,cdp2:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;;principal=hive/_HOST@hdpcluster.test" -n hive --showHeader=false --outputformat=tsv2 -e "SET hive.support.sql11.reserved.keywords=false;use jayesh; create external table testkeyowrd2( transform string)";&lt;/P&gt;&lt;P&gt;error :&amp;nbsp; Error while compiling statement: FAILED: ParseException line 1:38 cannot recognize input near 'transform' 'string' ')' in column name or constraint (state=42000,code=40000)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Command :&amp;nbsp; sudo -u hive beeline -u "jdbc:hive2://cdp1:2181,cdp2:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;;principal=hive/_HOST@hdpcluster.test" -n hive --showHeader=false --outputformat=tsv2 -e "set hive.support.sql11.reserved.keywords=false; set hive.support.quoted.identifiers=column;use jayesh; create external table testkeyword3( transform string)";&lt;/P&gt;&lt;P&gt;error :&amp;nbsp;Error: Error while compiling statement: FAILED: ParseException line 1:38 cannot recognize input near 'transform' 'string' ')' in column name or constraint (state=42000,code=40000)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Command :&amp;nbsp; sudo -u hive beeline -u "jdbc:hive2://cdp1:2181,cdp2:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;;principal=hive/_HOST@hdpcluster.test" -n hive --showHeader=false --outputformat=tsv2 -e "set hive.support.sql11.reserved.keywords=false; set hive.support.quoted.identifiers=column;use jayesh; create external table testunderscore( `_name` string, `_id` string)";&lt;/P&gt;&lt;P&gt;error :&amp;nbsp;&lt;/P&gt;&lt;P&gt;-bash: _name: command not found&lt;BR /&gt;-bash: _id: command not found&lt;/P&gt;&lt;P&gt;Error: Error while compiling statement: FAILED: ParseException line 1:45 cannot recognize input near ',' 'string' ')' in column type (state=42000,code=40000)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 14:04:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/not-able-to-use-in-column-name-or-cannot-use-reserved/m-p/376856#M243034</guid>
      <dc:creator>jayes</dc:creator>
      <dc:date>2023-09-26T14:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: not able to use '_' in column name or cannot use reserved keywords in column name</title>
      <link>https://community.cloudera.com/t5/Support-Questions/not-able-to-use-in-column-name-or-cannot-use-reserved/m-p/376872#M243041</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/107114"&gt;@jayes&lt;/a&gt;&amp;nbsp;Welcome to the Cloudera Community!&lt;BR /&gt;&lt;BR /&gt;To help you get the best possible solution, I have tagged our Hive experts&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/34263"&gt;@JoseManuel&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/38161"&gt;@cravani&lt;/a&gt;&amp;nbsp; who may be able to assist you further.&lt;BR /&gt;&lt;BR /&gt;Please keep us updated on your post, and we hope you find a satisfactory solution to your query.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 15:19:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/not-able-to-use-in-column-name-or-cannot-use-reserved/m-p/376872#M243041</guid>
      <dc:creator>DianaTorres</dc:creator>
      <dc:date>2023-09-26T15:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: not able to use '_' in column name or cannot use reserved keywords in column name</title>
      <link>https://community.cloudera.com/t5/Support-Questions/not-able-to-use-in-column-name-or-cannot-use-reserved/m-p/376873#M243042</link>
      <description>&lt;P&gt;Both the below queries should work by default. I have checked by running them against CDP 7.2.17.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;create external table testkeyword1( `transform` string)
create external table testunderscore1( `_name` string, `_id` string);&lt;/LI-CODE&gt;&lt;P&gt;What is the Apache Hive or CDP/CDH/HDP version you are using?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 15:28:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/not-able-to-use-in-column-name-or-cannot-use-reserved/m-p/376873#M243042</guid>
      <dc:creator>cravani</dc:creator>
      <dc:date>2023-09-26T15:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: not able to use '_' in column name or cannot use reserved keywords in column name</title>
      <link>https://community.cloudera.com/t5/Support-Questions/not-able-to-use-in-column-name-or-cannot-use-reserved/m-p/376901#M243053</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/38161"&gt;@cravani&lt;/a&gt;&amp;nbsp;please find the hive version&lt;BR /&gt;&lt;BR /&gt;Hive 3.1.3000.7.1.8.28-1&lt;BR /&gt;Git git://centos7-builds-zb40x/grid/0/jenkins/workspace/workspace/CDH-parallel-centos7/SOURCES/hive -r ******&lt;BR /&gt;Compiled by jenkins on Fri Apr 14 11:40:33 UTC 2023&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 04:25:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/not-able-to-use-in-column-name-or-cannot-use-reserved/m-p/376901#M243053</guid>
      <dc:creator>jayes</dc:creator>
      <dc:date>2023-09-27T04:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: not able to use '_' in column name or cannot use reserved keywords in column name</title>
      <link>https://community.cloudera.com/t5/Support-Questions/not-able-to-use-in-column-name-or-cannot-use-reserved/m-p/377011#M243094</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/107114"&gt;@jayes&lt;/a&gt;&amp;nbsp; I had another look into the problem description and I see queries run with 2 categories&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Column names enclosed in backquotes&lt;/LI&gt;&lt;LI&gt;Column names not enclosed in backquotes.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;below are&amp;nbsp;the root cause for both the categories, please find the solution at the end of this comment.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Case 1:&lt;/U&gt;&lt;/STRONG&gt; This one fails because you are running SQL with &lt;STRONG&gt;-e&amp;nbsp;&lt;/STRONG&gt;option and and column values are enclosed in backticks &lt;STRONG&gt;"`",&amp;nbsp;&lt;/STRONG&gt;the value inside backticks is considered as a Linux command as opposed to be a part of SQL leading to the compilation error.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Command : sudo -u hive beeline -u "jdbc:hive2://cdp1:2181,cdp2:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;;principal=hive/_HOST@hdpcluster.test" -n hive --showHeader=false --outputformat=tsv2 -e "SET hive.support.quoted.identifiers=column;use jayesh; create external table testkeyword1( `transform` string);";&lt;BR /&gt;error : Error: Error while compiling statement: FAILED: ParseException line 1:45 cannot recognize input near ')' '&amp;lt;EOF&amp;gt;' '&amp;lt;EOF&amp;gt;' in column type (state=42000,code=40000)&lt;/P&gt;&lt;P&gt;&amp;nbsp;Command : sudo -u hive beeline -u "jdbc:hive2://cdp1:2181,cdp2:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;;principal=hive/_HOST@hdpcluster.test" -n hive --showHeader=false --outputformat=tsv2 -e "set hive.support.sql11.reserved.keywords=false; set hive.support.quoted.identifiers=column;use jayesh; create external table testunderscore( `_name` string, `_id` string)";&lt;/P&gt;&lt;P&gt;error :&lt;/P&gt;&lt;P&gt;-bash: _name: command not found&lt;BR /&gt;-bash: _id: command not found&lt;/P&gt;&lt;P&gt;Error: Error while compiling statement: FAILED: ParseException line 1:45 cannot recognize input near ',' 'string' ')' in column type (state=42000,code=40000)&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Case 2:&lt;/STRONG&gt;&lt;/U&gt; This one fails because you are using &lt;A href="https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl#LanguageManualDDL-Keywords,Non-reservedKeywordsandReservedKeywords" target="_self"&gt;reserved keyword&lt;/A&gt; &lt;STRONG&gt;transform&amp;nbsp;&lt;/STRONG&gt;which is not escaped properly.&lt;/P&gt;&lt;BLOCKQUOTE&gt;Command : sudo -u hive beeline -u "jdbc:hive2://cdp1:2181,cdp2:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;;principal=hive/_HOST@hdpcluster.test" -n hive --showHeader=false --outputformat=tsv2 -e "set hive.support.sql11.reserved.keywords=false; set hive.support.quoted.identifiers=column;use jayesh; create external table testkeyword3( transform string)";&lt;BR /&gt;error : Error: Error while compiling statement: FAILED: ParseException line 1:38 cannot recognize input near 'transform' 'string' ')' in column name or constraint (state=42000,code=40000)&lt;BR /&gt;&lt;BR /&gt;Command : sudo -u hive beeline -u "jdbc:hive2://cdp1.:2181,cdp2:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;;principal=hive/_HOST@hdpcluster.test" -n hive --showHeader=false --outputformat=tsv2 -e "SET hive.support.sql11.reserved.keywords=false;use jayesh; create external table testkeyowrd2( transform string)";&lt;BR /&gt;error : Error while compiling statement: FAILED: ParseException line 1:38 cannot recognize input near 'transform' 'string' ')' in column name or constraint (state=42000,code=40000)&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Solution&lt;/STRONG&gt;&lt;/U&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;You can escape backticks while passing SQL from command line&lt;BR /&gt;eg:-&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sudo -u hive beeline -u "jdbc:hive2://cdp1:2181,cdp2:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;;principal=hive/_HOST@hdpcluster.test" -n hive --showHeader=false --outputformat=tsv2 -e "SET use jayesh; create external table testkeyword1( \`transform\` string);";​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;You can also pass the SQL to beeline command as a file.&lt;BR /&gt;eg;- transform.sql&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;create external table testkeyword1( `transform` string);​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Beeline command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sudo -u hive beeline -u "jdbc:hive2://cdp1:2181,cdp2:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;;principal=hive/_HOST@hdpcluster.test" -n hive --showHeader=false --outputformat=tsv2 -f transform.sql​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if this helps fixing the issue.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 18:55:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/not-able-to-use-in-column-name-or-cannot-use-reserved/m-p/377011#M243094</guid>
      <dc:creator>cravani</dc:creator>
      <dc:date>2023-09-28T18:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: not able to use '_' in column name or cannot use reserved keywords in column name</title>
      <link>https://community.cloudera.com/t5/Support-Questions/not-able-to-use-in-column-name-or-cannot-use-reserved/m-p/377182#M243171</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/38161"&gt;@cravani&lt;/a&gt;&amp;nbsp;Thanks for the help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 15:39:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/not-able-to-use-in-column-name-or-cannot-use-reserved/m-p/377182#M243171</guid>
      <dc:creator>jayes</dc:creator>
      <dc:date>2023-10-03T15:39:04Z</dc:date>
    </item>
  </channel>
</rss>

