This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new a79b08bc66 [core] Add tests for drop stats for overwrite commit (#4600)
a79b08bc66 is described below
commit a79b08bc668c16e143e3f0126d59dea2a7253b11
Author: LsomeYeah <[email protected]>
AuthorDate: Wed Nov 27 15:09:19 2024 +0800
[core] Add tests for drop stats for overwrite commit (#4600)
---
.../paimon/operation/FileStoreCommitTest.java | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git
a/paimon-core/src/test/java/org/apache/paimon/operation/FileStoreCommitTest.java
b/paimon-core/src/test/java/org/apache/paimon/operation/FileStoreCommitTest.java
index 67945df60c..de4ee684b8 100644
---
a/paimon-core/src/test/java/org/apache/paimon/operation/FileStoreCommitTest.java
+++
b/paimon-core/src/test/java/org/apache/paimon/operation/FileStoreCommitTest.java
@@ -31,8 +31,11 @@ import org.apache.paimon.fs.Path;
import org.apache.paimon.fs.local.LocalFileIO;
import org.apache.paimon.index.IndexFileHandler;
import org.apache.paimon.index.IndexFileMeta;
+import org.apache.paimon.manifest.FileKind;
import org.apache.paimon.manifest.IndexManifestEntry;
import org.apache.paimon.manifest.ManifestCommittable;
+import org.apache.paimon.manifest.ManifestEntry;
+import org.apache.paimon.manifest.ManifestFile;
import org.apache.paimon.manifest.ManifestFileMeta;
import org.apache.paimon.mergetree.compact.DeduplicateMergeFunction;
import org.apache.paimon.predicate.PredicateBuilder;
@@ -80,6 +83,7 @@ import java.util.stream.Collectors;
import static org.apache.paimon.index.HashIndexFile.HASH_INDEX;
import static
org.apache.paimon.partition.PartitionPredicate.createPartitionPredicate;
+import static org.apache.paimon.stats.SimpleStats.EMPTY_STATS;
import static
org.apache.paimon.testutils.assertj.PaimonAssertions.anyCauseMatches;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -943,6 +947,31 @@ public class FileStoreCommitTest {
.isEqualTo(0);
}
+ @Test
+ public void testDropStatsForOverwrite() throws Exception {
+ TestFileStore store = createStore(false);
+
+ List<KeyValue> keyValues = generateDataList(1);
+ BinaryRow partition = gen.getPartition(keyValues.get(0));
+ // commit 1
+ Snapshot snapshot1 =
+ store.commitData(keyValues, s -> partition, kv -> 0,
Collections.emptyMap()).get(0);
+ // overwrite commit 2
+ Snapshot snapshot2 =
+ store.overwriteData(keyValues, s -> partition, kv -> 0,
Collections.emptyMap())
+ .get(0);
+ ManifestFile manifestFile = store.manifestFileFactory().create();
+ List<ManifestEntry> entries =
+
store.manifestListFactory().create().readDataManifests(snapshot2).stream()
+ .flatMap(meta ->
manifestFile.read(meta.fileName()).stream())
+ .collect(Collectors.toList());
+ for (ManifestEntry manifestEntry : entries) {
+ if (manifestEntry.kind() == FileKind.DELETE) {
+
assertThat(manifestEntry.file().valueStats()).isEqualTo(EMPTY_STATS);
+ }
+ }
+ }
+
@Test
public void testManifestCompactFull() throws Exception {
// Disable full compaction by options.