sqoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arvind Prabhakar <arv...@apache.org>
Subject Re: Free-form Query Imports Documentation JOIN ON
Date Fri, 09 Dec 2011 21:59:36 GMT
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 <eric.hardway@gmail.com> 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.
>

Mime
View raw message