<?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: Creating hive table with columns from a text file in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-hive-table-with-columns-from-a-text-file/m-p/183912#M61641</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/16364/prabhatratnala.html" nodeid="16364"&gt;@Prabhat Ratnala&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ideally it should work. But what's the error message? I think the value substituted in the parameter are not properly assigned.  try running the script using set -x so that it will be easy to debug. Even after running it if throw an error then paste the error message. It would be helpful to solve your issue.&lt;/P&gt;</description>
    <pubDate>Wed, 24 May 2017 00:39:49 GMT</pubDate>
    <dc:creator>balavignesh_nag</dc:creator>
    <dc:date>2017-05-24T00:39:49Z</dc:date>
    <item>
      <title>Creating hive table with columns from a text file</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-hive-table-with-columns-from-a-text-file/m-p/183911#M61640</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to create a table in Hive from a txt file using a shell script in this format.&lt;/P&gt;&lt;P&gt;My t_cols.txt has data as below:&lt;/P&gt;&lt;PRE&gt;id string, name string, city string, lpd timestamp&lt;/PRE&gt;&lt;P&gt;I want to create hive table whose columns should be coming from this text file.&lt;/P&gt;&lt;P&gt;This is how my hive query looks like:&lt;/P&gt;&lt;PRE&gt;table_cols=`cat t_cols.txt`
hive --hiveconf t_name=${table_cols} -e 'create table leap_frog_snapshot.LINKED_OBJ_TRACKING (\${hiveconf:t_name}) stored as orc tblproperties ("orc.compress"="SNAPPY") ; '&lt;/PRE&gt;&lt;P&gt;This is not working somehow.&lt;/P&gt;&lt;P&gt;Can someone explain how to achieve this?&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 00:30:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-hive-table-with-columns-from-a-text-file/m-p/183911#M61640</guid>
      <dc:creator>prabhat_ratnala</dc:creator>
      <dc:date>2017-05-24T00:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Creating hive table with columns from a text file</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-hive-table-with-columns-from-a-text-file/m-p/183912#M61641</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/16364/prabhatratnala.html" nodeid="16364"&gt;@Prabhat Ratnala&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ideally it should work. But what's the error message? I think the value substituted in the parameter are not properly assigned.  try running the script using set -x so that it will be easy to debug. Even after running it if throw an error then paste the error message. It would be helpful to solve your issue.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 00:39:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-hive-table-with-columns-from-a-text-file/m-p/183912#M61641</guid>
      <dc:creator>balavignesh_nag</dc:creator>
      <dc:date>2017-05-24T00:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating hive table with columns from a text file</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-hive-table-with-columns-from-a-text-file/m-p/183913#M61642</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/12437/balavigneshnagamuthuvenkatesan.html" nodeid="12437"&gt;@Bala Vignesh N V&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I am getting the below error:&lt;/P&gt;&lt;PRE&gt;Logging initialized using configuration in file:/etc/hive/2.4.3.0-227/0/hive-log4j.properties
NoViableAltException(307@[])
        at org.apache.hadoop.hive.ql.parse.HiveParser.type(HiveParser.java:38618)
        at org.apache.hadoop.hive.ql.parse.HiveParser.colType(HiveParser.java:38375)
        at org.apache.hadoop.hive.ql.parse.HiveParser.columnNameType(HiveParser.java:38059)
        at org.apache.hadoop.hive.ql.parse.HiveParser.columnNameTypeList(HiveParser.java:36183)
        at org.apache.hadoop.hive.ql.parse.HiveParser.createTableStatement(HiveParser.java:5222)
        at org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2648)
        at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1658)
        at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1117)
        at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:202)
        at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:432)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:316)
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1202)
        at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1250)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1139)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1129)
        at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:216)
        at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:168)
        at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:379)
        at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:314)
        at org.apache.hadoop.hive.cli.CliDriver.processReader(CliDriver.java:412)
        at org.apache.hadoop.hive.cli.CliDriver.processFile(CliDriver.java:428)
        at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:717)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:684)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:624)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
FAILED: ParseException line 1:60 cannot recognize input near ')' 'stored' 'as' in column type&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 May 2017 02:39:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-hive-table-with-columns-from-a-text-file/m-p/183913#M61642</guid>
      <dc:creator>prabhat_ratnala</dc:creator>
      <dc:date>2017-05-24T02:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating hive table with columns from a text file</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-hive-table-with-columns-from-a-text-file/m-p/183914#M61643</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/16364/prabhatratnala.html" nodeid="16364"&gt;@Prabhat Ratnala&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This worked for me. 2 changes were required- &lt;/P&gt;&lt;OL&gt;
&lt;LI&gt;table_cols="`cat t_cols.txt`"&lt;/LI&gt;&lt;LI&gt;Remove '\' before '\${hiveconf:t_name}'&lt;/LI&gt;&lt;/OL&gt;&lt;PRE&gt;hive --hiveconf t_name="`cat t_cols.txt`" -e 'create table leap_frog_snapshot.LINKED_OBJ_TRACKING (${hiveconf:t_name}) stored as orc tblproperties ("orc.compress"="SNAPPY") ; '
&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 May 2017 05:16:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-hive-table-with-columns-from-a-text-file/m-p/183914#M61643</guid>
      <dc:creator>ksuresh</dc:creator>
      <dc:date>2017-05-24T05:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating hive table with columns from a text file</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-hive-table-with-columns-from-a-text-file/m-p/183915#M61644</link>
      <description>&lt;P&gt;Perfect!!! Worked like a charm... Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 16:35:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Creating-hive-table-with-columns-from-a-text-file/m-p/183915#M61644</guid>
      <dc:creator>prabhat_ratnala</dc:creator>
      <dc:date>2017-05-24T16:35:34Z</dc:date>
    </item>
  </channel>
</rss>

