Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@apache-arrow/esnext-esm

Package Overview
Dependencies
Maintainers
7
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apache-arrow/esnext-esm - npm Package Compare versions

Comparing version 15.0.2 to 16.0.0

5

Arrow.d.ts

@@ -126,6 +126,7 @@ export { MessageHeader } from './fb/message-header.js';

Int128: typeof util_int_.Int128;
bigNumToNumber<T_8 extends util_bn_.BN<(Int8Array | Int16Array | Int32Array) | (Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array)>>(bn: T_8, scale?: number | undefined): number;
bigNumToString<T_9 extends util_bn_.BN<(Int8Array | Int16Array | Int32Array) | (Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array)>>(a: T_9): string;
bigNumToBigInt<T_10 extends util_bn_.BN<(Int8Array | Int16Array | Int32Array) | (Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array)>>(a: T_10): bigint;
isArrowBigNumSymbol: typeof util_bn_.isArrowBigNumSymbol;
bigNumToString: <T_8 extends util_bn_.BN<(Int8Array | Int16Array | Int32Array) | (Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array)>>(a: T_8) => string;
bigNumToBigInt: <T_9 extends util_bn_.BN<(Int8Array | Int16Array | Int32Array) | (Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array)>>(a: T_9) => bigint;
BN: typeof util_bn_.BN;
};

14

data.js

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

if (nullCount <= kUnknownNullCount && (nullBitmap = this.nullBitmap)) {
this._nullCount = nullCount = this.length - popcnt_bit_range(nullBitmap, this.offset, this.offset + this.length);
this._nullCount = nullCount = nullBitmap.length === 0 ?
// no null bitmap, so all values are valid
0 :
this.length - popcnt_bit_range(nullBitmap, this.offset, this.offset + this.length);
}

@@ -128,10 +131,11 @@ return nullCount;

nullBitmap.set(truncateBitmap(offset, length, this.nullBitmap), 0);
Object.assign(this, { nullBitmap });
}
Object.assign(this, { nullBitmap, _nullCount: -1 });
else {
Object.assign(this, { nullBitmap, _nullCount: 0 });
}
}
const byte = nullBitmap[byteOffset];
prev = (byte & mask) !== 0;
value ?
(nullBitmap[byteOffset] = byte | mask) :
(nullBitmap[byteOffset] = byte & ~mask);
nullBitmap[byteOffset] = value ? (byte | mask) : (byte & ~mask);
}

@@ -138,0 +142,0 @@ if (prev !== !!value) {

@@ -24,3 +24,3 @@ import * as dtypes from './type.js';

export declare function vectorFromArray<T extends dtypes.Utf8 | dtypes.Dictionary<dtypes.Utf8> = dtypes.Dictionary<dtypes.Utf8, dtypes.Int32>>(values: readonly (null | undefined | string)[], type?: T): Vector<T>;
export declare function vectorFromArray<T extends dtypes.Date_>(values: readonly (null | undefined | Date)[], type?: T): Vector<T>;
export declare function vectorFromArray<T extends dtypes.TimestampMillisecond>(values: readonly (null | undefined | Date)[], type?: T): Vector<T>;
export declare function vectorFromArray<T extends dtypes.Int>(values: readonly (null | undefined | number)[], type: T): Vector<T>;

@@ -27,0 +27,0 @@ export declare function vectorFromArray<T extends dtypes.Int64 | dtypes.Uint64 = dtypes.Int64>(values: readonly (null | undefined | bigint)[], type?: T): Vector<T>;

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

else if (datesCount + nullsCount === value.length) {
return new dtypes.DateMillisecond;
return new dtypes.TimestampMillisecond;
}

@@ -124,0 +124,0 @@ else if (arraysCount + nullsCount === value.length) {

{
"version": "15.0.2",
"version": "16.0.0",
"name": "@apache-arrow/esnext-esm",

@@ -4,0 +4,0 @@ "browser": "Arrow.dom.js",

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

if (nullCount <= kUnknownNullCount && (nullBitmap = this.nullBitmap)) {
this._nullCount = nullCount = this.length - popcnt_bit_range(nullBitmap, this.offset, this.offset + this.length);
this._nullCount = nullCount = nullBitmap.length === 0 ?
// no null bitmap, so all values are valid
0 :
this.length - popcnt_bit_range(nullBitmap, this.offset, this.offset + this.length);
}

@@ -181,4 +184,6 @@ return nullCount;

nullBitmap.set(truncateBitmap(offset, length, this.nullBitmap), 0);
Object.assign(this, { nullBitmap });
} else {
Object.assign(this, { nullBitmap, _nullCount: 0 });
}
Object.assign(this, { nullBitmap, _nullCount: -1 });
}

@@ -189,5 +194,3 @@

prev = (byte & mask) !== 0;
value ?
(nullBitmap[byteOffset] = byte | mask) :
(nullBitmap[byteOffset] = byte & ~mask);
nullBitmap[byteOffset] = value ? (byte | mask) : (byte & ~mask);
}

@@ -194,0 +197,0 @@

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

export function vectorFromArray<T extends dtypes.Utf8 | dtypes.Dictionary<dtypes.Utf8> = dtypes.Dictionary<dtypes.Utf8, dtypes.Int32>>(values: readonly (null | undefined | string)[], type?: T): Vector<T>;
export function vectorFromArray<T extends dtypes.Date_>(values: readonly (null | undefined | Date)[], type?: T): Vector<T>;
export function vectorFromArray<T extends dtypes.TimestampMillisecond>(values: readonly (null | undefined | Date)[], type?: T): Vector<T>;
export function vectorFromArray<T extends dtypes.Int>(values: readonly (null | undefined | number)[], type: T): Vector<T>;

@@ -149,3 +149,3 @@ export function vectorFromArray<T extends dtypes.Int64 | dtypes.Uint64 = dtypes.Int64>(values: readonly (null | undefined | bigint)[], type?: T): Vector<T>;

} else if (datesCount + nullsCount === value.length) {
return new dtypes.DateMillisecond;
return new dtypes.TimestampMillisecond;
} else if (arraysCount + nullsCount === value.length) {

@@ -152,0 +152,0 @@ const array = value as Array<unknown>[];

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

export class DateDay extends Date_<Type.DateDay> { constructor() { super(DateUnit.DAY); } }
/** @ignore */
/**
* A signed 64-bit date representing the elapsed time since UNIX epoch (1970-01-01) in milliseconds.
* According to the specification, this should be treated as the number of days, in milliseconds, since the UNIX epoch.
* Therefore, values must be evenly divisible by `86_400_000` (the number of milliseconds in a standard day).
*
* Practically, validation that values of this type are evenly divisible by `86_400_000` is not enforced by this library
* for performance and usability reasons.
*
* Users should prefer to use {@link DateDay} to cleanly represent the number of days. For JS dates,
* {@link TimestampMillisecond} is the preferred type.
*
* @ignore
*/
export class DateMillisecond extends Date_<Type.DateMillisecond> { constructor() { super(DateUnit.MILLISECOND); } }

@@ -355,0 +367,0 @@

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

import { BigIntArray, BigIntArrayConstructor } from '../interfaces.js';
import { bigIntToNumber } from './bigint.js';

@@ -40,3 +41,3 @@ /** @ignore */

BigNum.prototype.toJSON = function <T extends BN<BigNumArray>>(this: T) { return `"${bigNumToString(this)}"`; };
BigNum.prototype.valueOf = function <T extends BN<BigNumArray>>(this: T) { return bigNumToNumber(this); };
BigNum.prototype.valueOf = function <T extends BN<BigNumArray>>(this: T, scale?: number) { return bigNumToNumber(this, scale); };
BigNum.prototype.toString = function <T extends BN<BigNumArray>>(this: T) { return bigNumToString(this); };

@@ -73,24 +74,35 @@ BigNum.prototype[Symbol.toPrimitive] = function <T extends BN<BigNumArray>>(this: T, hint: 'string' | 'number' | 'default' = 'default') {

//FOR ES2020 COMPATIBILITY
const TWO_TO_THE_64 = BigInt(4294967296) * BigInt(4294967296); // 2^64 = 0x10000000000000000n
const TWO_TO_THE_64_MINUS_1 = TWO_TO_THE_64 - BigInt(1); // (2^32 * 2^32) - 1 = 0xFFFFFFFFFFFFFFFFn
/** @ignore */
function bigNumToNumber<T extends BN<BigNumArray>>(bn: T) {
const { buffer, byteOffset, length, 'signed': signed } = bn;
const words = new BigUint64Array(buffer, byteOffset, length);
export function bigNumToNumber<T extends BN<BigNumArray>>(bn: T, scale?: number) {
const { buffer, byteOffset, byteLength, 'signed': signed } = bn;
const words = new BigUint64Array(buffer, byteOffset, byteLength / 8);
const negative = signed && words.at(-1)! & (BigInt(1) << BigInt(63));
let number = negative ? BigInt(1) : BigInt(0);
let i = BigInt(0);
if (!negative) {
let number = BigInt(0);
let i = 0;
if (negative) {
for (const word of words) {
number += word * (BigInt(1) << (BigInt(32) * i++));
number |= (word ^ TWO_TO_THE_64_MINUS_1) * (BigInt(1) << BigInt(64 * i++));
}
number *= BigInt(-1);
number -= BigInt(1);
} else {
for (const word of words) {
number += ~word * (BigInt(1) << (BigInt(32) * i++));
number |= word * (BigInt(1) << BigInt(64 * i++));
}
number *= BigInt(-1);
}
return number;
if (typeof scale === 'number') {
const denominator = BigInt(Math.pow(10, scale));
const quotient = number / denominator;
const remainder = number % denominator;
return bigIntToNumber(quotient) + (bigIntToNumber(remainder) / bigIntToNumber(denominator));
}
return bigIntToNumber(number);
}
/** @ignore */
export const bigNumToString: { <T extends BN<BigNumArray>>(a: T): string } = (<T extends BN<BigNumArray>>(a: T) => {
export function bigNumToString<T extends BN<BigNumArray>>(a: T): string {
// use BigInt native implementation

@@ -127,6 +139,6 @@ if (a.byteLength === 8) {

return `-${negated}`;
});
}
/** @ignore */
export const bigNumToBigInt: { <T extends BN<BigNumArray>>(a: T): bigint } = (<T extends BN<BigNumArray>>(a: T) => {
export function bigNumToBigInt<T extends BN<BigNumArray>>(a: T): bigint {
if (a.byteLength === 8) {

@@ -138,3 +150,3 @@ const bigIntArray = new a['BigIntArray'](a.buffer, a.byteOffset, 1);

}
});
}

@@ -225,3 +237,3 @@ /** @ignore */

*/
valueOf(): number;
valueOf(scale?: number): number;
/**

@@ -228,0 +240,0 @@ * Return the JSON representation of the bytes. Must be wrapped in double-quotes,

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

}
const props = { offset: 0, length: init.length, nullCount: 0, data: init };
const props = { offset: 0, length: init.length, nullCount: -1, data: init };
if (init instanceof Int8Array) { return new Vector([makeData({ ...props, type: new dtypes.Int8 })]); }

@@ -451,0 +451,0 @@ if (init instanceof Int16Array) { return new Vector([makeData({ ...props, type: new dtypes.Int16 })]); }

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

/** @ignore */
export const setEpochMsToDays = (data: Int32Array, index: number, epochMs: number) => { data[index] = Math.trunc(epochMs / 86400000); };
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.trunc(epochMs % 4294967296);
data[index + 1] = Math.trunc(epochMs / 4294967296);
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.trunc((epochMs * 1000) % 4294967296);
data[index + 1] = Math.trunc((epochMs * 1000) / 4294967296);
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.trunc((epochMs * 1000000) % 4294967296);
data[index + 1] = Math.trunc((epochMs * 1000000) / 4294967296);
data[index] = Math.floor((epochMs * 1000000) % 4294967296);
data[index + 1] = Math.floor((epochMs * 1000000) / 4294967296);
};

@@ -128,0 +128,0 @@

@@ -336,3 +336,15 @@ import { Field } from './schema.js';

}
/** @ignore */
/**
* A signed 64-bit date representing the elapsed time since UNIX epoch (1970-01-01) in milliseconds.
* According to the specification, this should be treated as the number of days, in milliseconds, since the UNIX epoch.
* Therefore, values must be evenly divisible by `86_400_000` (the number of milliseconds in a standard day).
*
* Practically, validation that values of this type are evenly divisible by `86_400_000` is not enforced by this library
* for performance and usability reasons.
*
* Users should prefer to use {@link DateDay} to cleanly represent the number of days. For JS dates,
* {@link TimestampMillisecond} is the preferred type.
*
* @ignore
*/
export declare class DateMillisecond extends Date_<Type.DateMillisecond> {

@@ -339,0 +351,0 @@ constructor();

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

}
/** @ignore */
/**
* A signed 64-bit date representing the elapsed time since UNIX epoch (1970-01-01) in milliseconds.
* According to the specification, this should be treated as the number of days, in milliseconds, since the UNIX epoch.
* Therefore, values must be evenly divisible by `86_400_000` (the number of milliseconds in a standard day).
*
* Practically, validation that values of this type are evenly divisible by `86_400_000` is not enforced by this library
* for performance and usability reasons.
*
* Users should prefer to use {@link DateDay} to cleanly represent the number of days. For JS dates,
* {@link TimestampMillisecond} is the preferred type.
*
* @ignore
*/
export class DateMillisecond extends Date_ {

@@ -273,0 +285,0 @@ constructor() { super(DateUnit.MILLISECOND); }

@@ -10,10 +10,8 @@ import { ArrayBufferViewInput } from './buffer.js';

/** @ignore */
export declare const bigNumToString: {
<T extends BN<BigNumArray>>(a: T): string;
};
export declare function bigNumToNumber<T extends BN<BigNumArray>>(bn: T, scale?: number): number;
/** @ignore */
export declare const bigNumToBigInt: {
<T extends BN<BigNumArray>>(a: T): bigint;
};
export declare function bigNumToString<T extends BN<BigNumArray>>(a: T): string;
/** @ignore */
export declare function bigNumToBigInt<T extends BN<BigNumArray>>(a: T): bigint;
/** @ignore */
export declare class BN<T extends BigNumArray> {

@@ -46,3 +44,3 @@ /** @nocollapse */

*/
valueOf(): number;
valueOf(scale?: number): number;
/**

@@ -49,0 +47,0 @@ * Return the JSON representation of the bytes. Must be wrapped in double-quotes,

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

import { toArrayBufferView } from './buffer.js';
import { bigIntToNumber } from './bigint.js';
/** @ignore */

@@ -30,3 +31,3 @@ export const isArrowBigNumSymbol = Symbol.for('isArrowBigNum');

BigNum.prototype.toJSON = function () { return `"${bigNumToString(this)}"`; };
BigNum.prototype.valueOf = function () { return bigNumToNumber(this); };
BigNum.prototype.valueOf = function (scale) { return bigNumToNumber(this, scale); };
BigNum.prototype.toString = function () { return bigNumToString(this); };

@@ -54,24 +55,34 @@ BigNum.prototype[Symbol.toPrimitive] = function (hint = 'default') {

Object.assign(DecimalBigNum.prototype, BigNum.prototype, { 'constructor': DecimalBigNum, 'signed': true, 'TypedArray': Uint32Array, 'BigIntArray': BigUint64Array });
//FOR ES2020 COMPATIBILITY
const TWO_TO_THE_64 = BigInt(4294967296) * BigInt(4294967296); // 2^64 = 0x10000000000000000n
const TWO_TO_THE_64_MINUS_1 = TWO_TO_THE_64 - BigInt(1); // (2^32 * 2^32) - 1 = 0xFFFFFFFFFFFFFFFFn
/** @ignore */
function bigNumToNumber(bn) {
const { buffer, byteOffset, length, 'signed': signed } = bn;
const words = new BigUint64Array(buffer, byteOffset, length);
export function bigNumToNumber(bn, scale) {
const { buffer, byteOffset, byteLength, 'signed': signed } = bn;
const words = new BigUint64Array(buffer, byteOffset, byteLength / 8);
const negative = signed && words.at(-1) & (BigInt(1) << BigInt(63));
let number = negative ? BigInt(1) : BigInt(0);
let i = BigInt(0);
if (!negative) {
let number = BigInt(0);
let i = 0;
if (negative) {
for (const word of words) {
number += word * (BigInt(1) << (BigInt(32) * i++));
number |= (word ^ TWO_TO_THE_64_MINUS_1) * (BigInt(1) << BigInt(64 * i++));
}
number *= BigInt(-1);
number -= BigInt(1);
}
else {
for (const word of words) {
number += ~word * (BigInt(1) << (BigInt(32) * i++));
number |= word * (BigInt(1) << BigInt(64 * i++));
}
number *= BigInt(-1);
}
return number;
if (typeof scale === 'number') {
const denominator = BigInt(Math.pow(10, scale));
const quotient = number / denominator;
const remainder = number % denominator;
return bigIntToNumber(quotient) + (bigIntToNumber(remainder) / bigIntToNumber(denominator));
}
return bigIntToNumber(number);
}
/** @ignore */
export const bigNumToString = ((a) => {
export function bigNumToString(a) {
// use BigInt native implementation

@@ -103,5 +114,5 @@ if (a.byteLength === 8) {

return `-${negated}`;
});
}
/** @ignore */
export const bigNumToBigInt = ((a) => {
export function bigNumToBigInt(a) {
if (a.byteLength === 8) {

@@ -114,3 +125,3 @@ const bigIntArray = new a['BigIntArray'](a.buffer, a.byteOffset, 1);

}
});
}
/** @ignore */

@@ -117,0 +128,0 @@ function unsignedBigNumToString(a) {

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

}
const props = { offset: 0, length: init.length, nullCount: 0, data: init };
const props = { offset: 0, length: init.length, nullCount: -1, data: init };
if (init instanceof Int8Array) {

@@ -342,0 +342,0 @@ return new Vector([makeData({ ...props, type: new dtypes.Int8 })]);

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

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

@@ -52,0 +52,0 @@ /** @ignore */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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