sqoop free-form query "Duplicate Column identifier" error on JOIN when a
table has only one column and both tables have the same name for column
--------------------------------------------------------------------------------------------------------------------------------------------------
Key: SQOOP-407
URL: https://issues.apache.org/jira/browse/SQOOP-407
Project: Sqoop
Issue Type: Bug
Components: connectors/mysql
Affects Versions: 1.4.1-incubating
Environment: Ubuntu 10.04 ; mysql Server version:
5.1.41-3ubuntu12.10 (Ubuntu)
Reporter: Eric Hernandez
Priority: Minor
If you try to join two tables that only have one column and both columns have
the same name you get an error.
Example
| actor | CREATE TABLE `actor` (
`actor_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`actor_id`)
) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8 |
CREATE TABLE `actor_test` (
`actor_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`actor_id`)
) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8
./sqoop import --connect jdbc:mysql://localhost/sakila -m1 --username sqoop
--password sqoop --query 'SELECT a.*,b.* FROM actor a JOIN actor_test b ON
a.actor_id=b.actor_id WHERE $CONDITIONS' --target-dir /user/eric/bugreport/
Warning: /usr/lib/hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
11/12/09 13:54:50 WARN tool.BaseSqoopTool: Setting your password on the
command-line is insecure. Consider using -P instead.
11/12/09 13:54:50 INFO manager.MySQLManager: Preparing to use a MySQL streaming
resultset.
11/12/09 13:54:50 INFO tool.CodeGenTool: Beginning code generation
11/12/09 13:54:50 INFO manager.SqlManager: Executing SQL statement: SELECT
a.*,b.* FROM actor a JOIN actor_test b ON a.actor_id=b.actor_id WHERE (1 = 0)
11/12/09 13:54:50 INFO manager.SqlManager: Executing SQL statement: SELECT
a.*,b.* FROM actor a JOIN actor_test b ON a.actor_id=b.actor_id WHERE (1 = 0)
11/12/09 13:54:50 ERROR tool.ImportTool: Imported Failed: Duplicate Column
identifier specified: 'actor_id'
This schema is a modified version of the sakila database from
http://dev.mysql.com/doc/index-other.html
To recreate, load sakila database.
USE sakila;
CREATE TABLE actor_test LIKE actor;
INSERT INTO actor_test SELECT * FROM actor;
ALTER TABLE actor DROP first_name; ALTER TABLE actor DROP last_name; ALTER
TABLE actor DROP last_update;
ALTER TABLE actor_test DROP first_name; ALTER TABLE actor_test DROP last_name;
ALTER TABLE actor_test DROP last_update;
--
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