private void insertSkewedLocationInBatch(Map<Long, String> stringListIdToLocation, Map<Long, Long> stringListIdToSdId)
      throws MetaException {
    int rowCount = stringListIdToLocation.size();
    String columns = "(\"SD_ID\",\"STRING_LIST_ID_KID\",\"LOCATION\")";
    int columnCount = 3;
    BatchExecutionContext batchExecutionContext = new BatchExecutionContext() {
      final Iterator<Map.Entry<Long, String>> it = stringListIdToLocation.entrySet().iterator();
      @Override
      public void execute(String batchQueryText, int batchRowCount) throws MetaException {
        Object[] params = new Object[batchRowCount * columnCount];
        int paramIndex = 0;
        for (int index = 0; index < batchRowCount; index++) {
          Map.Entry<Long, String> entry = it.next();
          params[paramIndex++] = stringListIdToSdId.get(entry.getKey());
          params[paramIndex++] = entry.getKey();
          params[paramIndex++] = entry.getValue();
        }
        executeQuery(batchQueryText, params);
      }
    };
    insertInBatch("\"SKEWED_COL_VALUE_LOC_MAP\"", columns, columnCount, rowCount, batchExecutionContext);
  }
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