From 2eca3a7e98ccd6a3efd084cd03dec3a3663a5088 Mon Sep 17 00:00:00 2001 From: WenjunMin Date: Fri, 8 Nov 2024 17:07:23 +0800 Subject: [PATCH] [Bug] Fix the NPE when report the statistic with DeletionFile (#4485) --- .../paimon/flink/sink/partition/HmsReporter.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/sink/partition/HmsReporter.java b/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/sink/partition/HmsReporter.java index e6b6c49834c2..eb965aa3a318 100644 --- a/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/sink/partition/HmsReporter.java +++ b/paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/sink/partition/HmsReporter.java @@ -24,7 +24,6 @@ import org.apache.paimon.metastore.MetastoreClient; import org.apache.paimon.table.FileStoreTable; import org.apache.paimon.table.source.DataSplit; -import org.apache.paimon.table.source.DeletionFile; import org.apache.paimon.table.source.ScanMode; import org.apache.paimon.table.source.snapshot.SnapshotReader; import org.apache.paimon.utils.Preconditions; @@ -86,14 +85,6 @@ public void report(String partition, long modifyTime) throws Exception { for (DataFileMeta fileMeta : fileMetas) { totalSize += fileMeta.fileSize(); } - - if (split.deletionFiles().isPresent()) { - fileCount += split.deletionFiles().get().size(); - totalSize += - split.deletionFiles().get().stream() - .map(DeletionFile::length) - .reduce(0L, Long::sum); - } } Map statistic = new HashMap<>(); statistic.put(NUM_FILES_PROP, String.valueOf(fileCount)); @@ -101,7 +92,7 @@ public void report(String partition, long modifyTime) throws Exception { statistic.put(NUM_ROWS_PROP, String.valueOf(rowCount)); statistic.put(HIVE_LAST_UPDATE_TIME_PROP, String.valueOf(modifyTime / 1000)); - LOG.info("alter partition {} with statistic {}.", partition, statistic); + LOG.info("alter partition {} with statistic {}.", partitionSpec, statistic); metastoreClient.alterPartition(partitionSpec, statistic, modifyTime); } }