code: public InputSplit[] getSplits(JobConf job, int chunks) throws IOException {
  
      try {
        Statement statement = connection.createStatement();
  
        ResultSet results = statement.executeQuery(getCountQuery());
        results.next();
  
        long count = results.getLong(1);
        long chunkSize = (count / chunks);
  
        results.close();
        statement.close();
  
        InputSplit[] splits = new InputSplit[chunks];
  
        // Split the rows into n-number of chunks and adjust the last chunk
        // accordingly
        for (int i = 0; i < chunks; i++) {
          DBInputSplit split;
  
          if ((i + 1) == chunks)
            split = new DBInputSplit(i * chunkSize, count);
          else
            split = new DBInputSplit(i * chunkSize, (i * chunkSize)
                + chunkSize);
  
          splits[i] = split;
        }
  
        return splits;
      } catch (SQLException e) {
        throw new IOException(e.getMessage());
      }
    }
docs: {@inheritDoc}