How to use the apache-arrow/Arrow.es5.min.Float32Vector.from function in apache-arrow

To help you get started, we’ve selected a few apache-arrow examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uber-web / loaders.gl / modules / arrow / src / lib / arrow-table-batch.js View on Github external
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;
}