deniskuzZ commented on code in PR #4431: URL: https://github.com/apache/hive/pull/4431#discussion_r1258351499
########## iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java: ########## @@ -410,64 +413,69 @@ public boolean canSetColStatistics(org.apache.hadoop.hive.ql.metadata.Table hmsT } @Override - public boolean setColStatistics(org.apache.hadoop.hive.ql.metadata.Table hmsTable, - List<ColumnStatistics> colStats) { + public boolean setColStatistics(org.apache.hadoop.hive.ql.metadata.Table hmsTable, List<ColumnStatistics> colStats, + ColumnStatsDesc columnStatsDesc) { Table tbl = IcebergTableUtil.getTable(conf, hmsTable.getTTable()); String snapshotId = String.format("%s-STATS-%d", tbl.name(), tbl.currentSnapshot().snapshotId()); - invalidateStats(getStatsPath(tbl)); - byte[] serializeColStats = SerializationUtils.serialize((Serializable) colStats); - try (PuffinWriter writer = Puffin.write(tbl.io().newOutputFile(getStatsPath(tbl).toString())) - .createdBy(Constants.HIVE_ENGINE).build()) { - writer.add( - new Blob( - tbl.name() + "-" + snapshotId, - ImmutableList.of(1), - tbl.currentSnapshot().snapshotId(), - tbl.currentSnapshot().sequenceNumber(), - ByteBuffer.wrap(serializeColStats), - PuffinCompressionCodec.NONE, - ImmutableMap.of())); - writer.finish(); - } catch (IOException e) { - LOG.error(String.valueOf(e)); + try { + if (!checkAndInvalidateStats(tbl)) { Review Comment: could we rename to `invalidateStatsIfExists()` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org