trxcllnt commented on code in PR #45889:
URL: https://github.com/apache/arrow/pull/45889#discussion_r2010755355
##########
js/test/unit/vector/vector-tests.ts:
##########
@@ -323,3 +323,40 @@ function basicVectorTests(vector: Vector, values: any[],
extras: any[]) {
}
});
}
+
+// GH-45862: Make sure vectorFromArray produces the correct result for
+// FixedSizeList with null slots
+describe(`vecorFromArray() with FixedSizeList<T> and null slots`, () => {
+ test(`correct child length with null slot first`, () => {
+ let vector = vectorFromArray(
+ [null, [1, 2, 3]],
+ new FixedSizeList(3, new Field('item', new Int32())),
+ );
+ let child = vector.getChildAt(0);
+
+ expect(child).toHaveLength(6);
+ expect(child?.nullCount).toBe(3);
Review Comment:
The issue this PR fixes is that the child Builder's nullBitmap isn't being
expanded to represent all the slots when a null value is written into the
parent Builder. So if you append 1000 null values to the
`FixedSizeListBuilder`, the child's nullBitmap remain zero-sized. Since we
initialize the nullBitmap with zeroes, all we need to do is grow it both when
we write non-nulls as well as nulls.
In terms of Field metadata, we don't use that anywhere in JS aside from
faithfully propagating it in the IPC format. We assume the contents of the
nullBitmap doesn't matter to other implementations if `field.nullable == false`
(because the description of `Field.nullable`
[here](https://arrow.apache.org/docs/format/Columnar.html#schema-message)).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]