From e0b5af2a1e847f65c9f57bccf5b50da2416ae023 Mon Sep 17 00:00:00 2001 From: MrQuansy Date: Fri, 22 Mar 2024 19:18:49 +0800 Subject: [PATCH] remove duplicate lookup --- .../encoding/encoder/DictionaryEncoder.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tsfile/src/main/java/org/apache/tsfile/encoding/encoder/DictionaryEncoder.java b/tsfile/src/main/java/org/apache/tsfile/encoding/encoder/DictionaryEncoder.java index df9e10464..27a57842a 100644 --- a/tsfile/src/main/java/org/apache/tsfile/encoding/encoder/DictionaryEncoder.java +++ b/tsfile/src/main/java/org/apache/tsfile/encoding/encoder/DictionaryEncoder.java @@ -61,14 +61,15 @@ public DictionaryEncoder() { @Override public void encode(Binary value, ByteArrayOutputStream out) { - entryIndex.computeIfAbsent( - value, - v -> { - indexEntry.add(v); - mapSize += v.getLength(); - return entryIndex.size(); - }); - valuesEncoder.encode(entryIndex.get(value), out); + valuesEncoder.encode( + entryIndex.computeIfAbsent( + value, + v -> { + indexEntry.add(v); + mapSize += v.getLength(); + return entryIndex.size(); + }), + out); } @Override