domoritz commented on a change in pull request #10151:
URL: https://github.com/apache/arrow/pull/10151#discussion_r620530082



##########
File path: js/src/util/args.ts
##########
@@ -21,11 +21,26 @@ import { Column } from '../column';
 import { Vector } from '../vector';
 import { DataType } from '../type';
 import { Chunked } from '../vector/chunked';
+import { BigIntArray, TypedArray } from '../interfaces';
+import { FloatVector, IntVector } from '../vector/index';
 
 type RecordBatchCtor = typeof import('../recordbatch').RecordBatch;
 
 const isArray = Array.isArray;
 
+/** @ignore */
+export function isTypedArray(arr: any): arr is TypedArray | BigIntArray {
+    return ArrayBuffer.isView(arr) && 'BYTES_PER_ELEMENT' in arr;
+}
+
+/** @ignore */
+function vectorFromTypedArray(array: TypedArray): Vector {
+    if (array instanceof Float32Array || array instanceof Float64Array) {
+        return FloatVector.from(array);
+    }
+    return IntVector.from(array);

Review comment:
       Use Vector.new with Data.new here. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to