private void insertInBatch(String tableName, String columns, int columnCount, int rowCount,
      BatchExecutionContext batchExecutionContext) throws MetaException {
    if (rowCount == 0 || columnCount == 0) {
      return;
    }
    int maxRowsInBatch = batchSize > 0 ? batchSize : rowCount;
    maxRowsInBatch = dbType.getMaxRows(maxRowsInBatch, columnCount);
    int maxBatches = rowCount / maxRowsInBatch;
    int last = rowCount % maxRowsInBatch;
    String rowFormat = "(" + repeat(",?", columnCount).substring(1) + ")";
    String query = "";
    if (maxBatches > 0) {
      query = dbType.getBatchInsertQuery(tableName, columns, rowFormat, maxRowsInBatch);
    }
    for (int batch = 0; batch < maxBatches; batch++) {
      batchExecutionContext.execute(query, maxRowsInBatch);
    }
    if (last != 0) {
      query = dbType.getBatchInsertQuery(tableName, columns, rowFormat, last);
      batchExecutionContext.execute(query, last);
    }
  }
Interface to execute multiple row insert query in batch for direct SQL
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DirectSqlInsertPart.java