Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-15705

[JavaScript] Structs don't append nulls properly

    XMLWordPrintableJSON

Details

    Description

      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:

      public set(index: number, value: T['TValue'] | TNull) {
              if (this.setValid(index, this.isValid(value))) {
                  this.setValue(index, value);
              }
              return this;
          }
      

       
      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

      Attachments

        Issue Links

          Activity

            People

              alfredm Alfred Mountfield
              alfredm Alfred Mountfield
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 6h 40m
                  6h 40m