You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sqoop.apache.org by "Prashant Gokhale (Created) (JIRA)" <ji...@apache.org> on 2012/03/02 21:37:58 UTC

[jira] [Created] (SQOOP-452) Mysql free form queries fail if alias is not used.

Mysql free form queries fail if alias is not used.
--------------------------------------------------

                 Key: SQOOP-452
                 URL: https://issues.apache.org/jira/browse/SQOOP-452
             Project: Sqoop
          Issue Type: Bug
          Components: connectors/mysql
    Affects Versions: 1.4.0-incubating
            Reporter: Prashant Gokhale
            Priority: Minor



Command I am running:
sqoop import --connect jdbc:mysql://<mysqlhost>/mysqltestdb --username xxx --password xxxx --query 'select testtable.id, testtable2.fname from testtable join testtable2 on (testtable.id = testtable2.id ) where testtable.id < 3 AND $CONDITIONS' --split-by testtable.id --target-dir joinresults

Sqoop fails with this error message

{noformat}
2/03/02 12:12:08 INFO db.DataDrivenDBInputFormat: BoundingValsQuery: SELECT MIN(testtable.id), MAX(testtable.id) FROM (select testtable.id as id, testtable2.fname as fname from testtable join testtable2 on (testtable.id = testtable2.id ) where testtable.id < 3 AND  (1 = 1) ) AS t1
12/03/02 12:12:08 INFO mapreduce.JobSubmitter: Cleaning up the staging area /user/prashant/.staging/job_1330641624236_0016
12/03/02 12:12:09 ERROR security.UserGroupInformation: PriviledgedActionException as:prashant (auth:SIMPLE) cause:java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'testtable.id' in 'field list'
12/03/02 12:12:09 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'testtable.id' in 'field list'
{noformat}

The job runs successfully if I modify the query:

sqoop import --connect jdbc:mysql://<mysqlhost>/mysqltestdb --username xxxx --password xxxx --query 'select t1.id as id, t2.fname as fname from testtable as t1 join testtable2 as t2 on (t1.id = t2.id ) where t1.id < 3 AND $CONDITIONS' --split-by t1.id --target-dir joinresults


It would be nice to have it documented at least.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira