GitHub user leskin-in opened a pull request:

    HAWQ-1605. Support INSERT in PXF JDBC plugin

    Add support of INSERT queries in PXF JDBC plugin:
    * Implement interfaces `WriteAccessor` (by `JdbcAccessor` class) and 
`WriteResolver` (by `JdbcResolver` class);
    * Support query batching in `JdbcAccessor` when processing INSERT query. 
The size of a batch is defined by user and may be "infinite";
    * In `JdbcAccessor`, use `java.sql.PreparedStatement` and JDBC standard 
functions to process queries (and to support batching);
    * In `setFields()` method of `JdbcResolver`, perform type conversions of 
the data tuples received from PXF;
    * Support both transactional and non-transactional databases when 
performing INSERT queries.
    Refactor the code in PXF JDBC plugin, make some microoptimizations and 
    * Fix the handling of TIMESTAMP when performing SELECT requests;
    * Make functions for building WHERE statements static where possible to 
reduce the number of `InputData` checks. This is proposed by @hornn;
    * Prettify some SQL statements generated by the PXF JDBC plugin and change 
the tests respectively;
    * Organize imports;
    * Expand some intricate `if ... else` constructions.
    Improve documentation:
    * Clarify, expand or rewrite Javadoc strings;
    * Rewrite

You can merge this pull request into a Git repository by running:

    $ git pull pxf_jdbc_writeAndFix

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1353
commit ba47942574049afc72c93033e03c7a7f1cf25f13
Author: Ivan Leskin <>
Date:   2018-03-05T14:19:26Z

    Fix incorrect TIMESTAMP handling

commit 3eb0daa8b5aca8c6c85cd7e6ebec8ea4b57c2966
Author: Ivan Leskin <>
Date:   2018-03-07T17:24:01Z

    PXF JDBC plugin update
    * Add support for INSERT queries:
        * The INSERT queries are processed by the same classes as the SELECT 
        * INSERTs are processed by the JDBC PreparedStatement;
        * INSERTs support batching (by means of JDBC);
    * Minor changes in WhereSQLBuilder and JdbcPartitionFragmenter:
        * Removed 'WHERE 1=1';
        * The same pattern of spaces around operators everywhere ('a = b', not 
        * JdbcPartitionFragmenter.buildFragmenterSql() made static to avoid 
extra checks of InputData (proposed by @sansanichfb);
    * Refactoring and some microoptimizations;

commit 98f18c54cd3a9a63c8e9b5a13fb48f4494994051
Author: Ivan Leskin <>
Date:   2018-04-02T17:57:56Z

    PXF JDBC refactoring
    * The is completely rewritten;
    * Lots of changes in comments and javadoc comments;
    * Code refactoring and minor changes in codestyle



Reply via email to