Commits

Brian Hulette authored 0729cb771bd
ARROW-2909: [JS] Add convenience function for creating a table from a list of vectors Simplifies the creation of a `Table` from JS Arrays: ```js const LENGTH = 20000; const idVec = Arrow.vector.IntVector.from( Uint32Array.from({length: LENGTH}, () => Math.round(Math.random() * 2E9)) ); const latVec = Arrow.vector.FloatVector.from( Float32Array.from({length: LENGTH}, () => Number((Math.random() * 180 - 90).toFixed(1))) ); const lngVec = Arrow.vector.FloatVector.from( Float32Array.from({length: LENGTH}, () => Number((Math.random() * 360 - 180).toFixed(1))) ); const table = Arrow.Table.fromVectors([idVec, latVec, lngVec], ['id', 'lat', 'lng']) onsole.log(table.schema.fields.map((f) => f.name)); // [ 'id', 'lat', 'lng' ] console.log(table.schema.fields.map((f) => f.type)); // [ Uint32 [Int] { TType: 2, children: undefined, isSigned: false, bitWidth: 32 }, // Float32 [Float] { TType: 3, children: undefined, precision: 1 }, // Float32 [Float] { TType: 3, children: undefined, precision: 1 } ] ``` Author: Brian Hulette <hulettbh@gmail.com> Closes #2322 from TheNeuralBit/from-vectors and squashes the following commits: 12b4c286 <Brian Hulette> Update "Table from JS Arrays" example cfc4948a <Brian Hulette> Use Table.fromVectors in table-tests f6551a3e <Brian Hulette> Add convenience function for constructing a Table from a list of Vectors