private void updateBucketColsInBatch(Map<Long, List<String>> sdIdToBucketCols,
                                       List<Long> sdIds) throws MetaException {
    Batchable.runBatched(maxBatchSize, sdIds, new Batchable<Long, Void>() {
      @Override
      public List<Void> run(List<Long> input) throws MetaException {
        String idLists = MetaStoreDirectSql.getIdListForIn(input);
        String queryText = "delete from \"BUCKETING_COLS\" where \"SD_ID\" in (" + idLists + ")";
        updateWithStatement(PreparedStatement::executeUpdate, queryText);
        return null;
      }
    });
    List<String> columns = Arrays.asList("\"SD_ID\"", "\"INTEGER_IDX\"", "\"BUCKET_COL_NAME\"");
    String stmt = TxnUtils.createInsertPreparedStmt("\"BUCKETING_COLS\"", columns);
    List<Long> idWithBucketCols = filterIdsByNonNullValue(sdIds, sdIdToBucketCols);
    int maxRows = dbType.getMaxRows(maxBatchSize, 3);
    updateWithStatement(statement -> Batchable.runBatched(maxRows, idWithBucketCols, new Batchable<Long, Object>() {
      @Override
      public List<Object> run(List<Long> input) throws SQLException {
        for (Long id : input) {
          List<String> bucketCols = sdIdToBucketCols.get(id);
          for (int i = 0; i < bucketCols.size(); i++) {
            statement.setLong(1, id);
            statement.setInt(2, i);
            statement.setString(3, bucketCols.get(i));
            statement.addBatch();
          }
        }
        statement.executeBatch();
        return null;
      }
    }), stmt);
  }
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