You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sqoop.apache.org by "Jarek Jarcec Cecho (JIRA)" <ji...@apache.org> on 2016/01/15 18:59:39 UTC
[jira] [Commented] (SQOOP-2791) Errors in import when using query
with aliases as source
[ https://issues.apache.org/jira/browse/SQOOP-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15102194#comment-15102194 ]
Jarek Jarcec Cecho commented on SQOOP-2791:
-------------------------------------------
Would you mind sharing full stack trackes?
> Errors in import when using query with aliases as source
> --------------------------------------------------------
>
> Key: SQOOP-2791
> URL: https://issues.apache.org/jira/browse/SQOOP-2791
> Project: Sqoop
> Issue Type: Bug
> Components: codegen
> Reporter: Eugen Stoianovici
> Priority: Minor
>
> SQOOP always fails with a syntax error when specifying an alias on the split column of the source query.
> {code}
> $ sqoop import \
> --query 'SELECT t1.i as something, t2.j FROM t1, t2 WHERE $CONDITIONS AND t1.i = t2.i' \
> --target-dir /user/eugen/sqoop1 \
> --split-by t1.i \
> --connect jdbc:mysql://example.com/eugen \
> --username usr1 \
> --password-file /user/eugen/sqoop.password
> {code}
> Results in:
> {code}
> com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 't1.i' in 'field list'
> {code}
> The query failing in this case is:
> {code}
> SELECT MIN(t1.i), MAX(t1.i) FROM (SELECT t1.i as something, t2.j FROM t1, t2 WHERE (1 = 1) AND t1.i = t2.i) AS t1
> {code}
> This is the query for generating the splits. We can rewrite the scenario to make this particular query successful:
> {code}
> sqoop import \
> --query 'SELECT t1.i as something, t2.j FROM t1, t2 WHERE $CONDITIONS AND t1.i = t2.i' \
> --target-dir /user/eugen/sqoop1 \
> --split-by something \
> --connect jdbc:mysql://example.com/eugen \
> --username usr1 \
> --password-file /user/eugen/sqoop.password
> {code}
> This results in:
> {code}
> com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'something' in 'where clause'
> {code}
> The query failing in this case is:
> {code}
> SELECT t1.i as something, t2.j FROM t1, t2 WHERE ( something >= ? ) AND ( something < ? ) AND t1.i = t2.i
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)