Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Sqoop >> mail # dev >> Review Request: SQOOP-476 If table name is a qualified name, Sqoop import fails in DB2


Copy link to this message
-
Re: Review Request: SQOOP-476 If table name is a qualified name, Sqoop import fails in DB2

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

(Updated 2012-05-27 19:15:12.870398)
Review request for Sqoop.
Changes
-------

Extended the test cases to verify that both GenericJdbcManager and Db2Manager work.
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 (updated)
-----

  /src/java/org/apache/sqoop/manager/Db2Manager.java 1343070
  /src/java/org/apache/sqoop/mapreduce/db/DBInputFormat.java 1343070
  /src/java/org/apache/sqoop/mapreduce/db/DataDrivenDBRecordReader.java 1343070
  /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 1343070

Diff: https://reviews.apache.org/r/4674/diff
Testing
-------
Thanks,

Cheolsoo