diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/SeaTunnelRow.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/SeaTunnelRow.java index 299026c4076..622bb9b6a62 100644 --- a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/SeaTunnelRow.java +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/SeaTunnelRow.java @@ -255,6 +255,7 @@ private int getBytesForValue(Object v) { case "Double[]": return ((Double[]) v).length * 8; case "HashMap": + case "LinkedHashMap": int size = 0; for (Map.Entry entry : ((Map) v).entrySet()) { size += getBytesForValue(entry.getKey()) + getBytesForValue(entry.getValue()); diff --git a/seatunnel-api/src/test/java/org/apache/seatunnel/api/table/type/SeaTunnelRowTest.java b/seatunnel-api/src/test/java/org/apache/seatunnel/api/table/type/SeaTunnelRowTest.java index eaad7f95767..7b3046c440a 100644 --- a/seatunnel-api/src/test/java/org/apache/seatunnel/api/table/type/SeaTunnelRowTest.java +++ b/seatunnel-api/src/test/java/org/apache/seatunnel/api/table/type/SeaTunnelRowTest.java @@ -22,6 +22,7 @@ import java.math.BigDecimal; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; public class SeaTunnelRowTest { @@ -87,4 +88,12 @@ void testForRowSize() { }); Assertions.assertEquals(181, row2.getBytesSize()); } + + @Test + void testWithLinkHashMap() { + Map map = new LinkedHashMap<>(); + map.put("key", "value"); + SeaTunnelRow row = new SeaTunnelRow(new Object[] {map}); + Assertions.assertEquals(8, row.getBytesSize()); + } }