<?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: Cannot create a constant column in HCatalog in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cannot-create-a-constant-column-in-HCatalog/m-p/99460#M12669</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/228/wgonzalez.html" nodeid="228"&gt;@William Gonzalez&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Maybe a cast can be a workaround, like this:&lt;/P&gt;&lt;PRE&gt;--query "select col1 as col1, col2 as col2, cast('' as varchar(10)) as col3, col4 as col4 from input_table" \
&lt;/PRE&gt;</description>
    <pubDate>Thu, 17 Dec 2015 22:42:56 GMT</pubDate>
    <dc:creator>gbraccialli3</dc:creator>
    <dc:date>2015-12-17T22:42:56Z</dc:date>
    <item>
      <title>Cannot create a constant column in HCatalog</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cannot-create-a-constant-column-in-HCatalog/m-p/99458#M12667</link>
      <description>&lt;P&gt;HCatalog does not seem to allow Constants as columns. &lt;/P&gt;&lt;P&gt;Via Sqoop import: &lt;/P&gt;&lt;PRE&gt;sqoop import \
--query "select col1 as col1, col2 as col2, '' as col3, col4 as col4 from input_table" \
--connect jdbc:db2://server.com:60000/DB1 \
--username ******* \
--password ******* \
--hcatalog-database my_db \
--hcatalog-table output_table \
--create-hcatalog-table \
--hcatalog-storage-stanza 'stored as orc tblproperties ("orc.compress"="SNAPPY")' \
--verbose \
--fetch-size 20000 \
&lt;/PRE&gt;&lt;P&gt;Log: &lt;/P&gt;&lt;PRE&gt;15/12/14 03:28:57 INFO hcat.SqoopHCatUtilities: Creating HCatalog table my_db.output_table for import
15/12/14 03:28:57 INFO hcat.SqoopHCatUtilities: HCatalog Create table statement: 

create table `my_db`.`output_table` (
`col1` varchar(387),
`col2` varchar(17),
`col3` varchar, 
`col4` varchar(17))
stored as orc tblproperties ("orc.compress"="SNAPPY")
...
15/12/14 03:29:04 INFO hcat.SqoopHCatUtilities: FAILED: ParseException line 4:14 mismatched input ',' expecting ( near 'varchar' in primitive type specification
15/12/14 03:29:05 DEBUG util.ClassLoaderStack: Restoring classloader: sun.misc.Launcher$AppClassLoader@4aa0560e
15/12/14 03:29:05 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: HCat exited with status 64 &lt;/PRE&gt;&lt;P&gt;Is this supported? &lt;/P&gt;&lt;P&gt;Looks like: &lt;/P&gt;&lt;P&gt;&lt;A href="https://issues.apache.org/jira/browse/SQOOP-2596"&gt;https://issues.apache.org/jira/browse/SQOOP-2596&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2015 07:05:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cannot-create-a-constant-column-in-HCatalog/m-p/99458#M12667</guid>
      <dc:creator>wgonzalez</dc:creator>
      <dc:date>2015-12-16T07:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot create a constant column in HCatalog</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cannot-create-a-constant-column-in-HCatalog/m-p/99459#M12668</link>
      <description>&lt;P&gt;Sqoop is looking for the column precision for `col3`, and because there isn't a parenthesis and precision following 'varchar',  it's throwing the error. The Jira you highlighted shows the same problem. Good news, they've written the patch for this and it should be coming in the next version of Sqoop.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2015 11:34:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cannot-create-a-constant-column-in-HCatalog/m-p/99459#M12668</guid>
      <dc:creator>henrysowell</dc:creator>
      <dc:date>2015-12-16T11:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot create a constant column in HCatalog</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cannot-create-a-constant-column-in-HCatalog/m-p/99460#M12669</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/228/wgonzalez.html" nodeid="228"&gt;@William Gonzalez&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Maybe a cast can be a workaround, like this:&lt;/P&gt;&lt;PRE&gt;--query "select col1 as col1, col2 as col2, cast('' as varchar(10)) as col3, col4 as col4 from input_table" \
&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Dec 2015 22:42:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Cannot-create-a-constant-column-in-HCatalog/m-p/99460#M12669</guid>
      <dc:creator>gbraccialli3</dc:creator>
      <dc:date>2015-12-17T22:42:56Z</dc:date>
    </item>
  </channel>
</rss>

