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

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   When creating a table using regular JavaScript Array syntax, the resulting 
`Vector` gives unexpected results:
   
   ```js
   import { tableFromArrays } from 
'https://cdn.skypack.dev/apache-arrow@15.0.2';
   
   const table = tableFromArrays({
     a: new Float64Array([100, 200, 300]),
     b: [100, 200, 300],
   });
   
   console.log('Table rows:', table.numRows);
   const vectorA = table.getChild('a');
   const vectorB = table.getChild('b');
   console.log('Length of "a":', vectorA.length);
   console.log('Length of "b":', vectorB.length);
   console.log('Element "a" at index 3:', vectorA.get(3));
   console.log('Element "b" at index 3:', vectorB.get(3));
   console.log('Element "a" at index 100:', vectorA.get(100));
   console.log('Element "b" at index 100:', vectorB.get(100));
   console.log('Vector "a" internal data length:', 
vectorA.data[0].values.length);
   console.log('Vector "b" internal data length:', 
vectorB.data[0].values.length);
   ```
   
   The output is:
   
   ```
   Table rows: 3
   Length of "a": 3
   Length of "b": 3
   Vector "a" at index 3: undefined
   Vector "b" at index 3: 0
   Vector "a" at index 100: undefined
   Vector "b" at index 100: undefined
   Vector "a" internal data length: 3
   Vector "b" internal data length: 8
   ```
   
   I would expect "b" to also return `undefined` for elements outside of its 
length. Instead it returns zero.
   
   I noticed that the internal length of the `Float64Array` is 8 instead of 3, 
I suspect this has something to do with it? 
   
   Here's an online playground that shows the issue:
   
   https://stackblitz.com/edit/vitejs-vite-9k7gaz?file=main.js
   
   
   ### Component(s)
   
   JavaScript


-- 
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-unsubscr...@arrow.apache.org.apache.org

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

Reply via email to