[JS] `vectorFromArray()` can't create Int64 from Number
- Dominant language
- TypeScript
- Stars
- 112
- Forks
- 23
- Avg merge
- 21h 18m
- Merged PRs (30d)
- 8
Description
### Describe the bug, including details regarding any error messages, version, and platform.
```js
const { vectorFromArray, Int64 } = require('apache-arrow');
vectorFromArray([1], new Int64())
```
Fails with
```
Uncaught TypeError: Cannot convert 1 to a BigInt
at DataBufferBuilder.set (/Users/willjones/Downloads/repro2/node_modules/apache-arrow/builder/buffer.js:79:42)
at Int64Builder.setValue (/Users/willjones/Downloads/repro2/node_modules/apache-arrow/builder/int.js:24:22)
at Int64Builder.set (/Users/willjones/Downloads/repro2/node_modules/apache-arrow/builder.js:183:18)
at Int64Builder.append (/Users/willjones/Downloads/repro2/node_modules/apache-arrow/builder.js:165:33)
at /Users/willjones/Downloads/repro2/node_modules/apache-arrow/factories.js:183:25
at Generator.next ()
at vectorFromArray (/Users/willjones/Downloads/repro2/node_modules/apache-arrow/factories.js:52:55)
```
If we wrap in `BigInt`, it works:
```
> vectorFromArray([BigInt(1)], new Int64());
Vector [IntVector] {
isValid: [Function (anonymous)],
get: [Function (anonymous)],
...
```
This seems odd, as it seems like `1` is being converted internally to something that can't be converted into a BigInt. I would expect it to be preserved, unless I am misunderstanding how the conversion to BitInt is happening.
### Component(s)
JavaScript
Contributor guide
Assessment
This issue has not been assessed yet.