You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "asfimport (via GitHub)" <gi...@apache.org> on 2025/05/26 22:41:59 UTC

[I] [JS] toArray() method ignores nulls on some types. [arrow-js]

asfimport opened a new issue, #105:
URL: https://github.com/apache/arrow-js/issues/105

   The .toArray() javascript method of vectors includes a shortcut to return the underlying typed array; but this doesn't respect null values, and so can return the wrong number.
   
    
   
   ```
   
   v = arrow.Vector.from(\{values: [1, 2, 3, 4, 5, null, 6],type: new arrow.Int32()})
   
   v.toArray()[5] // Incorrectly returns '0'
   
   v.get(5) // Correctly returns null
   
   ```
   
    
   
   Solution: Eliminate the fast method, always return Javascript arrays. It might be better to keep the old method in cases where there are guaranteed no nulls.
   
   **Reporter**: [Ben Schmidt](https://issues.apache.org/jira/browse/ARROW-10221) / @bmschmidt
   #### Externally tracked issue: [https://github.com/apache/arrow/pull/8385](https://github.com/apache/arrow/pull/8385)
   #### PRs and other links:
   - [GitHub Pull Request apache/arrow#8385](https://github.com/apache/arrow/pull/8385)
   
   <sub>**Note**: *This issue was originally created as [ARROW-10221](https://issues.apache.org/jira/browse/ARROW-10221). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*</sub>


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

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