Skip to content

Commit 5febf80

Browse files
authored
Remove duplicate lookups in dictionary encoder
1 parent 758cb44 commit 5febf80

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

tsfile/src/main/java/org/apache/tsfile/encoding/encoder/DictionaryEncoder.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,15 @@ public DictionaryEncoder() {
6161

6262
@Override
6363
public void encode(Binary value, ByteArrayOutputStream out) {
64-
entryIndex.computeIfAbsent(
65-
value,
66-
v -> {
67-
indexEntry.add(v);
68-
mapSize += v.getLength();
69-
return entryIndex.size();
70-
});
71-
valuesEncoder.encode(entryIndex.get(value), out);
64+
int i =
65+
entryIndex.computeIfAbsent(
66+
value,
67+
v -> {
68+
indexEntry.add(v);
69+
mapSize += v.getLength();
70+
return entryIndex.size();
71+
});
72+
valuesEncoder.encode(i, out);
7273
}
7374

7475
@Override

0 commit comments

Comments
 (0)