private void updatePartColStatTable(Map<PartColNameInfo, MPartitionColumnStatistics> updateMap,
                                          Connection dbConn) throws SQLException, MetaException, NoSuchObjectException {
    Map<String, List<Map.Entry<PartColNameInfo, MPartitionColumnStatistics>>> updates = new HashMap<>();
    for (Map.Entry<PartColNameInfo, MPartitionColumnStatistics> entry : updateMap.entrySet()) {
      MPartitionColumnStatistics mPartitionColumnStatistics = entry.getValue();
      StringBuilder update = new StringBuilder("UPDATE \"PART_COL_STATS\" SET ")
          .append(StatObjectConverter.getUpdatedColumnSql(mPartitionColumnStatistics))
          .append(" WHERE \"PART_ID\" = ? AND \"COLUMN_NAME\" = ? AND \"ENGINE\" = ?");
      updates.computeIfAbsent(update.toString(), k -> new ArrayList<>()).add(entry);
    }

    for (Map.Entry<String, List<Map.Entry<PartColNameInfo, MPartitionColumnStatistics>>> entry : updates.entrySet()) {
      List<Long> partIds = new ArrayList<>();
      try (PreparedStatement pst = dbConn.prepareStatement(entry.getKey())) {
        List<Map.Entry<PartColNameInfo, MPartitionColumnStatistics>> entries = entry.getValue();
        for (Map.Entry<PartColNameInfo, MPartitionColumnStatistics> partStats : entries) {
          PartColNameInfo partColNameInfo = partStats.getKey();
          MPartitionColumnStatistics mPartitionColumnStatistics = partStats.getValue();
          int colIdx = StatObjectConverter.initUpdatedColumnStatement(mPartitionColumnStatistics, pst);
          pst.setLong(colIdx++, partColNameInfo.partitionId);
          pst.setString(colIdx++, mPartitionColumnStatistics.getColName());
          pst.setString(colIdx++, mPartitionColumnStatistics.getEngine());
          partIds.add(partColNameInfo.partitionId);
          pst.addBatch();
          if (partIds.size() == maxBatchSize) {
            LOG.debug("Execute updates on part: {}", partIds);
            verifyUpdates(pst.executeBatch(), partIds);
            partIds = new ArrayList<>();
          }
        }
        if (!partIds.isEmpty()) {
          LOG.debug("Execute updates on part: {}", partIds);
          verifyUpdates(pst.executeBatch(), partIds);
        }
      }
    }
  }
This class contains the optimizations for MetaStore that rely on direct SQL access to
the underlying database. It should use ANSI SQL and be compatible with common databases
such as MySQL (note that MySQL doesn't use full ANSI mode by default), Postgres, etc.

This class separates out the update part from MetaStoreDirectSql class.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DirectSqlUpdatePart.java