|
25 | 25 | import org.apache.paimon.fs.Path; |
26 | 26 | import org.apache.paimon.manifest.IndexManifestEntry; |
27 | 27 | import org.apache.paimon.manifest.IndexManifestFile; |
28 | | -import org.apache.paimon.table.source.DeletionFile; |
29 | 28 | import org.apache.paimon.utils.IntIterator; |
30 | 29 | import org.apache.paimon.utils.Pair; |
31 | 30 | import org.apache.paimon.utils.PathFactory; |
32 | 31 | import org.apache.paimon.utils.SnapshotManager; |
33 | 32 |
|
34 | | -import javax.annotation.Nullable; |
35 | | - |
36 | 33 | import java.io.IOException; |
37 | 34 | import java.io.UncheckedIOException; |
38 | 35 | import java.util.ArrayList; |
39 | 36 | import java.util.Collections; |
40 | 37 | import java.util.HashMap; |
41 | | -import java.util.LinkedHashMap; |
42 | 38 | import java.util.List; |
43 | 39 | import java.util.Map; |
44 | 40 | import java.util.Optional; |
|
47 | 43 | import static org.apache.paimon.deletionvectors.DeletionVectorsIndexFile.DELETION_VECTORS_INDEX; |
48 | 44 | import static org.apache.paimon.index.HashIndexFile.HASH_INDEX; |
49 | 45 | import static org.apache.paimon.utils.Preconditions.checkArgument; |
50 | | -import static org.apache.paimon.utils.Preconditions.checkNotNull; |
51 | 46 |
|
52 | 47 | /** Handle index files. */ |
53 | 48 | public class IndexFileHandler { |
@@ -85,46 +80,6 @@ public Optional<IndexFileMeta> scanHashIndex( |
85 | 80 | return result.isEmpty() ? Optional.empty() : Optional.of(result.get(0)); |
86 | 81 | } |
87 | 82 |
|
88 | | - public Map<String, DeletionFile> scanDVIndex( |
89 | | - @Nullable Snapshot snapshot, BinaryRow partition, int bucket) { |
90 | | - if (snapshot == null) { |
91 | | - return Collections.emptyMap(); |
92 | | - } |
93 | | - String indexManifest = snapshot.indexManifest(); |
94 | | - if (indexManifest == null) { |
95 | | - return Collections.emptyMap(); |
96 | | - } |
97 | | - List<IndexManifestEntry> manifests = new ArrayList<>(); |
98 | | - for (IndexManifestEntry file : indexManifestFile.read(indexManifest)) { |
99 | | - IndexFileMeta meta = file.indexFile(); |
100 | | - if (meta.indexType().equals(DELETION_VECTORS_INDEX) |
101 | | - && file.partition().equals(partition) |
102 | | - && file.bucket() == bucket) { |
103 | | - manifests.add(file); |
104 | | - } |
105 | | - } |
106 | | - return scanDVIndex(manifests); |
107 | | - } |
108 | | - |
109 | | - public Map<String, DeletionFile> scanDVIndex(List<IndexManifestEntry> manifests) { |
110 | | - Map<String, DeletionFile> result = new HashMap<>(); |
111 | | - for (IndexManifestEntry file : manifests) { |
112 | | - IndexFileMeta meta = file.indexFile(); |
113 | | - LinkedHashMap<String, DeletionVectorMeta> dvMetas = meta.deletionVectorMetas(); |
114 | | - checkNotNull(dvMetas); |
115 | | - for (DeletionVectorMeta dvMeta : dvMetas.values()) { |
116 | | - result.put( |
117 | | - dvMeta.dataFileName(), |
118 | | - new DeletionFile( |
119 | | - filePath(meta).toString(), |
120 | | - dvMeta.offset(), |
121 | | - dvMeta.length(), |
122 | | - dvMeta.cardinality())); |
123 | | - } |
124 | | - } |
125 | | - return result; |
126 | | - } |
127 | | - |
128 | 83 | public List<IndexManifestEntry> scan(String indexType) { |
129 | 84 | return scan(snapshotManager.latestSnapshot(), indexType); |
130 | 85 | } |
|
0 commit comments