Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-3597

Enable piggybank DBStorage to store to JDBC databases without Batch Statement support

    XMLWordPrintableJSON

Details

    Description

      There are no option to turning batching off with this storage.

      Some JDBC driver doesn't provide Batch Statement implementation.

      org.apache.pig.piggybank.storage.DBStorage.java:157
            this.ps.addBatch();
            this.count += 1;
            if (this.count > this.batchSize) {
              this.count = 0;
              this.ps.executeBatch();
              this.ps.clearBatch();
              this.ps.clearParameters();
            }
      

      An easy fix is to use DatabaseMetaData.supportsBatchUpdates() in JDBC.

      And to use only ps.execute() if the JDBC driver doesn't support Batch Statement.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              damien.carol Damien Carol
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: