You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/02/18 22:27:07 UTC

[GitHub] [arrow] Alfred-Mountfield commented on a change in pull request #12451: ARROW-15705: [JavaScript] Allowing appending null on children in a StructBuilder

Alfred-Mountfield commented on a change in pull request #12451:
URL: https://github.com/apache/arrow/pull/12451#discussion_r810377591



##########
File path: js/src/builder/struct.ts
##########
@@ -23,12 +23,31 @@ import { Struct, TypeMap } from '../type.js';
 
 /** @ignore */
 export class StructBuilder<T extends TypeMap = any, TNull = any> extends Builder<Struct<T>, TNull> {
-    public setValue(index: number, value: Struct<T>['TValue']) {
+    /**
+     * Write a value (or null-value sentinel) at the supplied index.
+     * If the value matches one of the null-value representations, a 1-bit is
+     * written to the null `BitmapBufferBuilder`, otherwise, a 0 is written. The
+     * value is then passed to `Builder.prototype.setValue()`.
+     * @param {number} index The index of the value to write.
+     * @param {T['TValue'] | TNull } value The value to write at the supplied index.
+     * @returns {this} The updated `Builder` instance.
+     */
+    public set(index: number, value: Struct<T>['TValue'] | TNull) {
+        this.setValid(index, this.isValid(value));
+        this.setValue(index, value);
+        return this;
+    }

Review comment:
       Is `inheritdoc` correct here? I believe the inherited documentation would be misleading as it wouldn't mention calling the `setValid` function on the children.
   
   Also I'll admit I'm very unfamiliar with this codebase, is passing `false` good enough, I would have thought you need to pass `value`?




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org