private void insertCDInBatch(List<Long> ids, Map<Long, List<FieldSchema>> idToCols)
      throws MetaException {
    String insertCds = TxnUtils.createInsertPreparedStmt("\"CDS\"", Arrays.asList("\"CD_ID\""));
    int maxRows = dbType.getMaxRows(maxBatchSize, 1);
    updateWithStatement(statement -> Batchable.runBatched(maxRows, ids,
        new Batchable<Long, Void>() {
          @Override
          public List<Void> run(List<Long> input) throws SQLException {
            for (Long id : input) {
              statement.setLong(1, id);
              statement.addBatch();
            }
            statement.executeBatch();
            return null;
          }
    }), insertCds);

    List<String> columns = Arrays.asList("\"CD_ID\"",
        "\"COMMENT\"", "\"COLUMN_NAME\"", "\"TYPE_NAME\"", "\"INTEGER_IDX\"");
    String insertColumns = TxnUtils.createInsertPreparedStmt("\"COLUMNS_V2\"", columns);
    int maxRowsForCDs = dbType.getMaxRows(maxBatchSize, 5);
    updateWithStatement(statement -> Batchable.runBatched(maxRowsForCDs, ids,
        new Batchable<Long, Void>() {
          @Override
          public List<Void> run(List<Long> input) throws Exception {
            for (Long id : input) {
              List<FieldSchema> cols = idToCols.get(id);
              for (int i = 0; i < cols.size(); i++) {
                FieldSchema col = cols.get(i);
                statement.setLong(1, id);
                statement.setString(2, col.getComment());
                statement.setString(3, col.getName());
                statement.setString(4, col.getType());
                statement.setInt(5, i);
                statement.addBatch();
              }
            }
            statement.executeBatch();
            return null;
          }
    }), insertColumns);
  }
Gets the next CS id from sequence MPartitionColumnStatistics and increment the CS id by numStats.
@return The CD id before update.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DirectSqlUpdatePart.java