You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sqoop.apache.org by "jiraposter@reviews.apache.org (Commented) (JIRA)" <ji...@apache.org> on 2012/04/07 02:31:19 UTC

[jira] [Commented] (SQOOP-476) If table name is a qualified name, Sqoop import fails in DB2

    [ https://issues.apache.org/jira/browse/SQOOP-476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13249094#comment-13249094 ] 

jiraposter@reviews.apache.org commented on SQOOP-476:
-----------------------------------------------------


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/4674/
-----------------------------------------------------------

Review request for Sqoop.


Summary
-------

During the import job, Sqoop uses the following select query:

SELECT <column names> FROM <table name> AS <table name>

This causes a SQL syntax error for DB2 if table name has a dot "." in it.


The changes include:

1) Create DB2-specific DBInputFormat/DBRecordReader + DataDrivenDBInputFormat. Note that DataDrivenDBRecordReader is not subclassed since DB2-specific logic is implemented directly in its getSelectQuery() method.

2) Add a unit test that imports data from a table that has a qualified name.


This addresses bug SQOOP-476.
    https://issues.apache.org/jira/browse/SQOOP-476


Diffs
-----

  /src/java/org/apache/sqoop/mapreduce/db/DBInputFormat.java 1310644 
  /src/java/org/apache/sqoop/mapreduce/db/DataDrivenDBRecordReader.java 1310644 
  /src/java/org/apache/sqoop/mapreduce/db/Db2DBRecordReader.java PRE-CREATION 
  /src/java/org/apache/sqoop/mapreduce/db/Db2DataDrivenDBInputFormat.java PRE-CREATION 
  /src/java/org/apache/sqoop/mapreduce/db/Db2DataDrivenDBRecordReader.java PRE-CREATION 
  /src/test/com/cloudera/sqoop/manager/DB2ManagerImportManualTest.java 1310644 
  /src/java/org/apache/sqoop/manager/Db2Manager.java 1310644 

Diff: https://reviews.apache.org/r/4674/diff


Testing
-------


Thanks,

Cheolsoo


                
> If table name is a qualified name, Sqoop import fails in DB2
> ------------------------------------------------------------
>
>                 Key: SQOOP-476
>                 URL: https://issues.apache.org/jira/browse/SQOOP-476
>             Project: Sqoop
>          Issue Type: Bug
>            Reporter: Cheolsoo Park
>            Assignee: Cheolsoo Park
>
> In DB2, it is OK to have a dot "." in table name, but it is not in alias. For example, the following query fails:
> {code}
> SELECT * FROM foo.bar AS foo.bar
> SQL0104N  An unexpected token "." was found following "from foo.bar as foo".  
> Expected tokens may include:  ",".  SQLSTATE=42601
> {code}
> During the import job, Sqoop uses the following select query:
> {code}
> SELECT <column names> FROM <table name> AS <table name>
> {code}
> As can be seen, it can be a problem for DB2 if table name has a dot "." in it.

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