Skip to content

[api] Avoid overflow in composite type default size#8517

Merged
JingsongLi merged 1 commit into
apache:masterfrom
thswlsqls:fix/composite-type-default-size-overflow
Jul 9, 2026
Merged

[api] Avoid overflow in composite type default size#8517
JingsongLi merged 1 commit into
apache:masterfrom
thswlsqls:fix/composite-type-default-size-overflow

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Purpose

fix #8513

  • RowType, MapType and MultisetType defaultSize() summed child int sizes without an overflow guard, wrapping to a negative value when a child size nears Integer.MAX_VALUE.
  • Saturate at Integer.MAX_VALUE via the existing MathUtils.addSafely(int,int) (no new API or dependency), matching VectorType.defaultSize() fixed in PR [api] Avoid overflow in VectorType default size #8360, which left these sibling composite types unguarded.

Tests

  • Added DefaultSizeOverflowTest covering normal sums (ROW/MAP/MULTISET) and overflow saturation for a large VECTOR child in each composite type.
  • mvn -pl paimon-api -DfailIfNoTests=false clean install — passed.

RowType/MapType/MultisetType defaultSize() summed int sizes without overflow guard, wrapping to negative; use MathUtils.addSafely to saturate at Integer.MAX_VALUE, matching VectorType (PR apache#8360).

Generated-by: Claude Code
@JingsongLi JingsongLi merged commit 01284b9 into apache:master Jul 9, 2026
11 of 12 checks passed
@thswlsqls thswlsqls deleted the fix/composite-type-default-size-overflow branch July 11, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Composite type default size overflows to negative

2 participants