Imported Failed: Duplicate Column identifier specified (sqoop)

一曲冷凌霜 提交于 2020-01-02 15:02:34

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!