private void updateWithStatement(ThrowableConsumer<PreparedStatement> consumer, String query)
      throws MetaException {
    JDOConnection jdoConn = pm.getDataStoreConnection();
    boolean doTrace = LOG.isDebugEnabled();
    long start = doTrace ? System.nanoTime() : 0;
    try (PreparedStatement statement =
             ((Connection) jdoConn.getNativeConnection()).prepareStatement(query)) {
      consumer.accept(statement);
      MetastoreDirectSqlUtils.timingTrace(doTrace, query, start, doTrace ? System.nanoTime() : 0);
    } catch (SQLException e) {
      LOG.error("Failed to execute update query: " + query, e);
      throw new MetaException("Unable to execute update due to: " + e.getMessage());
    } finally {
      closeDbConn(jdoConn);
    }
  }
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