问题
Query:
sqoop import --connect jdbc:mysql://localhost/userdb --username abc --password abc --query 'SELECT e.*,d.* FROM employee e JOIN department d on e.DEPTNO = d.DEPTNO WHERE $CONDITIONS ' --split-by e.DEPTNO --target-dir /output/result;
Error:
Imported Failed: Duplicate Column identifier specified (sqoop)
回答1:
It is expected behaviour as you are selecting all the columns in your query and both the tables has same column DEPTNO
.
select all the columns individually with alias name.
Modify your query in the similar way:
--query 'SELECT e.col1 as ecol1, e.col2 as ecol2, e.col3 as ecol3, d.col1 as dcol1, d.col2 as dcol2, c.col3 as dcol3 FROM employee e JOIN department d on e.DEPTNO = d.DEPTNO WHERE $CONDITIONS'
来源:https://stackoverflow.com/questions/39143222/imported-failed-duplicate-column-identifier-specified-sqoop