Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getArrowVectors(arrowSchema, data) {
const arrowVectors = [];
for (const field of arrowSchema.fields) {
const vector = data[field.name];
if (vector instanceof Float32Array) {
const arrowVector = Float32Vector.from(vector);
arrowVectors.push(arrowVector);
}
}
if (arrowSchema.fields.length !== arrowVectors.length) {
throw new Error('Some columns not arrow convertable');
}
return arrowVectors;
}