<?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: max() function generating an error in sqoop in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/max-function-generating-an-error-in-sqoop/m-p/297966#M218912</link>
    <description>&lt;P&gt;Thank you Eric,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;We basically want to grab the last value of an id, so we can use it as a reference to resume an incremental load into Hive.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once we have the last "id" value in Hive, we can go back to our SQL Server and select all the rows which are greater than that id to pull the new/remaining data into Hive.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We were initially using&amp;nbsp;--incremental lastmodified to do incremental loads, but there are some source tables that don't have a datetime column and &lt;STRONG&gt;sqoop prevents us to do an incremental load if we don't have a datetime column in the source&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Append mode for imports is not compatible with HCatalog. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jun 2020 15:06:14 GMT</pubDate>
    <dc:creator>Heri</dc:creator>
    <dc:date>2020-06-12T15:06:14Z</dc:date>
    <item>
      <title>max() function generating an error in sqoop</title>
      <link>https://community.cloudera.com/t5/Support-Questions/max-function-generating-an-error-in-sqoop/m-p/297814#M218852</link>
      <description>&lt;P&gt;sqoop import \&lt;BR /&gt;-Dhadoop.security.credential.provider.path=jceks://hdfs/user/lrm0613/mydb2.jceks \&lt;BR /&gt;--connection-manager org.apache.sqoop.manager.SQLServerManager \&lt;BR /&gt;--driver net.sourceforge.jtds.jdbc.Driver \&lt;BR /&gt;--connect 'jdbc:jtds:sqlserver://SQLQP002:1433;useNTLMv2=true;domain=JNL_NT;databaseName=TC31Scheduler' \&lt;BR /&gt;--username 'lrm0613' \&lt;BR /&gt;--password-alias sqlserver2.password \&lt;BR /&gt;--query 'select &lt;STRONG&gt;max(id)&lt;/STRONG&gt; from NodeName a where $CONDITIONS' \&lt;BR /&gt;--split-by a.id \&lt;BR /&gt;--target-dir /user/lrm0613/queries_output/tt&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generates the following error:&lt;/P&gt;
&lt;P&gt;20/06/10 16:37:51 ERROR tool.ImportTool: Import failed: We found column without column name. Please verify that you've entered all column names in your query if using free form query import (consider adding clause AS if you're using column transformation)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've noticed that if I remove the &lt;STRONG&gt;max&lt;/STRONG&gt;() function the job completes successfully. How can I make it work with the function.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 21:57:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/max-function-generating-an-error-in-sqoop/m-p/297814#M218852</guid>
      <dc:creator>Heri</dc:creator>
      <dc:date>2020-06-10T21:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: max() function generating an error in sqoop</title>
      <link>https://community.cloudera.com/t5/Support-Questions/max-function-generating-an-error-in-sqoop/m-p/297815#M218853</link>
      <description>&lt;P&gt;Hi Heri,&lt;BR /&gt;&lt;BR /&gt;As mentioned in the error:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if using free form query import (consider adding clause AS if you're using column transformation)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;You max(id) aggregate function does not have "AS" clause, please change your query to below and try again:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;select max(id) as max_id from NodeName a where $CONDITIONS&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;Eric&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 22:14:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/max-function-generating-an-error-in-sqoop/m-p/297815#M218853</guid>
      <dc:creator>EricL</dc:creator>
      <dc:date>2020-06-10T22:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: max() function generating an error in sqoop</title>
      <link>https://community.cloudera.com/t5/Support-Questions/max-function-generating-an-error-in-sqoop/m-p/297844#M218870</link>
      <description>&lt;P&gt;Thank you Eric,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I changed the form of the query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;--query 'select max(id) as maxid from NodeName where $CONDITIONS'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we had some progress, but for some reason sqoop is translating the query into the following form:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;20/06/11 08:09:49 INFO db.DataDrivenDBInputFormat: BoundingValsQuery: &lt;STRONG&gt;SELECT MIN(id), MAX(id) FROM (select max(id) as maxid from NodeName where (1 = 1) ) AS t1&lt;/STRONG&gt;&lt;BR /&gt;20/06/11 08:09:49 INFO mapreduce.JobSubmitter: Cleaning up the staging area /user/lrm0613/.staging/job_1590805442005_23634&lt;BR /&gt;20/06/11 08:09:49 WARN security.UserGroupInformation: PriviledgedActionException as:lrm0613@JACKSONNATIONAL.COM (auth:KERBEROS) cause:java.io.IOException: net.sourceforge.jtds.jdbc.AQSQLException: Id 207, Level 16, State 1, Line 1&lt;BR /&gt;Invalid column name 'id'.&lt;BR /&gt;20/06/11 08:09:49 ERROR tool.ImportTool: Import failed: java.io.IOException: net.sourceforge.jtds.jdbc.AQSQLException: Id 207, Level 16, State 1, Line 1&lt;BR /&gt;Invalid column name 'id'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 12:12:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/max-function-generating-an-error-in-sqoop/m-p/297844#M218870</guid>
      <dc:creator>Heri</dc:creator>
      <dc:date>2020-06-11T12:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: max() function generating an error in sqoop</title>
      <link>https://community.cloudera.com/t5/Support-Questions/max-function-generating-an-error-in-sqoop/m-p/297919#M218888</link>
      <description>&lt;P&gt;Sorry, can you try below instead?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;select max(id) as id from NodeName a where $CONDITIONS&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;BTW, do you really just want to import single MAX value into HDFS?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 21:46:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/max-function-generating-an-error-in-sqoop/m-p/297919#M218888</guid>
      <dc:creator>EricL</dc:creator>
      <dc:date>2020-06-11T21:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: max() function generating an error in sqoop</title>
      <link>https://community.cloudera.com/t5/Support-Questions/max-function-generating-an-error-in-sqoop/m-p/297966#M218912</link>
      <description>&lt;P&gt;Thank you Eric,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;We basically want to grab the last value of an id, so we can use it as a reference to resume an incremental load into Hive.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once we have the last "id" value in Hive, we can go back to our SQL Server and select all the rows which are greater than that id to pull the new/remaining data into Hive.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We were initially using&amp;nbsp;--incremental lastmodified to do incremental loads, but there are some source tables that don't have a datetime column and &lt;STRONG&gt;sqoop prevents us to do an incremental load if we don't have a datetime column in the source&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Append mode for imports is not compatible with HCatalog. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 15:06:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/max-function-generating-an-error-in-sqoop/m-p/297966#M218912</guid>
      <dc:creator>Heri</dc:creator>
      <dc:date>2020-06-12T15:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: max() function generating an error in sqoop</title>
      <link>https://community.cloudera.com/t5/Support-Questions/max-function-generating-an-error-in-sqoop/m-p/297986#M218923</link>
      <description>Hi Heri,&lt;BR /&gt;&lt;BR /&gt;Glad that it helped and thanks for the info.&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;Eric</description>
      <pubDate>Sat, 13 Jun 2020 00:27:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/max-function-generating-an-error-in-sqoop/m-p/297986#M218923</guid>
      <dc:creator>EricL</dc:creator>
      <dc:date>2020-06-13T00:27:19Z</dc:date>
    </item>
  </channel>
</rss>

