domoritz commented on a change in pull request #10151:
URL: https://github.com/apache/arrow/pull/10151#discussion_r620743520
##########
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:
@trxcllnt I took your feedback but this feels overly verbose and also
now I expose a previously internal function.
<img width="855" alt="Screen Shot 2021-04-26 at 17 33 23"
src="https://user-images.githubusercontent.com/589034/116167669-86746b00-a6b5-11eb-812f-103f0daaf67f.png">
--
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]