Uploaded image for project: 'Sqoop (READ-ONLY)'
  1. Sqoop (READ-ONLY)
  2. SQOOP-176

The code generator does not respect column alias when free-from query importing

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: codegen
    • Labels:
    • Environment:
      64bit Ubuntu 10.10 Linux, Java build 1.6.0_24-b07, mysql 5.1.49-1ubuntu8.1

      Description

      There are two tables foo, bar in mysql with the same schema:
      -------------------------------------+

      Field Type Null Key Default Extra

      -------------------------------------+

      id int(11) NO PRI NULL  
      msg varchar(32) YES   NULL  
      bar int(11) YES   NULL  

      -------------------------------------+

      When issuing command like this:
      sqoop import --connect jdbc:mysql://localhost/sqoop_test --username root --password xxx --query 'select foo.id as foo_id, bar.id as bar_id from foo,bar WHERE $CONDITIONS' --target-dir foo -split-by foo.id,
      it produces the following lines:
      11/04/02 10:30:35 INFO tool.CodeGenTool: Beginning code generation
      11/04/02 10:30:36 INFO manager.MySQLManager: Executing SQL statement: select foo.id as "foo_id", bar.id as "bar_id" from foo,bar WHERE (1 = 0)
      11/04/02 10:30:36 INFO manager.MySQLManager: Executing SQL statement: select foo.id as "foo_id", bar.id as "bar_id" from foo,bar WHERE (1 = 0)
      11/04/02 10:30:36 INFO orm.CompilationManager: HADOOP_HOME is /home/angus/src/hadoop
      /tmp/sqoop-angus/compile/f564879790875928ab1158130214a481/QueryResult.java:41: id is already defined in QueryResult
      private Integer id;
      ^
      /tmp/sqoop-angus/compile/f564879790875928ab1158130214a481/QueryResult.java:42: get_id() is already defined in QueryResult
      public Integer get_id() {

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              angushe Angus He
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: