Socket
Socket
Sign inDemoInstall

@apache-arrow/ts

Package Overview
Dependencies
Maintainers
7
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apache-arrow/ts - npm Package Compare versions

Comparing version 16.0.0 to 16.1.0

4

bin/arrow2csv.js

@@ -22,4 +22,4 @@ #! /usr/bin/env node

/* eslint-disable unicorn/no-array-for-each */
var fs = require("fs");
var stream = require("stream");
var fs = require("node:fs");
var stream = require("node:stream");
var Arrow_js_1 = require("./Arrow.js");

@@ -26,0 +26,0 @@ var commandLineUsage = require("command-line-usage");

@@ -22,4 +22,4 @@ #! /usr/bin/env node

import * as fs from 'fs';
import * as stream from 'stream';
import * as fs from 'node:fs';
import * as stream from 'node:stream';
import { Schema, RecordBatch, RecordBatchReader, AsyncByteQueue, util } from '../Arrow.js';

@@ -26,0 +26,0 @@

@@ -30,2 +30,7 @@ // Licensed to the Apache Software Foundation (ASF) under one

import type { BuilderDuplexOptions } from './io/node/builder.js';
import type { BuilderTransform, BuilderTransformOptions } from './io/whatwg/builder.js';
import type { Duplex } from 'node:stream';
/**

@@ -102,3 +107,3 @@ * A set of options required to create a `Builder` instance for a given `DataType`.

// @ts-ignore
public static throughNode<T extends DataType = any, TNull = any>(options: import('./io/node/builder').BuilderDuplexOptions<T, TNull>): import('stream').Duplex {
public static throughNode<T extends DataType = any, TNull = any>(options: BuilderDuplexOptions<T, TNull>): Duplex {
throw new Error(`"throughNode" not available in this environment`);

@@ -108,3 +113,3 @@ }

// @ts-ignore
public static throughDOM<T extends DataType = any, TNull = any>(options: import('./io/whatwg/builder').BuilderTransformOptions<T, TNull>): import('./io/whatwg/builder').BuilderTransform<T, TNull> {
public static throughDOM<T extends DataType = any, TNull = any>(options: BuilderTransformOptions<T, TNull>): BuilderTransform<T, TNull> {
throw new Error(`"throughDOM" not available in this environment`);

@@ -111,0 +116,0 @@ }

@@ -28,2 +28,4 @@ // Licensed to the Apache Software Foundation (ASF) under one

import type { ReadableOptions, Readable } from 'node:stream';
type Uint8ArrayGenerator = Generator<Uint8Array, null, { cmd: 'peek' | 'read'; size: number }>;

@@ -51,3 +53,3 @@ type AsyncUint8ArrayGenerator = AsyncGenerator<Uint8Array, null, { cmd: 'peek' | 'read'; size: number }>;

// @ts-ignore
toNodeStream<T>(source: Iterable<T> | AsyncIterable<T>, options?: import('stream').ReadableOptions): import('stream').Readable {
toNodeStream<T>(source: Iterable<T> | AsyncIterable<T>, options?: ReadableOptions): Readable {
throw new Error(`"toNodeStream" not available in this environment`);

@@ -76,3 +78,3 @@ },

// Yield so the caller can inject the read command before creating the source Iterator
({ cmd, size } = (yield (() => <any>null)()) || {cmd: 'read', size: 0});
({ cmd, size } = (yield (() => <any>null)()) || { cmd: 'read', size: 0 });

@@ -123,3 +125,3 @@ // initialize the iterator

// Yield so the caller can inject the read command before creating the source AsyncIterator
({ cmd, size } = (yield (() => <any>null)()) || {cmd: 'read', size: 0});
({ cmd, size } = (yield (() => <any>null)()) || { cmd: 'read', size: 0 });

@@ -174,3 +176,3 @@ // initialize the iterator

// Yield so the caller can inject the read command before we establish the ReadableStream lock
({ cmd, size } = (yield (() => <any>null)()) || {cmd: 'read', size: 0});
({ cmd, size } = (yield (() => <any>null)()) || { cmd: 'read', size: 0 });

@@ -281,3 +283,3 @@ // initialize the reader and lock the stream

// add the listener for the source stream's 'readable' event.
({ cmd, size } = (yield (() => <any>null)()) || {cmd: 'read', size: 0});
({ cmd, size } = (yield (() => <any>null)()) || { cmd: 'read', size: 0 });

@@ -284,0 +286,0 @@ // ignore stdin if it's a TTY

@@ -20,2 +20,5 @@ // Licensed to the Apache Software Foundation (ASF) under one

export type { FileHandle } from 'node:fs/promises';
import type { ReadableOptions, Readable as StreamReadable } from 'node:stream';
/** @ignore */

@@ -25,4 +28,2 @@ export const ITERATOR_DONE: any = Object.freeze({ done: true, value: void (0) });

/** @ignore */
export type FileHandle = import('fs').promises.FileHandle;
/** @ignore */
export type ArrowJSONLike = { schema: any; batches?: any[]; dictionaries?: any[] };

@@ -65,3 +66,3 @@ /** @ignore */

toDOMStream(options?: ReadableDOMStreamOptions): ReadableStream<TReadable>;
toNodeStream(options?: import('stream').ReadableOptions): import('stream').Readable;
toNodeStream(options?: ReadableOptions): StreamReadable;
}

@@ -73,3 +74,3 @@

public abstract toDOMStream(options?: ReadableDOMStreamOptions): ReadableStream<T>;
public abstract toNodeStream(options?: import('stream').ReadableOptions): import('stream').Readable;
public abstract toNodeStream(options?: ReadableOptions): StreamReadable;

@@ -92,3 +93,3 @@ public tee(): [ReadableStream<T>, ReadableStream<T>] {

protected _nodeStream?: import('stream').Readable;
protected _nodeStream?: StreamReadable;
private _getNodeStream() {

@@ -152,3 +153,3 @@ return this._nodeStream || (this._nodeStream = this.toNodeStream());

}
public toNodeStream(options?: import('stream').ReadableOptions) {
public toNodeStream(options?: ReadableOptions) {
return streamAdapters.toNodeStream(

@@ -155,0 +156,0 @@ (this._closedPromiseResolve || this._error)

@@ -18,3 +18,3 @@ // Licensed to the Apache Software Foundation (ASF) under one

import { Duplex } from 'stream';
import { Duplex } from 'node:stream';
import { DataType } from '../../type.js';

@@ -21,0 +21,0 @@ import { Builder, BuilderOptions } from '../../builder.js';

@@ -18,7 +18,7 @@ // Licensed to the Apache Software Foundation (ASF) under one

import { Readable } from 'stream';
import { Readable, ReadableOptions as ReadableOptions_ } from 'node:stream';
import { isIterable, isAsyncIterable } from '../../util/compat.js';
/** @ignore */
type ReadableOptions = import('stream').ReadableOptions;
type ReadableOptions = ReadableOptions_;
/** @ignore */

@@ -25,0 +25,0 @@ type SourceIterator<T> = Generator<T, void, number | null>;

@@ -18,3 +18,3 @@ // Licensed to the Apache Software Foundation (ASF) under one

import { Duplex, DuplexOptions } from 'stream';
import { Duplex, DuplexOptions } from 'node:stream';
import { AsyncByteQueue } from '../../io/stream.js';

@@ -79,3 +79,3 @@ import { RecordBatchReader } from '../../ipc/reader.js';

while (this.readable && !(r = await reader.next()).done) {
if (!this.push(r.value) || (size != null && --size <= 0)) { break; }
if (!this.push(r!.value) || (size != null && --size <= 0)) { break; }
}

@@ -82,0 +82,0 @@ if (!this.readable || (r?.done && (reader.autoDestroy || (await reader.reset().open()).closed))) {

@@ -18,3 +18,4 @@ // Licensed to the Apache Software Foundation (ASF) under one

import { Duplex, DuplexOptions } from 'stream';
import { Duplex } from 'node:stream';
import type { DuplexOptions } from 'node:stream';
import { AsyncByteStream } from '../../io/stream.js';

@@ -21,0 +22,0 @@ import { RecordBatchWriter } from '../../ipc/writer.js';

@@ -45,3 +45,3 @@ // Licensed to the Apache Software Foundation (ASF) under one

while (!(r = await reader.next()).done) {
controller.enqueue(r.value);
controller.enqueue(r!.value);
if (size != null && --size <= 0) {

@@ -48,0 +48,0 @@ return;

@@ -50,2 +50,4 @@ // Licensed to the Apache Software Foundation (ASF) under one

import type { DuplexOptions, Duplex } from 'node:stream';
/** @ignore */ export type FromArg0 = ArrowJSONLike;

@@ -117,3 +119,3 @@ /** @ignore */ export type FromArg1 = PromiseLike<ArrowJSONLike>;

}
public toDOMStream() {
public toDOMStream(): ReadableStream<RecordBatch<T>> {
return streamAdapters.toDOMStream<RecordBatch<T>>(

@@ -124,3 +126,3 @@ (this.isSync()

}
public toNodeStream() {
public toNodeStream(): import('stream').Readable {
return streamAdapters.toNodeStream<RecordBatch<T>>(

@@ -135,3 +137,3 @@ (this.isSync()

// @ts-ignore
public static throughNode(options?: import('stream').DuplexOptions & { autoDestroy: boolean }): import('stream').Duplex {
public static throughNode(options?: DuplexOptions & { autoDestroy: boolean }): Duplex {
throw new Error(`"throughNode" not available in this environment`);

@@ -138,0 +140,0 @@ }

@@ -38,2 +38,4 @@ // Licensed to the Apache Software Foundation (ASF) under one

import type { DuplexOptions, Duplex, ReadableOptions } from 'node:stream';
export interface RecordBatchStreamWriterOptions {

@@ -57,3 +59,3 @@ /**

// @ts-ignore
public static throughNode(options?: import('stream').DuplexOptions & { autoDestroy: boolean }): import('stream').Duplex {
public static throughNode(options?: DuplexOptions & { autoDestroy: boolean }): Duplex {
throw new Error(`"throughNode" not available in this environment`);

@@ -116,3 +118,3 @@ }

public toDOMStream(options?: ReadableDOMStreamOptions) { return this._sink.toDOMStream(options); }
public toNodeStream(options?: import('stream').ReadableOptions) { return this._sink.toNodeStream(options); }
public toNodeStream(options?: ReadableOptions) { return this._sink.toNodeStream(options); }

@@ -119,0 +121,0 @@ public close() {

{
"version": "16.0.0",
"version": "16.1.0",
"name": "@apache-arrow/ts",

@@ -30,9 +30,9 @@ "browser": "Arrow.dom.ts",

"dependencies": {
"@types/node": "^20.6.0",
"@swc/helpers": "^0.5.2",
"@types/command-line-args": "^5.2.1",
"@types/command-line-usage": "^5.0.2",
"@types/node": "^20.12.7",
"@swc/helpers": "^0.5.10",
"@types/command-line-args": "^5.2.3",
"@types/command-line-usage": "^5.0.4",
"command-line-args": "^5.2.1",
"command-line-usage": "^7.0.1",
"flatbuffers": "^23.5.26",
"flatbuffers": "^24.3.25",
"json-bignum": "^0.0.3",

@@ -39,0 +39,0 @@ "tslib": "^2.6.2"

@@ -23,2 +23,3 @@ // Licensed to the Apache Software Foundation (ASF) under one

import { DataType, Struct, Null, TypeMap } from './type.js';
import { wrapIndex } from './util/vector.js';

@@ -120,3 +121,3 @@ import { instance as getVisitor } from './visitor/get.js';

/**
* Check whether an element is null.
* Check whether an row is null.
* @param index The index at which to read the validity bitmap.

@@ -130,3 +131,3 @@ */

* Get a row by position.
* @param index The index of the element to read.
* @param index The index of the row to read.
*/

@@ -138,4 +139,12 @@ public get(index: number) {

/**
* Get a row value by position.
* @param index The index of the row to read. A negative index will count back from the last row.
*/
public at(index: number) {
return this.get(wrapIndex(index, this.numRows));
}
/**
* Set a row by position.
* @param index The index of the element to write.
* @param index The index of the row to write.
* @param value The value to set.

@@ -182,3 +191,3 @@ */

* @param start The beginning of the specified portion of the RecordBatch.
* @param end The end of the specified portion of the RecordBatch. This is exclusive of the element at the index 'end'.
* @param end The end of the specified portion of the RecordBatch. This is exclusive of the row at the index 'end'.
*/

@@ -185,0 +194,0 @@ public slice(begin?: number, end?: number): RecordBatch<T> {

@@ -27,2 +27,4 @@ // Licensed to the Apache Software Foundation (ASF) under one

/** @ignore */ export const kVals = Symbol.for('vals');
/** @ignore */ export const kKeysAsStrings = Symbol.for('kKeysAsStrings');
/** @ignore */ export const _kKeysAsStrings = Symbol.for('_kKeysAsStrings');

@@ -35,2 +37,3 @@ export class MapRow<K extends DataType = any, V extends DataType = any> {

declare private [kVals]: Data<V>;
declare private [_kKeysAsStrings]: string[];

@@ -43,2 +46,7 @@ constructor(slice: Data<Struct<{ key: K; value: V }>>) {

/** @ignore */
get [kKeysAsStrings]() {
return this[_kKeysAsStrings] || (this[_kKeysAsStrings] = Array.from(this[kKeys].toArray(), String));
}
[Symbol.iterator]() {

@@ -113,9 +121,9 @@ return new MapRowIterator(this[kKeys], this[kVals]);

ownKeys(row: MapRow<K, V>) {
return row[kKeys].toArray().map(String);
return row[kKeysAsStrings];
}
has(row: MapRow<K, V>, key: string | symbol) {
return row[kKeys].includes(key);
return row[kKeysAsStrings].includes(key as string);
}
getOwnPropertyDescriptor(row: MapRow<K, V>, key: string | symbol) {
const idx = row[kKeys].indexOf(key);
const idx = row[kKeysAsStrings].indexOf(key as string);
if (idx !== -1) {

@@ -131,3 +139,3 @@ return { writable: true, enumerable: true, configurable: true };

}
const idx = row[kKeys].indexOf(key);
const idx = row[kKeysAsStrings].indexOf(key as string);
if (idx !== -1) {

@@ -141,3 +149,3 @@ const val = getVisitor.visit(Reflect.get(row, kVals), idx);

set(row: MapRow<K, V>, key: string | symbol, val: V) {
const idx = row[kKeys].indexOf(key);
const idx = row[kKeysAsStrings].indexOf(key as string);
if (idx !== -1) {

@@ -158,2 +166,3 @@ setVisitor.visit(Reflect.get(row, kVals), idx, val);

[kVals]: { writable: true, enumerable: false, configurable: false, value: null },
[_kKeysAsStrings]: { writable: true, enumerable: false, configurable: false, value: null },
});

@@ -43,3 +43,3 @@ // Licensed to the Apache Software Foundation (ASF) under one

import { DataProps } from './data.js';
import { clampRange } from './util/vector.js';
import { clampRange, wrapIndex } from './util/vector.js';
import { ArrayDataType, BigIntArray, TypedArray, TypedArrayDataType } from './interfaces.js';

@@ -201,2 +201,11 @@ import { RecordBatch, _InternalEmptyPlaceholderRecordBatch } from './recordbatch.js';

/**
* Get an element value by position.
* @param index The index of the element to read. A negative index will count back from the last element.
*/
// @ts-ignore
public at(index: number): Struct<T>['TValue'] | null {
return this.get(wrapIndex(index, this.numRows));
}
/**
* Set an element value by position.

@@ -203,0 +212,0 @@ *

@@ -336,4 +336,13 @@ // Licensed to the Apache Software Foundation (ASF) under one

/** @ignore */
export interface Date_<T extends Dates = Dates> extends DataType<T> { TArray: Int32Array; TValue: Date; ArrayType: TypedArrayConstructor<Int32Array> }
type DateType = {
[Type.Date]: { TArray: Int32Array | BigInt64Array };
[Type.DateDay]: { TArray: Int32Array };
[Type.DateMillisecond]: { TArray: BigInt64Array };
};
/** @ignore */
export interface Date_<T extends Dates = Dates> extends DataType<T> {
TArray: DateType[T]['TArray'];
TValue: number;
}
/** @ignore */
export class Date_<T extends Dates = Dates> extends DataType<T> {

@@ -344,5 +353,8 @@ constructor(public readonly unit: DateUnit) {

public toString() { return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`; }
public get ArrayType() {
return this.unit === DateUnit.DAY ? Int32Array : BigInt64Array;
}
protected static [Symbol.toStringTag] = ((proto: Date_) => {
(<any>proto).unit = null;
(<any>proto).ArrayType = Int32Array;
return proto[Symbol.toStringTag] = 'Date';

@@ -422,5 +434,5 @@ })(Date_.prototype);

interface Timestamp_<T extends Timestamps = Timestamps> extends DataType<T> {
TArray: Int32Array;
TArray: BigInt64Array;
TValue: number;
ArrayType: TypedArrayConstructor<Int32Array>;
ArrayType: BigIntArrayConstructor<BigInt64Array>;
}

@@ -438,3 +450,3 @@

(<any>proto).timezone = null;
(<any>proto).ArrayType = Int32Array;
(<any>proto).ArrayType = BigInt64Array;
return proto[Symbol.toStringTag] = 'Timestamp';

@@ -490,3 +502,3 @@ })(Timestamp_.prototype);

TValue: bigint;
ArrayType: BigInt64Array;
ArrayType: BigIntArrayConstructor<BigInt64Array>;
}

@@ -745,4 +757,2 @@

case Type.Decimal: return (type as Decimal).bitWidth / 32;
case Type.Timestamp: return 2;
case Type.Date: return 1 + (t as Date_).unit;
case Type.Interval: return 1 + (t as Interval_).unit;

@@ -749,0 +759,0 @@ // case Type.Int: return 1 + +((t as Int_).bitWidth > 32);

@@ -27,1 +27,14 @@ // Licensed to the Apache Software Foundation (ASF) under one

}
/**
* Duivides the bigint number by the divisor and returns the result as a number.
* Dividing bigints always results in bigints so we don't get the remainder.
* This function gives us the remainder but assumes that the result fits into a number.
*
* @param number The number to divide.
* @param divisor The divisor.
* @returns The result of the division as a number.
*/
export function divideBigInts(number: bigint, divisor: bigint): number {
return bigIntToNumber(number / divisor) + bigIntToNumber(number % divisor) / bigIntToNumber(divisor);
}

@@ -20,8 +20,10 @@ // Licensed to the Apache Software Foundation (ASF) under one

/* eslint-disable unicorn/throw-new-error */
import type { ByteBuffer } from 'flatbuffers';
import type { ReadStream } from 'node:fs';
import type { FileHandle as FileHandle_ } from 'node:fs/promises';
/** @ignore */
type FSReadStream = import('fs').ReadStream;
type FSReadStream = ReadStream;
/** @ignore */
type FileHandle = import('fs').promises.FileHandle;
type FileHandle = FileHandle_;

@@ -149,3 +151,3 @@ /** @ignore */

/** @ignore */
export const isFlatbuffersByteBuffer = (x: any): x is import('flatbuffers').ByteBuffer => {
export const isFlatbuffersByteBuffer = (x: any): x is ByteBuffer => {
return isObject(x) &&

@@ -152,0 +154,0 @@ isFunction(x['clear']) &&

@@ -26,16 +26,5 @@ // Licensed to the Apache Software Foundation (ASF) under one

/** @ignore */
type ClampThen<T extends RangeLike> = (source: T, index: number) => any;
/** @ignore */
type ClampRangeThen<T extends RangeLike> = (source: T, offset: number, length: number) => any;
export function clampIndex<T extends RangeLike>(source: T, index: number): number;
export function clampIndex<T extends RangeLike, N extends ClampThen<T> = ClampThen<T>>(source: T, index: number, then: N): ReturnType<N>;
/** @ignore */
export function clampIndex<T extends RangeLike, N extends ClampThen<T> = ClampThen<T>>(source: T, index: number, then?: N) {
const length = source.length;
const adjust = index > -1 ? index : (length + (index % length));
return then ? then(source, adjust) : adjust;
}
/** @ignore */
let tmp: number;

@@ -64,2 +53,5 @@ export function clampRange<T extends RangeLike>(source: T, begin: number | undefined, end: number | undefined): [number, number];

/** @ignore */
export const wrapIndex = (index: number, len: number) => index < 0 ? (len + index) : index;
const isNaNFast = (value: any) => value !== value;

@@ -66,0 +58,0 @@

@@ -19,3 +19,3 @@ // Licensed to the Apache Software Foundation (ASF) under one

import { Type } from './enum.js';
import { clampRange } from './util/vector.js';
import { clampRange, wrapIndex } from './util/vector.js';
import { DataType, strideForType } from './type.js';

@@ -182,2 +182,10 @@ import { Data, makeData, DataProps } from './data.js';

/**
* Get an element value by position.
* @param index The index of the element to read. A negative index will count back from the last element.
*/
public at(index: number): T['TValue'] | null {
return this.get(wrapIndex(index, this.length));
}
/**
* Set an element value by position.

@@ -184,0 +192,0 @@ * @param index The index of the element to write.

@@ -24,3 +24,3 @@ // Licensed to the Apache Software Foundation (ASF) under one

import { StructRow, StructRowProxy } from '../row/struct.js';
import { bigIntToNumber } from '../util/bigint.js';
import { bigIntToNumber, divideBigInts } from '../util/bigint.js';
import { decodeUtf8 } from '../util/utf8.js';

@@ -110,10 +110,3 @@ import { TypeToDataType } from '../interfaces.js';

/** @ignore */const epochDaysToMs = (data: Int32Array, index: number) => 86400000 * data[index];
/** @ignore */const epochMillisecondsLongToMs = (data: Int32Array, index: number) => 4294967296 * (data[index + 1]) + (data[index] >>> 0);
/** @ignore */const epochMicrosecondsLongToMs = (data: Int32Array, index: number) => 4294967296 * (data[index + 1] / 1000) + ((data[index] >>> 0) / 1000);
/** @ignore */const epochNanosecondsLongToMs = (data: Int32Array, index: number) => 4294967296 * (data[index + 1] / 1000000) + ((data[index] >>> 0) / 1000000);
/** @ignore */const epochMillisecondsToDate = (epochMs: number) => new Date(epochMs);
/** @ignore */const epochDaysToDate = (data: Int32Array, index: number) => epochMillisecondsToDate(epochDaysToMs(data, index));
/** @ignore */const epochMillisecondsLongToDate = (data: Int32Array, index: number) => epochMillisecondsToDate(epochMillisecondsLongToMs(data, index));
/** @ignore */

@@ -144,5 +137,5 @@ const getNull = <T extends Null>(_data: Data<T>, _index: number): T['TValue'] => null;

/** @ignore */
const getDateDay = <T extends DateDay>({ values }: Data<T>, index: number): T['TValue'] => epochDaysToDate(values, index);
const getDateDay = <T extends DateDay>({ values }: Data<T>, index: number): T['TValue'] => epochDaysToMs(values, index);
/** @ignore */
const getDateMillisecond = <T extends DateMillisecond>({ values }: Data<T>, index: number): T['TValue'] => epochMillisecondsLongToDate(values, index * 2);
const getDateMillisecond = <T extends DateMillisecond>({ values }: Data<T>, index: number): T['TValue'] => bigIntToNumber(values[index]);
/** @ignore */

@@ -184,9 +177,9 @@ const getNumeric = <T extends Numeric1X>({ stride, values }: Data<T>, index: number): T['TValue'] => values[stride * index];

/** @ignore */
const getTimestampSecond = <T extends TimestampSecond>({ values }: Data<T>, index: number): T['TValue'] => 1000 * epochMillisecondsLongToMs(values, index * 2);
const getTimestampSecond = <T extends TimestampSecond>({ values }: Data<T>, index: number): T['TValue'] => 1000 * bigIntToNumber(values[index]);
/** @ignore */
const getTimestampMillisecond = <T extends TimestampMillisecond>({ values }: Data<T>, index: number): T['TValue'] => epochMillisecondsLongToMs(values, index * 2);
const getTimestampMillisecond = <T extends TimestampMillisecond>({ values }: Data<T>, index: number): T['TValue'] => bigIntToNumber(values[index]);
/** @ignore */
const getTimestampMicrosecond = <T extends TimestampMicrosecond>({ values }: Data<T>, index: number): T['TValue'] => epochMicrosecondsLongToMs(values, index * 2);
const getTimestampMicrosecond = <T extends TimestampMicrosecond>({ values }: Data<T>, index: number): T['TValue'] => divideBigInts(values[index], BigInt(1000));
/** @ignore */
const getTimestampNanosecond = <T extends TimestampNanosecond>({ values }: Data<T>, index: number): T['TValue'] => epochNanosecondsLongToMs(values, index * 2);
const getTimestampNanosecond = <T extends TimestampNanosecond>({ values }: Data<T>, index: number): T['TValue'] => divideBigInts(values[index], BigInt(1000000));
/* istanbul ignore next */

@@ -193,0 +186,0 @@ /** @ignore */

@@ -104,6 +104,7 @@ // Licensed to the Apache Software Foundation (ASF) under one

if (vector.nullCount === 0 && vector.stride === 1 && (
(type.typeId === Type.Timestamp) ||
(type instanceof Int && (type as Int).bitWidth !== 64) ||
(type instanceof Time && (type as Time).bitWidth !== 64) ||
(type instanceof Float && (type as Float).precision !== Precision.HALF)
// Don't defer to native iterator for timestamps since Numbers are expected
// (DataType.isTimestamp(type)) && type.unit === TimeUnit.MILLISECOND ||
(DataType.isInt(type) && type.bitWidth !== 64) ||
(DataType.isTime(type) && type.bitWidth !== 64) ||
(DataType.isFloat(type) && type.precision !== Precision.HALF)
)) {

@@ -110,0 +111,0 @@ return new ChunkedIterator(vector.data.length, (chunkIndex) => {

@@ -112,17 +112,2 @@ // Licensed to the Apache Software Foundation (ASF) under one

export const setEpochMsToDays = (data: Int32Array, index: number, epochMs: number) => { data[index] = Math.floor(epochMs / 86400000); };
/** @ignore */
export const setEpochMsToMillisecondsLong = (data: Int32Array, index: number, epochMs: number) => {
data[index] = Math.floor(epochMs % 4294967296);
data[index + 1] = Math.floor(epochMs / 4294967296);
};
/** @ignore */
export const setEpochMsToMicrosecondsLong = (data: Int32Array, index: number, epochMs: number) => {
data[index] = Math.floor((epochMs * 1000) % 4294967296);
data[index + 1] = Math.floor((epochMs * 1000) / 4294967296);
};
/** @ignore */
export const setEpochMsToNanosecondsLong = (data: Int32Array, index: number, epochMs: number) => {
data[index] = Math.floor((epochMs * 1000000) % 4294967296);
data[index + 1] = Math.floor((epochMs * 1000000) / 4294967296);
};

@@ -165,3 +150,3 @@ /** @ignore */

/** @ignore */
export const setDateMillisecond = <T extends DateMillisecond>({ values }: Data<T>, index: number, value: T['TValue']): void => { setEpochMsToMillisecondsLong(values, index * 2, value.valueOf()); };
export const setDateMillisecond = <T extends DateMillisecond>({ values }: Data<T>, index: number, value: T['TValue']): void => { values[index] = BigInt(value); };
/** @ignore */

@@ -183,9 +168,9 @@ export const setFixedSizeBinary = <T extends FixedSizeBinary>({ stride, values }: Data<T>, index: number, value: T['TValue']): void => { values.set(value.subarray(0, stride), stride * index); };

/** @ignore */
export const setTimestampSecond = <T extends TimestampSecond>({ values }: Data<T>, index: number, value: T['TValue']): void => setEpochMsToMillisecondsLong(values, index * 2, value / 1000);
export const setTimestampSecond = <T extends TimestampSecond>({ values }: Data<T>, index: number, value: T['TValue']): void => { values[index] = BigInt(value / 1000); };
/** @ignore */
export const setTimestampMillisecond = <T extends TimestampMillisecond>({ values }: Data<T>, index: number, value: T['TValue']): void => setEpochMsToMillisecondsLong(values, index * 2, value);
export const setTimestampMillisecond = <T extends TimestampMillisecond>({ values }: Data<T>, index: number, value: T['TValue']): void => { values[index] = BigInt(value); };
/** @ignore */
export const setTimestampMicrosecond = <T extends TimestampMicrosecond>({ values }: Data<T>, index: number, value: T['TValue']): void => setEpochMsToMicrosecondsLong(values, index * 2, value);
export const setTimestampMicrosecond = <T extends TimestampMicrosecond>({ values }: Data<T>, index: number, value: T['TValue']): void => { values[index] = BigInt(value * 1000); };
/** @ignore */
export const setTimestampNanosecond = <T extends TimestampNanosecond>({ values }: Data<T>, index: number, value: T['TValue']): void => setEpochMsToNanosecondsLong(values, index * 2, value);
export const setTimestampNanosecond = <T extends TimestampNanosecond>({ values }: Data<T>, index: number, value: T['TValue']): void => { values[index] = BigInt(value * 1000000); };
/* istanbul ignore next */

@@ -192,0 +177,0 @@ /** @ignore */

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc