amoeba commented on code in PR #45889:
URL: https://github.com/apache/arrow/pull/45889#discussion_r2009264649


##########
js/src/builder/fixedsizelist.ts:
##########
@@ -24,10 +24,16 @@ export class FixedSizeListBuilder<T extends DataType = any, 
TNull = any> extends
     public setValue(index: number, value: T['TValue']) {
         const [child] = this.children;
         const start = index * this.stride;
-        for (let i = -1, n = value.length; ++i < n;) {
-            child.set(start + i, value[i]);
+        for (let i = -1, n = this.stride; ++i < n;) {
+            // Use either the actual value or a null (if the slot is null)
+            const finalVal = value ? value[i] : null;
+            child.set(start + i, finalVal);
         }
     }
+    public setValid(index: number, valid: boolean) {
+        this.length = this._nulls.set(index, +valid).length;
+        return true;
+    }

Review Comment:
   ah, yep. this is much better. Thanks.



-- 
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]

Reply via email to