Glyton Camilleri created SQOOP-520:
--------------------------------------

             Summary: Avro Import fails on due to collision between column 
names starting with numbers and prefixed underscore 
                 Key: SQOOP-520
                 URL: https://issues.apache.org/jira/browse/SQOOP-520
             Project: Sqoop
          Issue Type: Bug
          Components: codegen
    Affects Versions: 1.3.0
            Reporter: Glyton Camilleri


When performing an import as avro datafile, Sqoop fails with the following 
exception:

{code}
12/07/24 15:59:20 ERROR sqoop.Sqoop: Got exception running Sqoop: 
java.lang.IllegalArgumentException: Duplicate Column identifier specified: '_1D'
java.lang.IllegalArgumentException: Duplicate Column identifier specified: '_1D'
        at com.cloudera.sqoop.orm.ClassWriter.generate(ClassWriter.java:1072)
        at com.cloudera.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:84)
        at com.cloudera.sqoop.tool.ImportTool.importTable(ImportTool.java:370)
        at 
com.cloudera.sqoop.tool.ImportAllTablesTool.run(ImportAllTablesTool.java:66)
        at com.cloudera.sqoop.Sqoop.run(Sqoop.java:146)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
        at com.cloudera.sqoop.Sqoop.runSqoop(Sqoop.java:182)
        at com.cloudera.sqoop.Sqoop.runTool(Sqoop.java:221)
        at com.cloudera.sqoop.Sqoop.runTool(Sqoop.java:230)
        at com.cloudera.sqoop.Sqoop.main(Sqoop.java:239)
{code}

The problem seems to be when generating avro schemas and java classes - column 
and table names starting with illegal identifiers are prefixed with an 
underscore, so for a table such as the following, a duplicate column name is 
generated.

{code}
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| 1D    | int(11) | YES  |     | NULL    |       |
| _1D   | int(11) | YES  |     | NULL    |       |
+-------+---------+------+-----+---------+-------+
{code}

--
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

        

Reply via email to