Skip to content

Commit

Permalink
Merge branch 'dev_' into pr/5083
Browse files Browse the repository at this point in the history
  • Loading branch information
Hisoka-X committed Oct 13, 2023
2 parents 1445f96 + b1d66c5 commit cadf6a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

public class SeaTunnelRowTest {
Expand Down Expand Up @@ -87,4 +88,12 @@ void testForRowSize() {
});
Assertions.assertEquals(181, row2.getBytesSize());
}

@Test
void testWithLinkHashMap() {
Map<String, String> map = new LinkedHashMap<>();
map.put("key", "value");
SeaTunnelRow row = new SeaTunnelRow(new Object[] {map});
Assertions.assertEquals(8, row.getBytesSize());
}
}

0 comments on commit cadf6a4

Please sign in to comment.