查询:
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;
错误:
导入失败:指定了重复列标识符(sqoop)
答案 0 :(得分:3)
当您选择查询中的所有列并且两个表都具有相同的列DEPTNO
时,这是预期的行为。
使用别名单独选择所有列。
以类似的方式修改您的查询:
--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'