Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Sqoop >> mail # user >> Free-form Query Imports Documentation JOIN ON


Copy link to this message
-
Re: Free-form Query Imports Documentation JOIN ON
Hi Eric,

Good catch - that seems to be a typo in the docs. Please file a JIRA
issue to track this.

Thanks,
Arvind

On Fri, Dec 9, 2011 at 8:06 AM, eric hernandez <[EMAIL PROTECTED]> wrote:
> HI all,
>
> This set of documentation does not work as advertised.
>
> http://archive.cloudera.com/cdh/3/sqoop/SqoopUserGuide.html#_free_form_query_imports
>
> If this query was meant to be run on MySQL, then MySQL breaks on the double
> "==" on the JOIN ON clause.
>
> Here is an example with two "=="
>
> sqoop import --connect jdbc:mysql://localhost/world -m1 --username sqoop
> --password sqoop --query 'SELECT a.Name,b.Language FROM City a JOIN
> CountryLanguage b ON a.CountryCode == b.CountryCode  WHERE $CONDITIONS'
> --target-dir /user/eric/worldjoin/
>
> 11/12/09 08:00:40 INFO manager.SqlManager: Executing SQL statement: SELECT
> a.Name,b.Language FROM City a JOIN CountryLanguage b ON a.CountryCode => b.CountryCode  WHERE  (1 = 0)
> 11/12/09 08:00:40 ERROR manager.SqlManager: Error executing statement:
> com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error
> in your SQL syntax; check the manual that corresponds to your MySQL server
> version for the right syntax to use near '== b.CountryCode  WHERE  (1 = 0)'
> at line 1
> com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error
> in your SQL syntax; check the manual that corresponds to your MySQL server
> version for the right syntax to use near '== b.CountryCode  WHERE  (1 = 0)'
> at line 1
>
> And it works if you just use one "="
>
> sqoop import --connect jdbc:mysql://localhost/world -m1 --username sqoop
> --password sqoop --query 'SELECT a.Name,b.Language FROM City a JOIN
> CountryLanguage b ON a.CountryCode = b.CountryCode  WHERE $CONDITIONS'
> --target-dir /user/eric/worldjoin/
>
> 11/12/09 08:01:36 INFO manager.SqlManager: Executing SQL statement: SELECT
> a.Name,b.Language FROM City a JOIN CountryLanguage b ON a.CountryCode > b.CountryCode  WHERE  (1 = 0)
> 11/12/09 08:01:47 INFO mapreduce.ImportJobBase: Retrieved 30670 records.
>
>
> --
> Eric H.
>
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB