Open
Description
Describe the bug, including details regarding any error messages, version, and platform.
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 (<anonymous>)
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<Int>] {
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