Skip to content

Commit be98f6f

Browse files
committed
id to version
1 parent b938e4b commit be98f6f

File tree

9 files changed

+39
-39
lines changed

9 files changed

+39
-39
lines changed

paimon-core/src/main/java/org/apache/paimon/mergetree/LookupFile.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class LookupFile {
5050
private final File localFile;
5151
private final int level;
5252
private final long schemaId;
53-
private final String serializerId;
53+
private final String serVersion;
5454
private final LookupStoreReader reader;
5555
private final Runnable callback;
5656

@@ -62,13 +62,13 @@ public LookupFile(
6262
File localFile,
6363
int level,
6464
long schemaId,
65-
String serializerId,
65+
String serVersion,
6666
LookupStoreReader reader,
6767
Runnable callback) {
6868
this.localFile = localFile;
6969
this.level = level;
7070
this.schemaId = schemaId;
71-
this.serializerId = serializerId;
71+
this.serVersion = serVersion;
7272
this.reader = reader;
7373
this.callback = callback;
7474
}
@@ -81,8 +81,8 @@ public long schemaId() {
8181
return schemaId;
8282
}
8383

84-
public String serializerId() {
85-
return serializerId;
84+
public String serVersion() {
85+
return serVersion;
8686
}
8787

8888
@Nullable

paimon-core/src/main/java/org/apache/paimon/mergetree/LookupLevels.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class LookupLevels<T> implements Levels.DropFileCallback, Closeable {
7070
private final Function<Long, BloomFilter.Builder> bfGenerator;
7171
private final Cache<String, LookupFile> lookupFileCache;
7272
private final Set<String> ownCachedFiles;
73-
private final Map<Pair<Long, String>, PersistProcessor<T>> schemaIdAndSerIdToProcessors;
73+
private final Map<Pair<Long, String>, PersistProcessor<T>> schemaIdAndSerVersionToProcessors;
7474

7575
@Nullable private RemoteFileDownloader remoteFileDownloader;
7676

@@ -100,7 +100,7 @@ public LookupLevels(
100100
this.bfGenerator = bfGenerator;
101101
this.lookupFileCache = lookupFileCache;
102102
this.ownCachedFiles = new HashSet<>();
103-
this.schemaIdAndSerIdToProcessors = new ConcurrentHashMap<>();
103+
this.schemaIdAndSerVersionToProcessors = new ConcurrentHashMap<>();
104104
levels.addDropFileCallback(this);
105105
}
106106

@@ -165,17 +165,17 @@ private T lookup(InternalRow key, DataFileMeta file) throws IOException {
165165
return null;
166166
}
167167

168-
return getOrCreateProcessor(lookupFile.schemaId(), lookupFile.serializerId())
168+
return getOrCreateProcessor(lookupFile.schemaId(), lookupFile.serVersion())
169169
.readFromDisk(key, lookupFile.level(), valueBytes, file.fileName());
170170
}
171171

172-
private PersistProcessor<T> getOrCreateProcessor(long schemaId, String serializerId) {
173-
return schemaIdAndSerIdToProcessors.computeIfAbsent(
174-
Pair.of(schemaId, serializerId),
172+
private PersistProcessor<T> getOrCreateProcessor(long schemaId, String serVersion) {
173+
return schemaIdAndSerVersionToProcessors.computeIfAbsent(
174+
Pair.of(schemaId, serVersion),
175175
id -> {
176176
RowType fileSchema =
177177
schemaId == currentSchemaId ? null : schemaFunction.apply(schemaId);
178-
return processorFactory.create(serializerId, serializerFactory, fileSchema);
178+
return processorFactory.create(serVersion, serializerFactory, fileSchema);
179179
});
180180
}
181181

@@ -186,12 +186,12 @@ public LookupFile createLookupFile(DataFileMeta file) throws IOException {
186186
}
187187

188188
long schemaId = this.currentSchemaId;
189-
String fileSerId = serializerFactory.identifier();
190-
Optional<String> downloadSerId = tryToDownloadRemoteSst(file, localFile);
191-
if (downloadSerId.isPresent()) {
189+
String fileSerVersion = serializerFactory.version();
190+
Optional<String> downloadSerVersion = tryToDownloadRemoteSst(file, localFile);
191+
if (downloadSerVersion.isPresent()) {
192192
// use schema id from remote file
193193
schemaId = file.schemaId();
194-
fileSerId = downloadSerId.get();
194+
fileSerVersion = downloadSerVersion.get();
195195
} else {
196196
createSstFileFromDataFile(file, localFile);
197197
}
@@ -201,7 +201,7 @@ public LookupFile createLookupFile(DataFileMeta file) throws IOException {
201201
localFile,
202202
file.level(),
203203
schemaId,
204-
fileSerId,
204+
fileSerVersion,
205205
lookupStoreFactory.createReader(localFile),
206206
() -> ownCachedFiles.remove(file.fileName()));
207207
}
@@ -219,7 +219,7 @@ private Optional<String> tryToDownloadRemoteSst(DataFileMeta file, File localFil
219219

220220
// validate schema matched, no exception here
221221
try {
222-
getOrCreateProcessor(file.schemaId(), remoteSst.serializerId);
222+
getOrCreateProcessor(file.schemaId(), remoteSst.serVersion);
223223
} catch (UnsupportedOperationException e) {
224224
return Optional.empty();
225225
}
@@ -229,7 +229,7 @@ private Optional<String> tryToDownloadRemoteSst(DataFileMeta file, File localFil
229229
return Optional.empty();
230230
}
231231

232-
return Optional.of(remoteSst.serializerId);
232+
return Optional.of(remoteSst.serVersion);
233233
}
234234

235235
public void addLocalFile(DataFileMeta file, LookupFile lookupFile) {
@@ -242,7 +242,7 @@ private void createSstFileFromDataFile(DataFileMeta file, File localFile) throws
242242
localFile, bfGenerator.apply(file.rowCount()));
243243
RecordReader<KeyValue> reader = fileReaderFactory.apply(file)) {
244244
PersistProcessor<T> processor =
245-
getOrCreateProcessor(currentSchemaId, serializerFactory.identifier());
245+
getOrCreateProcessor(currentSchemaId, serializerFactory.version());
246246
KeyValue kv;
247247
if (processor.withPosition()) {
248248
FileRecordIterator<KeyValue> batch;
@@ -291,8 +291,8 @@ public Optional<RemoteSstFile> remoteSst(DataFileMeta file) {
291291
return Optional.empty();
292292
}
293293

294-
String serializerId = split[split.length - 2];
295-
return Optional.of(new RemoteSstFile(sstFileName, serializerId));
294+
String serVersion = split[split.length - 2];
295+
return Optional.of(new RemoteSstFile(sstFileName, serVersion));
296296
}
297297

298298
public String newRemoteSst(DataFileMeta file, long length) {
@@ -302,7 +302,7 @@ public String newRemoteSst(DataFileMeta file, long length) {
302302
+ "."
303303
+ processorFactory.identifier()
304304
+ "."
305-
+ serializerFactory.identifier()
305+
+ serializerFactory.version()
306306
+ REMOTE_LOOKUP_FILE_SUFFIX;
307307
}
308308

@@ -314,15 +314,15 @@ public void close() throws IOException {
314314
}
315315
}
316316

317-
/** Remote sst file with serializerId. */
317+
/** Remote sst file with serVersion. */
318318
public static class RemoteSstFile {
319319

320320
private final String sstFileName;
321-
private final String serializerId;
321+
private final String serVersion;
322322

323-
private RemoteSstFile(String sstFileName, String serializerId) {
323+
private RemoteSstFile(String sstFileName, String serVersion) {
324324
this.sstFileName = sstFileName;
325-
this.serializerId = serializerId;
325+
this.serVersion = serVersion;
326326
}
327327
}
328328
}

paimon-core/src/main/java/org/apache/paimon/mergetree/lookup/DefaultLookupSerializerFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
public class DefaultLookupSerializerFactory implements LookupSerializerFactory {
3131

3232
@Override
33-
public String identifier() {
33+
public String version() {
3434
return "v1";
3535
}
3636

@@ -42,8 +42,8 @@ public Function<InternalRow, byte[]> createSerializer(RowType currentSchema) {
4242

4343
@Override
4444
public Function<byte[], InternalRow> createDeserializer(
45-
String fileSerializerId, RowType currentSchema, @Nullable RowType fileSchema) {
46-
if (!identifier().equals(fileSerializerId)) {
45+
String fileSerVersion, RowType currentSchema, @Nullable RowType fileSchema) {
46+
if (!version().equals(fileSerVersion)) {
4747
throw new UnsupportedOperationException();
4848
}
4949
if (fileSchema != null && !fileSchema.equalsIgnoreNullable(currentSchema)) {

paimon-core/src/main/java/org/apache/paimon/mergetree/lookup/LookupSerializerFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
/** Factory to create serializer for lookup. */
3333
public interface LookupSerializerFactory {
3434

35-
String identifier();
35+
String version();
3636

3737
Function<InternalRow, byte[]> createSerializer(RowType currentSchema);
3838

3939
Function<byte[], InternalRow> createDeserializer(
40-
String fileSerializerId, RowType currentSchema, @Nullable RowType fileSchema);
40+
String fileSerVersion, RowType currentSchema, @Nullable RowType fileSchema);
4141

4242
Supplier<LookupSerializerFactory> INSTANCE =
4343
Suppliers.memoize(

paimon-core/src/main/java/org/apache/paimon/mergetree/lookup/PersistEmptyProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public String identifier() {
5353

5454
@Override
5555
public PersistProcessor<Boolean> create(
56-
String fileSerializerId,
56+
String fileSerVersion,
5757
LookupSerializerFactory serializerFactory,
5858
@Nullable RowType fileSchema) {
5959
return new PersistEmptyProcessor();

paimon-core/src/main/java/org/apache/paimon/mergetree/lookup/PersistPositionProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public String identifier() {
6565

6666
@Override
6767
public PersistProcessor<FilePosition> create(
68-
String fileSerializerId,
68+
String fileSerVersion,
6969
LookupSerializerFactory serializerFactory,
7070
@Nullable RowType fileSchema) {
7171
return new PersistPositionProcessor();

paimon-core/src/main/java/org/apache/paimon/mergetree/lookup/PersistProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ interface Factory<T> {
4343
String identifier();
4444

4545
PersistProcessor<T> create(
46-
String fileSerializerId,
46+
String fileSerVersion,
4747
LookupSerializerFactory serializerFactory,
4848
@Nullable RowType fileSchema);
4949
}

paimon-core/src/main/java/org/apache/paimon/mergetree/lookup/PersistValueAndPosProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ public String identifier() {
8585

8686
@Override
8787
public PersistProcessor<PositionedKeyValue> create(
88-
String fileSerializerId,
88+
String fileSerVersion,
8989
LookupSerializerFactory serializerFactory,
9090
@Nullable RowType fileSchema) {
9191
return new PersistValueAndPosProcessor(
9292
serializerFactory.createSerializer(valueType),
9393
serializerFactory.createDeserializer(
94-
fileSerializerId, valueType, fileSchema));
94+
fileSerVersion, valueType, fileSchema));
9595
}
9696
};
9797
}

paimon-core/src/main/java/org/apache/paimon/mergetree/lookup/PersistValueProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ public String identifier() {
7373

7474
@Override
7575
public PersistProcessor<KeyValue> create(
76-
String fileSerializerId,
76+
String fileSerVersion,
7777
LookupSerializerFactory serializerFactory,
7878
@Nullable RowType fileSchema) {
7979
return new PersistValueProcessor(
8080
serializerFactory.createSerializer(valueType),
8181
serializerFactory.createDeserializer(
82-
fileSerializerId, valueType, fileSchema));
82+
fileSerVersion, valueType, fileSchema));
8383
}
8484
};
8585
}

0 commit comments

Comments
 (0)