Skip to content

[common] Support VECTOR elements in InternalArray accessors - #9773

Open
LuciferYang wants to merge 5 commits into
apache:masterfrom
LuciferYang:fix/internalarray-vector-getter
Open

[common] Support VECTOR elements in InternalArray accessors#9773
LuciferYang wants to merge 5 commits into
apache:masterfrom
LuciferYang:fix/internalarray-vector-getter

Conversation

@LuciferYang

Copy link
Copy Markdown
Contributor

Purpose

close #9772

ARRAY<VECTOR(n)> is accepted by schema validation and readable via ColumnarArray, but the binary data path rejected it in four places: InternalArray.createElementGetter (no VECTOR case — InternalArraySerializer failed construction), BinaryArray.calculateFixLengthPartSize (threw), BinaryArray.getVector (unconditional throw), and InternalRow.getDataClass (broke copy).

This PR routes VECTOR through the existing accessors: getVector in the element getter, the 8-byte variable-length slot in calculateFixLengthPartSize (mirroring ARRAY), readVectorData in BinaryArray.getVector (mirroring BinaryRow.getVector), and InternalVector in getDataClass. The write side (BinaryWriter.writeVector + InternalVectorSerializer) already existed.

Tests

New InternalArrayVectorGetterTest: serializer construction over VECTOR, element getter read, null element through the nullable wrapper, and a full serialize→deserialize→getVector round-trip. RED verified on master (construction threw type VECTOR not support).

API and Format

No format change: vectors in binary rows/arrays use the existing var-length offset-and-size layout written by writeVectorToVarLenPart; this PR adds the missing read/validate paths.

Documentation

None.

ARRAY<VECTOR> is accepted by schema validation and readable via
ColumnarArray, but the binary data path rejected it in three places:
InternalArray.createElementGetter had no VECTOR case (so
InternalArraySerializer, which builds its element getter eagerly,
failed construction with "type VECTOR not support"),
BinaryArray.calculateFixLengthPartSize threw on VECTOR, and
BinaryArray.getVector was an unconditional throw — so a row type
with an ARRAY<VECTOR> column, e.g. serialized by a primary-key
table's local merge, failed no matter how far it got.

Route VECTOR through the existing accessors: getVector in the
element getter, the 8-byte variable-length slot in
calculateFixLengthPartSize (mirroring ARRAY), readVectorData in
BinaryArray.getVector (mirroring BinaryRow), and InternalVector in
InternalRow.getDataClass for copies.

Assisted-by: GLM-5.3
@LuciferYang
LuciferYang marked this pull request as draft September 13, 2026 03:07
LuciferYang and others added 4 commits September 13, 2026 11:37
The round-trip test copies BinaryArray bytes and never reaches
InternalRow.getDataClass, so the VECTOR case that copy() of a GenericArray
depends on was unpinned. This copy test throws "Illegal type: VECTOR" on
the base and passes on the fix.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Three of the five tests pinned the same createElementGetter arm and died
together; the one test that touched the binary form used a single non-null
element, so the 8-byte variable-length slot, the null bit, toObjectArray and
copy-on-binary were pinned by nothing. Fold that coverage into the round trip
with a three-element array containing a null, and drop the two tests that only
restated the arm elementGetterReadsVector already covers.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@LuciferYang
LuciferYang marked this pull request as ready for review September 13, 2026 18:23
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] ARRAY<VECTOR> row types fail binary serialization with "type VECTOR not support"

1 participant