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.