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-387 : Use TRUNCATE for PostgreSQLManager patch


Copy link to this message
-
Re: Review Request: SQOOP-387 : Use TRUNCATE for PostgreSQLManager patch
Bilung Lee 2012-03-13, 23:53

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/4272/#review5803
-----------------------------------------------------------
Seem that the TRUNCATE statement may not return the number of affected rows like the DELETE statement does.  You may want to consider removing dependency on the return count as pointed out below.

An alternative option is to factor out more code to be overridden if the dependency is to be kept for other databases.

http://svn.apache.org/repos/asf/incubator/sqoop/trunk/src/java/org/apache/sqoop/manager/SqlManager.java
<https://reviews.apache.org/r/4272/#comment12649>

    The return code seems to be 0 for a successful TRUNCATE.

http://svn.apache.org/repos/asf/incubator/sqoop/trunk/src/java/org/apache/sqoop/manager/SqlManager.java
<https://reviews.apache.org/r/4272/#comment12650>

    The return count won't make sense for TRUNCATE here.

http://svn.apache.org/repos/asf/incubator/sqoop/trunk/src/java/org/apache/sqoop/manager/SqlManager.java
<https://reviews.apache.org/r/4272/#comment12653>

    The return count would be 0 for a successful TRUNCATE.

http://svn.apache.org/repos/asf/incubator/sqoop/trunk/src/java/org/apache/sqoop/manager/SqlManager.java
<https://reviews.apache.org/r/4272/#comment12655>

    Due to the reason mentioned above, this checking would fail for PostgreSQL now.
- Bilung
On 2012-03-09 17:31:41, Shinichi Yamashita wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/4272/
> -----------------------------------------------------------
>
> (Updated 2012-03-09 17:31:41)
>
>
> Review request for Sqoop and Bilung Lee.
>
>
> Summary
> -------
>
> I fixed SQOOP-387 patch.
>
> 1. I add getDeleteQuery method, which returns DELETE statement in SqlManager by default and returns TRUNCATE statement in PostgreSQLManager.
> 2. Modify deleteAllRecords method and migrateData method of SqlManager to use getDeleteQuery method.
>
>
> This addresses bug SQOOP-387.
>     https://issues.apache.org/jira/browse/SQOOP-387
>
>
> Diffs
> -----
>
>   http://svn.apache.org/repos/asf/incubator/sqoop/trunk/src/java/org/apache/sqoop/manager/PostgresqlManager.java 1298894
>   http://svn.apache.org/repos/asf/incubator/sqoop/trunk/src/java/org/apache/sqoop/manager/SqlManager.java 1298894
>
> Diff: https://reviews.apache.org/r/4272/diff
>
>
> Testing
> -------
>
> ant test
> I confirmed "TRUNCATE TABLE" query was executed in PostgreSQL.
>
>
> Thanks,
>
> Shinichi
>
>