Alfred Mountfield created ARROW-15705:
-----------------------------------------

             Summary: Structs don't append nulls properly
                 Key: ARROW-15705
                 URL: https://issues.apache.org/jira/browse/ARROW-15705
             Project: Apache Arrow
          Issue Type: Bug
          Components: JavaScript
    Affects Versions: 7.0.0
            Reporter: Alfred Mountfield


If you have a StructBuilder, then the `set` method (which is inherited from 
`Builder`) on it will modify the null-bitmap and then return directly due to 
this snippet:
{code:javascript}
public set(index: number, value: T['TValue'] | TNull) {
        if (this.setValid(index, this.isValid(value))) {
            this.setValue(index, value);
        }
        return this;
    }
{code}
 
I believe this breaks the spec, as it results in the children arrays not having 
their lengths and null-counts increased. (At least the Rust implementation 
expects child arrays to be the same length as their parent struct array, and 
the spec seems to imply that's a requirement)

I think there's an easy fix which would be to call `this.setValue` for 
`StructBuilder`s regardless of `this.isValid(value)`

Related to https://issues.apache.org/jira/browse/ARROW-15651



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to