Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getArrowSchema(schema) {
const arrowFields = [];
for (const key in schema) {
const field = schema[key];
if (field.type === Float32Array) {
const metadata = field; // just store the original field as metadata
// arrow: new Field(name, nullable, metadata)
const arrowField = new Field(field.name, Float32, field.nullable, metadata);
arrowFields.push(arrowField);
}
}
if (arrowFields.length === 0) {
throw new Error('No arrow convertable fields');
}
return new Schema(arrowFields);
}