private void updateSDInBatch(List<Long> ids, Map<Long, StorageDescriptor> idToSd,
                               Map<Long, Long> idToCdId) throws MetaException {
    List<String> columns = Arrays.asList("\"CD_ID\"", "\"INPUT_FORMAT\"", "\"IS_COMPRESSED\"",
        "\"IS_STOREDASSUBDIRECTORIES\"", "\"LOCATION\"", "\"NUM_BUCKETS\"", "\"OUTPUT_FORMAT\"");
    List<String> conditionKeys = Arrays.asList("\"SD_ID\"");
    String stmt = TxnUtils.createUpdatePreparedStmt("\"SDS\"", columns, conditionKeys);
    int maxRows = dbType.getMaxRows(maxBatchSize, 8);
    updateWithStatement(statement -> Batchable.runBatched(maxRows, ids,
        new Batchable<Long, Void>() {
          @Override
          public List<Void> run(List<Long> input) throws SQLException {
            for (Long sdId : input) {
              StorageDescriptor sd = idToSd.get(sdId);
              statement.setLong(1, idToCdId.get(sdId));
              statement.setString(2, sd.getInputFormat());
              statement.setObject(3, dbType.getBoolean(sd.isCompressed()));
              statement.setObject(4, dbType.getBoolean(sd.isStoredAsSubDirectories()));
              statement.setString(5, sd.getLocation());
              statement.setInt(6, sd.getNumBuckets());
              statement.setString(7, sd.getOutputFormat());
              statement.setLong(8, sdId);
              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