From a90641475aa504699c62affa5c1cb5c298db2426 Mon Sep 17 00:00:00 2001 From: YeJunHao <41894543+leaves12138@users.noreply.github.com> Date: Mon, 9 Dec 2024 16:46:46 +0800 Subject: [PATCH] Update paimon-core/src/main/java/org/apache/paimon/utils/BulkFormatMapping.java Co-authored-by: tsreaper --- .../main/java/org/apache/paimon/utils/BulkFormatMapping.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paimon-core/src/main/java/org/apache/paimon/utils/BulkFormatMapping.java b/paimon-core/src/main/java/org/apache/paimon/utils/BulkFormatMapping.java index d5d28ea4519f..831c6ddbcc91 100644 --- a/paimon-core/src/main/java/org/apache/paimon/utils/BulkFormatMapping.java +++ b/paimon-core/src/main/java/org/apache/paimon/utils/BulkFormatMapping.java @@ -207,8 +207,8 @@ static Pair trimKeyFields( if (positionMap.containsKey(id)) { map[i] = positionMap.get(id); } else { - trimmedFields.add(keyField ? f : field); - map[i] = positionMap.computeIfAbsent(id, k -> index.getAndIncrement()); + map[i] = positionMap.put(id, trimmedFields.size()); + trimmedFields.add(f); } } else { throw new RuntimeException("Can't find field with id: " + id + " in fields.");