@apache-arrow/ts
Advanced tools
Comparing version 3.0.0 to 4.0.0
@@ -20,4 +20,4 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
import { Builder } from './builder/index'; | ||
import { RecordBatchReader } from './ipc/reader'; | ||
import { RecordBatchWriter } from './ipc/writer'; | ||
import { RecordBatchReader, RecordBatchFileReader, RecordBatchStreamReader, } from './ipc/reader'; | ||
import { RecordBatchWriter, RecordBatchFileWriter, RecordBatchStreamWriter, } from './ipc/writer'; | ||
import { toDOMStream } from './io/whatwg/iterable'; | ||
@@ -31,6 +31,10 @@ import { builderThroughDOMStream } from './io/whatwg/builder'; | ||
RecordBatchReader['throughDOM'] = recordBatchReaderThroughDOMStream; | ||
RecordBatchFileReader['throughDOM'] = recordBatchReaderThroughDOMStream; | ||
RecordBatchStreamReader['throughDOM'] = recordBatchReaderThroughDOMStream; | ||
RecordBatchWriter['throughDOM'] = recordBatchWriterThroughDOMStream; | ||
RecordBatchFileWriter['throughDOM'] = recordBatchWriterThroughDOMStream; | ||
RecordBatchStreamWriter['throughDOM'] = recordBatchWriterThroughDOMStream; | ||
export { | ||
ArrowType, DateUnit, IntervalUnit, MessageHeader, MetadataVersion, Precision, TimeUnit, Type, UnionMode, BufferType, | ||
DateUnit, IntervalUnit, MessageHeader, MetadataVersion, Precision, TimeUnit, Type, UnionMode, BufferType, | ||
Data, | ||
@@ -37,0 +41,0 @@ DataType, |
20
Arrow.ts
@@ -18,3 +18,15 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
export { ArrowType, DateUnit, IntervalUnit, MessageHeader, MetadataVersion, Precision, TimeUnit, Type, UnionMode, BufferType } from './enum'; | ||
export { | ||
DateUnit, | ||
TimeUnit, | ||
Precision, | ||
UnionMode, | ||
IntervalUnit, | ||
MetadataVersion, | ||
} from './fb/Schema'; | ||
export { MessageHeader } from './fb/Message'; | ||
export { Type, BufferType } from './enum'; | ||
export { Data } from './data'; | ||
@@ -109,2 +121,3 @@ export { | ||
import * as predicate from './compute/predicate'; | ||
import { compareSchemas, compareFields, compareTypes } from './visitor/typecomparator'; | ||
@@ -119,3 +132,6 @@ export { predicate }; | ||
...util_buffer_, | ||
...util_vector_ | ||
...util_vector_, | ||
compareSchemas, | ||
compareFields, | ||
compareTypes, | ||
}; |
@@ -38,3 +38,3 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
nullValues?: TNull[] | ReadonlyArray<TNull> | null; | ||
children?: { [key: string]: BuilderOptions; } | BuilderOptions[]; | ||
children?: { [key: string]: BuilderOptions } | BuilderOptions[]; | ||
} | ||
@@ -283,8 +283,6 @@ | ||
// @ts-ignore | ||
protected _offsets: DataBufferBuilder<Int32Array>; | ||
protected _offsets!: DataBufferBuilder<Int32Array>; | ||
public get valueOffsets() { return this._offsets ? this._offsets.buffer : null; } | ||
// @ts-ignore | ||
protected _values: BufferBuilder<T['TArray'], any>; | ||
protected _values!: BufferBuilder<T['TArray'], any>; | ||
public get values() { return this._values ? this._values.buffer : null; } | ||
@@ -295,10 +293,7 @@ | ||
// @ts-ignore | ||
protected _typeIds: DataBufferBuilder<Int8Array>; | ||
protected _typeIds!: DataBufferBuilder<Int8Array>; | ||
public get typeIds() { return this._typeIds ? this._typeIds.buffer : null; } | ||
// @ts-ignore | ||
protected _isValid: (value: T['TValue'] | TNull) => boolean; | ||
// @ts-ignore | ||
protected _setValue: (inst: Builder<T>, index: number, value: T['TValue']) => void; | ||
protected _isValid!: (value: T['TValue'] | TNull) => boolean; | ||
protected _setValue!: (inst: Builder<T>, index: number, value: T['TValue']) => void; | ||
@@ -316,3 +311,2 @@ /** | ||
*/ | ||
// @ts-ignore | ||
public isValid(value: T['TValue'] | TNull): boolean { return this._isValid(value); } | ||
@@ -343,3 +337,2 @@ | ||
*/ | ||
// @ts-ignore | ||
public setValue(index: number, value: T['TValue']) { this._setValue(this, index, value); } | ||
@@ -450,3 +443,3 @@ public setValid(index: number, valid: boolean) { | ||
export abstract class VariableWidthBuilder<T extends Binary | Utf8 | List | Map_, TNull = any> extends Builder<T, TNull> { | ||
protected _pendingLength: number = 0; | ||
protected _pendingLength = 0; | ||
protected _offsets: OffsetsBufferBuilder; | ||
@@ -508,3 +501,3 @@ protected _pending: Map<number, any> | undefined; | ||
let numChunks = 0; | ||
let builder = Builder.new(options); | ||
const builder = Builder.new(options); | ||
for (const value of source) { | ||
@@ -531,3 +524,3 @@ if (builder.append(value)[sizeProperty] >= highWaterMark) { | ||
let numChunks = 0; | ||
let builder = Builder.new(options); | ||
const builder = Builder.new(options); | ||
for await (const value of source) { | ||
@@ -534,0 +527,0 @@ if (builder.append(value)[sizeProperty] >= highWaterMark) { |
@@ -95,3 +95,3 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
let columns = this._children || (this._children = []); | ||
const columns = this._children || (this._children = []); | ||
let column: Column<R>, field: Field<R>, chunks: Vector<R>[]; | ||
@@ -98,0 +98,0 @@ |
17
data.ts
@@ -73,10 +73,6 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
// @ts-ignore | ||
public readonly values: Buffers<T>[BufferType.DATA]; | ||
// @ts-ignore | ||
public readonly typeIds: Buffers<T>[BufferType.TYPE]; | ||
// @ts-ignore | ||
public readonly nullBitmap: Buffers<T>[BufferType.VALIDITY]; | ||
// @ts-ignore | ||
public readonly valueOffsets: Buffers<T>[BufferType.OFFSET]; | ||
public readonly values!: Buffers<T>[BufferType.DATA]; | ||
public readonly typeIds!: Buffers<T>[BufferType.TYPE]; | ||
public readonly nullBitmap!: Buffers<T>[BufferType.VALIDITY]; | ||
public readonly valueOffsets!: Buffers<T>[BufferType.OFFSET]; | ||
@@ -90,3 +86,3 @@ public get typeId(): T['TType'] { return this.type.typeId; } | ||
let byteLength = 0; | ||
let { valueOffsets, values, nullBitmap, typeIds } = this; | ||
const { valueOffsets, values, nullBitmap, typeIds } = this; | ||
valueOffsets && (byteLength += valueOffsets.byteLength); | ||
@@ -171,3 +167,4 @@ values && (byteLength += values.byteLength); | ||
protected _sliceBuffers(offset: number, length: number, stride: number, typeId: T['TType']): Buffers<T> { | ||
let arr: any, { buffers } = this; | ||
let arr: any; | ||
const { buffers } = this; | ||
// If typeIds exist, slice the typeIds buffer | ||
@@ -174,0 +171,0 @@ (arr = buffers[BufferType.TYPE]) && (buffers[BufferType.TYPE] = arr.subarray(offset, offset + length)); |
19
enum.ts
@@ -18,13 +18,12 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
import * as Schema_ from './fb/Schema'; | ||
import * as Message_ from './fb/Message'; | ||
export { | ||
DateUnit, | ||
TimeUnit, | ||
Precision, | ||
UnionMode, | ||
IntervalUnit, | ||
MetadataVersion, | ||
} from './fb/Schema'; | ||
export import ArrowType = Schema_.org.apache.arrow.flatbuf.Type; | ||
export import DateUnit = Schema_.org.apache.arrow.flatbuf.DateUnit; | ||
export import TimeUnit = Schema_.org.apache.arrow.flatbuf.TimeUnit; | ||
export import Precision = Schema_.org.apache.arrow.flatbuf.Precision; | ||
export import UnionMode = Schema_.org.apache.arrow.flatbuf.UnionMode; | ||
export import IntervalUnit = Schema_.org.apache.arrow.flatbuf.IntervalUnit; | ||
export import MessageHeader = Message_.org.apache.arrow.flatbuf.MessageHeader; | ||
export import MetadataVersion = Schema_.org.apache.arrow.flatbuf.MetadataVersion; | ||
export { MessageHeader } from './fb/Message'; | ||
@@ -31,0 +30,0 @@ /** |
{ | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"name": "@apache-arrow/ts", | ||
@@ -23,13 +23,13 @@ "browser": "Arrow.dom.ts", | ||
"dependencies": { | ||
"@types/flatbuffers": "^1.9.1", | ||
"@types/node": "^12.0.4", | ||
"@types/flatbuffers": "^1.10.0", | ||
"@types/node": "^14.14.37", | ||
"@types/text-encoding-utf-8": "^1.0.1", | ||
"command-line-args": "5.0.2", | ||
"command-line-usage": "5.0.5", | ||
"flatbuffers": "1.11.0", | ||
"command-line-args": "5.1.1", | ||
"command-line-usage": "6.1.1", | ||
"flatbuffers": "1.12.0", | ||
"json-bignum": "^0.0.3", | ||
"pad-left": "^2.1.0", | ||
"text-encoding-utf-8": "^1.0.2", | ||
"tslib": "^1.12.0" | ||
"tslib": "^2.2.0" | ||
} | ||
} |
@@ -23,4 +23,2 @@ <!--- | ||
[![npm version](https://img.shields.io/npm/v/apache-arrow.svg)](https://www.npmjs.com/package/apache-arrow) | ||
[![Build Status](https://travis-ci.org/apache/arrow.svg?branch=master)](https://travis-ci.org/apache/arrow) | ||
[![Coverage Status](https://coveralls.io/repos/github/apache/arrow/badge.svg)](https://coveralls.io/github/apache/arrow) | ||
@@ -228,3 +226,3 @@ Arrow is a set of technologies that enable big data systems to process and transfer data quickly. | ||
```sh | ||
npm install apache-arrow # <-- combined es5/UMD, es2015/CommonJS/ESModules/UMD, and TypeScript package | ||
npm install apache-arrow # <-- combined es2015/UMD + esnext/CommonJS/ESModules/UMD | ||
npm install @apache-arrow/ts # standalone TypeScript package | ||
@@ -231,0 +229,0 @@ npm install @apache-arrow/es5-cjs # standalone es5/CommonJS package |
@@ -73,3 +73,3 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
let data: Data<Struct<T>>; | ||
let schema = args[0] as Schema<T>; | ||
const schema = args[0] as Schema<T>; | ||
let children: Vector[] | undefined; | ||
@@ -121,3 +121,3 @@ if (args[1] instanceof Data) { | ||
*/ | ||
/* tslint:disable:class-name */ | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
export class _InternalEmptyPlaceholderRecordBatch<T extends { [key: string]: DataType } = any> extends RecordBatch<T> { | ||
@@ -124,0 +124,0 @@ constructor(schema: Schema<T>) { |
@@ -18,31 +18,6 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
import { Data } from './data'; | ||
import { Vector } from './vector'; | ||
import { DataType } from './type'; | ||
import { selectArgs } from './util/args'; | ||
import { selectFieldArgs } from './util/args'; | ||
import { instance as comparer } from './visitor/typecomparator'; | ||
type VectorMap = { [key: string]: Vector }; | ||
type Fields<T extends { [key: string]: DataType }> = (keyof T)[] | Field<T[keyof T]>[]; | ||
type ChildData<T extends { [key: string]: DataType }> = T[keyof T][] | Data<T[keyof T]>[] | Vector<T[keyof T]>[]; | ||
export class Schema<T extends { [key: string]: DataType } = any> { | ||
public static from<T extends { [key: string]: DataType } = any>(children: T): Schema<T>; | ||
public static from<T extends VectorMap = any>(children: T): Schema<{ [P in keyof T]: T[P]['type'] }>; | ||
public static from<T extends { [key: string]: DataType } = any>(children: ChildData<T>, fields?: Fields<T>): Schema<T>; | ||
/** @nocollapse */ | ||
public static from(...args: any[]) { | ||
return Schema.new(args[0], args[1]); | ||
} | ||
public static new<T extends { [key: string]: DataType } = any>(children: T): Schema<T>; | ||
public static new<T extends VectorMap = any>(children: T): Schema<{ [P in keyof T]: T[P]['type'] }>; | ||
public static new<T extends { [key: string]: DataType } = any>(children: ChildData<T>, fields?: Fields<T>): Schema<T>; | ||
/** @nocollapse */ | ||
public static new(...args: any[]) { | ||
return new Schema(selectFieldArgs(args)[0]); | ||
} | ||
public readonly fields: Field<T[keyof T]>[]; | ||
@@ -67,6 +42,2 @@ public readonly metadata: Map<string, string>; | ||
public compareTo(other?: Schema | null): other is Schema<T> { | ||
return comparer.compareSchemas(this, other); | ||
} | ||
public select<K extends keyof T = any>(...columnNames: K[]) { | ||
@@ -84,4 +55,7 @@ const names = columnNames.reduce((xs, x) => (xs[x] = true) && xs, Object.create(null)); | ||
const other = args[0] instanceof Schema ? args[0] as Schema<R> | ||
: new Schema<R>(selectArgs<Field<R[keyof R]>>(Field, args)); | ||
const other = (args[0] instanceof Schema | ||
? args[0] as Schema<R> | ||
: Array.isArray(args[0]) | ||
? new Schema<R>(<Field<R[keyof R]>[]> args[0]) | ||
: new Schema<R>(<Field<R[keyof R]>[]> args)); | ||
@@ -108,3 +82,3 @@ const curFields = [...this.fields] as Field[]; | ||
public static new<T extends DataType = any>(props: { name: string | number, type: T, nullable?: boolean, metadata?: Map<string, string> | null }): Field<T>; | ||
public static new<T extends DataType = any>(props: { name: string | number; type: T; nullable?: boolean; metadata?: Map<string, string> | null }): Field<T>; | ||
public static new<T extends DataType = any>(name: string | number | Field<T>, type: T, nullable?: boolean, metadata?: Map<string, string> | null): Field<T>; | ||
@@ -138,6 +112,3 @@ /** @nocollapse */ | ||
public toString() { return `${this.name}: ${this.type}`; } | ||
public compareTo(other?: Field | null): other is Field<T> { | ||
return comparer.compareField(this, other); | ||
} | ||
public clone<R extends DataType = T>(props: { name?: string | number, type?: R, nullable?: boolean, metadata?: Map<string, string> | null }): Field<R>; | ||
public clone<R extends DataType = T>(props: { name?: string | number; type?: R; nullable?: boolean; metadata?: Map<string, string> | null }): Field<R>; | ||
public clone<R extends DataType = T>(name?: string | number | Field<T>, type?: R, nullable?: boolean, metadata?: Map<string, string> | null): Field<R>; | ||
@@ -144,0 +115,0 @@ public clone<R extends DataType = T>(...args: any[]) { |
10
table.ts
@@ -60,5 +60,5 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
/** @nocollapse */ | ||
public static empty<T extends { [key: string]: DataType } = {}>(schema = new Schema<T>([])) { return new Table<T>(schema, []); } | ||
public static empty<T extends { [key: string]: DataType } = Record<string, never>>(schema = new Schema<T>([])) { return new Table<T>(schema, []); } | ||
public static from(): Table<{}>; | ||
public static from(): Table<Record<string, never>>; | ||
public static from<T extends { [key: string]: DataType } = any>(source: RecordBatchReader<T>): Table<T>; | ||
@@ -80,3 +80,3 @@ public static from<T extends { [key: string]: DataType } = any>(source: import('./ipc/reader').FromArg0): Table<T>; | ||
if (typeof input === 'object') { | ||
let table = isIterable(input['values']) ? tableFromIterable<T, TNull>(input) | ||
const table = isIterable(input['values']) ? tableFromIterable<T, TNull>(input) | ||
: isAsyncIterable(input['values']) ? tableFromAsyncIterable<T, TNull>(input) | ||
@@ -100,3 +100,3 @@ : null; | ||
if (schema) { | ||
for await (let batch of reader) { | ||
for await (const batch of reader) { | ||
batches.push(batch); | ||
@@ -188,3 +188,3 @@ } | ||
let chunks = selectArgs<RecordBatch<T>>(RecordBatch, args); | ||
const chunks = selectArgs<RecordBatch<T>>(RecordBatch, args); | ||
@@ -191,0 +191,0 @@ if (!schema && !(schema = chunks[0] && chunks[0].schema)) { |
95
type.ts
@@ -18,9 +18,8 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
/* tslint:disable:class-name */ | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
import { Field } from './schema'; | ||
import { flatbuffers } from 'flatbuffers'; | ||
import { VectorType as V } from './interfaces'; | ||
import { TypedArrayConstructor } from './interfaces'; | ||
import { VectorType as V, TypeToDataType } from './interfaces'; | ||
import { instance as comparer } from './visitor/typecomparator'; | ||
@@ -44,4 +43,4 @@ import Long = flatbuffers.Long; | ||
& { [P in keyof T]: T[P]['TValue'] | null } | ||
& { get<K extends keyof T>(key: K): T[K]['TValue'] | null; } | ||
& { set<K extends keyof T>(key: K, val: T[K]['TValue'] | null): void; } | ||
& { get<K extends keyof T>(key: K): T[K]['TValue'] | null } | ||
& { set<K extends keyof T>(key: K, val: T[K]['TValue'] | null): void } | ||
; | ||
@@ -69,3 +68,2 @@ | ||
// @ts-ignore | ||
public [Symbol.toStringTag]: string; | ||
@@ -93,5 +91,2 @@ | ||
public get typeId(): TType { return <any> Type.NONE; } | ||
public compareTo(other: DataType): other is TypeToDataType<TType> { | ||
return comparer.visit(this, other); | ||
} | ||
@@ -106,3 +101,3 @@ protected static [Symbol.toStringTag] = ((proto: DataType) => { | ||
/** @ignore */ | ||
export interface Null extends DataType<Type.Null> { TArray: void; TValue: null; } | ||
export interface Null extends DataType<Type.Null> { TArray: void; TValue: null } | ||
/** @ignore */ | ||
@@ -121,15 +116,15 @@ export class Null extends DataType<Type.Null> { | ||
type IType = { | ||
[Type.Int ]: { bitWidth: IntBitWidth; isSigned: true | false; TArray: IntArray; TValue: number | bigint | Int32Array | Uint32Array; }; | ||
[Type.Int8 ]: { bitWidth: 8; isSigned: true; TArray: Int8Array; TValue: number; }; | ||
[Type.Int16 ]: { bitWidth: 16; isSigned: true; TArray: Int16Array; TValue: number; }; | ||
[Type.Int32 ]: { bitWidth: 32; isSigned: true; TArray: Int32Array; TValue: number; }; | ||
[Type.Int64 ]: { bitWidth: 64; isSigned: true; TArray: Int32Array; TValue: bigint | Int32Array | Uint32Array; }; | ||
[Type.Uint8 ]: { bitWidth: 8; isSigned: false; TArray: Uint8Array; TValue: number; }; | ||
[Type.Uint16]: { bitWidth: 16; isSigned: false; TArray: Uint16Array; TValue: number; }; | ||
[Type.Uint32]: { bitWidth: 32; isSigned: false; TArray: Uint32Array; TValue: number; }; | ||
[Type.Uint64]: { bitWidth: 64; isSigned: false; TArray: Uint32Array; TValue: bigint | Int32Array | Uint32Array; }; | ||
[Type.Int ]: { bitWidth: IntBitWidth; isSigned: true | false; TArray: IntArray; TValue: number | bigint | Int32Array | Uint32Array }; | ||
[Type.Int8 ]: { bitWidth: 8; isSigned: true; TArray: Int8Array; TValue: number }; | ||
[Type.Int16 ]: { bitWidth: 16; isSigned: true; TArray: Int16Array; TValue: number }; | ||
[Type.Int32 ]: { bitWidth: 32; isSigned: true; TArray: Int32Array; TValue: number }; | ||
[Type.Int64 ]: { bitWidth: 64; isSigned: true; TArray: Int32Array; TValue: bigint | Int32Array | Uint32Array }; | ||
[Type.Uint8 ]: { bitWidth: 8; isSigned: false; TArray: Uint8Array; TValue: number }; | ||
[Type.Uint16]: { bitWidth: 16; isSigned: false; TArray: Uint16Array; TValue: number }; | ||
[Type.Uint32]: { bitWidth: 32; isSigned: false; TArray: Uint32Array; TValue: number }; | ||
[Type.Uint64]: { bitWidth: 64; isSigned: false; TArray: Uint32Array; TValue: bigint | Int32Array | Uint32Array }; | ||
}; | ||
/** @ignore */ | ||
interface Int_<T extends Ints = Ints> extends DataType<T> { TArray: IType[T]['TArray']; TValue: IType[T]['TValue']; } | ||
interface Int_<T extends Ints = Ints> extends DataType<T> { TArray: IType[T]['TArray']; TValue: IType[T]['TValue'] } | ||
/** @ignore */ | ||
@@ -191,10 +186,10 @@ class Int_<T extends Ints = Ints> extends DataType<T> { | ||
type FType = { | ||
[Type.Float ]: { precision: Precision; TArray: FloatArray; TValue: number; }; | ||
[Type.Float16]: { precision: Precision.HALF; TArray: Uint16Array; TValue: number; }; | ||
[Type.Float32]: { precision: Precision.SINGLE; TArray: Float32Array; TValue: number; }; | ||
[Type.Float64]: { precision: Precision.DOUBLE; TArray: Float64Array; TValue: number; }; | ||
[Type.Float ]: { precision: Precision; TArray: FloatArray; TValue: number }; | ||
[Type.Float16]: { precision: Precision.HALF; TArray: Uint16Array; TValue: number }; | ||
[Type.Float32]: { precision: Precision.SINGLE; TArray: Float32Array; TValue: number }; | ||
[Type.Float64]: { precision: Precision.DOUBLE; TArray: Float64Array; TValue: number }; | ||
}; | ||
/** @ignore */ | ||
export interface Float<T extends Floats = Floats> extends DataType<T> { TArray: FType[T]['TArray']; TValue: number; } | ||
export interface Float<T extends Floats = Floats> extends DataType<T> { TArray: FType[T]['TArray']; TValue: number } | ||
/** @ignore */ | ||
@@ -234,3 +229,3 @@ export class Float<T extends Floats = Floats> extends DataType<T> { | ||
/** @ignore */ | ||
export interface Binary extends DataType<Type.Binary> { TArray: Uint8Array; TValue: Uint8Array; ArrayType: TypedArrayConstructor<Uint8Array>; } | ||
export interface Binary extends DataType<Type.Binary> { TArray: Uint8Array; TValue: Uint8Array; ArrayType: TypedArrayConstructor<Uint8Array> } | ||
/** @ignore */ | ||
@@ -250,3 +245,3 @@ export class Binary extends DataType<Type.Binary> { | ||
/** @ignore */ | ||
export interface Utf8 extends DataType<Type.Utf8> { TArray: Uint8Array; TValue: string; ArrayType: TypedArrayConstructor<Uint8Array>; } | ||
export interface Utf8 extends DataType<Type.Utf8> { TArray: Uint8Array; TValue: string; ArrayType: TypedArrayConstructor<Uint8Array> } | ||
/** @ignore */ | ||
@@ -266,3 +261,3 @@ export class Utf8 extends DataType<Type.Utf8> { | ||
/** @ignore */ | ||
export interface Bool extends DataType<Type.Bool> { TArray: Uint8Array; TValue: boolean; ArrayType: TypedArrayConstructor<Uint8Array>; } | ||
export interface Bool extends DataType<Type.Bool> { TArray: Uint8Array; TValue: boolean; ArrayType: TypedArrayConstructor<Uint8Array> } | ||
/** @ignore */ | ||
@@ -282,3 +277,3 @@ export class Bool extends DataType<Type.Bool> { | ||
/** @ignore */ | ||
export interface Decimal extends DataType<Type.Decimal> { TArray: Uint32Array; TValue: Uint32Array; ArrayType: TypedArrayConstructor<Uint32Array>; } | ||
export interface Decimal extends DataType<Type.Decimal> { TArray: Uint32Array; TValue: Uint32Array; ArrayType: TypedArrayConstructor<Uint32Array> } | ||
/** @ignore */ | ||
@@ -303,3 +298,3 @@ export class Decimal extends DataType<Type.Decimal> { | ||
/** @ignore */ | ||
export interface Date_<T extends Dates = Dates> extends DataType<T> { TArray: Int32Array; TValue: Date; ArrayType: TypedArrayConstructor<Int32Array>; } | ||
export interface Date_<T extends Dates = Dates> extends DataType<T> { TArray: Int32Array; TValue: Date; ArrayType: TypedArrayConstructor<Int32Array> } | ||
/** @ignore */ | ||
@@ -329,10 +324,10 @@ export class Date_<T extends Dates = Dates> extends DataType<T> { | ||
[Type.Time ]: { unit: TimeUnit; TValue: number | Int32Array }; | ||
[Type.TimeSecond ]: { unit: TimeUnit.SECOND; TValue: number; }; | ||
[Type.TimeMillisecond]: { unit: TimeUnit.MILLISECOND; TValue: number; }; | ||
[Type.TimeMicrosecond]: { unit: TimeUnit.MICROSECOND; TValue: Int32Array; }; | ||
[Type.TimeNanosecond ]: { unit: TimeUnit.NANOSECOND; TValue: Int32Array; }; | ||
[Type.TimeSecond ]: { unit: TimeUnit.SECOND; TValue: number }; | ||
[Type.TimeMillisecond]: { unit: TimeUnit.MILLISECOND; TValue: number }; | ||
[Type.TimeMicrosecond]: { unit: TimeUnit.MICROSECOND; TValue: Int32Array }; | ||
[Type.TimeNanosecond ]: { unit: TimeUnit.NANOSECOND; TValue: Int32Array }; | ||
}; | ||
/** @ignore */ | ||
interface Time_<T extends Times = Times> extends DataType<T> { TArray: Int32Array; TValue: TimesType[T]['TValue']; ArrayType: TypedArrayConstructor<Int32Array>; } | ||
interface Time_<T extends Times = Times> extends DataType<T> { TArray: Int32Array; TValue: TimesType[T]['TValue']; ArrayType: TypedArrayConstructor<Int32Array> } | ||
/** @ignore */ | ||
@@ -368,3 +363,3 @@ class Time_<T extends Times = Times> extends DataType<T> { | ||
/** @ignore */ | ||
interface Timestamp_<T extends Timestamps = Timestamps> extends DataType<T> { TArray: Int32Array; TValue: number; ArrayType: TypedArrayConstructor<Int32Array>; } | ||
interface Timestamp_<T extends Timestamps = Timestamps> extends DataType<T> { TArray: Int32Array; TValue: number; ArrayType: TypedArrayConstructor<Int32Array> } | ||
/** @ignore */ | ||
@@ -400,3 +395,3 @@ class Timestamp_<T extends Timestamps = Timestamps> extends DataType<T> { | ||
/** @ignore */ | ||
interface Interval_<T extends Intervals = Intervals> extends DataType<T> { TArray: Int32Array; TValue: Int32Array; ArrayType: TypedArrayConstructor<Int32Array>; } | ||
interface Interval_<T extends Intervals = Intervals> extends DataType<T> { TArray: Int32Array; TValue: Int32Array; ArrayType: TypedArrayConstructor<Int32Array> } | ||
/** @ignore */ | ||
@@ -424,3 +419,3 @@ class Interval_<T extends Intervals = Intervals> extends DataType<T> { | ||
/** @ignore */ | ||
export interface List<T extends DataType = any> extends DataType<Type.List, { [0]: T }> { TArray: IterableArrayLike<T>; TValue: V<T>; } | ||
export interface List<T extends DataType = any> extends DataType<Type.List, { [0]: T }> { TArray: IterableArrayLike<T>; TValue: V<T> } | ||
/** @ignore */ | ||
@@ -445,3 +440,3 @@ export class List<T extends DataType = any> extends DataType<Type.List, { [0]: T }> { | ||
/** @ignore */ | ||
export interface Struct<T extends { [key: string]: DataType } = any> extends DataType<Type.Struct> { TArray: IterableArrayLike<RowLike<T>>; TValue: RowLike<T>; dataTypes: T; } | ||
export interface Struct<T extends { [key: string]: DataType } = any> extends DataType<Type.Struct> { TArray: IterableArrayLike<RowLike<T>>; TValue: RowLike<T>; dataTypes: T } | ||
/** @ignore */ | ||
@@ -465,3 +460,3 @@ export class Struct<T extends { [key: string]: DataType } = any> extends DataType<Type.Struct, T> { | ||
/** @ignore */ | ||
interface Union_<T extends Unions = Unions> extends DataType<T> { TArray: Int8Array; TValue: any; ArrayType: TypedArrayConstructor<Int8Array>; } | ||
interface Union_<T extends Unions = Unions> extends DataType<T> { TArray: Int8Array; TValue: any; ArrayType: TypedArrayConstructor<Int8Array> } | ||
/** @ignore */ | ||
@@ -485,5 +480,7 @@ class Union_<T extends Unions = Unions> extends DataType<T> { | ||
public get typeId() { return Type.Union as T; } | ||
public toString() { return `${this[Symbol.toStringTag]}<${ | ||
public toString() { | ||
return `${this[Symbol.toStringTag]}<${ | ||
this.children.map((x) => `${x.type}`).join(` | `) | ||
}>`; } | ||
}>`; | ||
} | ||
protected static [Symbol.toStringTag] = ((proto: Union_) => { | ||
@@ -516,3 +513,3 @@ (<any> proto).mode = null; | ||
/** @ignore */ | ||
export interface FixedSizeBinary extends DataType<Type.FixedSizeBinary> { TArray: Uint8Array; TValue: Uint8Array; ArrayType: TypedArrayConstructor<Uint8Array>; } | ||
export interface FixedSizeBinary extends DataType<Type.FixedSizeBinary> { TArray: Uint8Array; TValue: Uint8Array; ArrayType: TypedArrayConstructor<Uint8Array> } | ||
/** @ignore */ | ||
@@ -533,3 +530,3 @@ export class FixedSizeBinary extends DataType<Type.FixedSizeBinary> { | ||
/** @ignore */ | ||
export interface FixedSizeList<T extends DataType = any> extends DataType<Type.FixedSizeList> { TArray: IterableArrayLike<T['TArray']>; TValue: V<T>; } | ||
export interface FixedSizeList<T extends DataType = any> extends DataType<Type.FixedSizeList> { TArray: IterableArrayLike<T['TArray']>; TValue: V<T> } | ||
/** @ignore */ | ||
@@ -557,3 +554,3 @@ export class FixedSizeList<T extends DataType = any> extends DataType<Type.FixedSizeList, { [0]: T }> { | ||
TArray: IterableArrayLike<Map<TKey['TValue'], TValue['TValue'] | null>>; | ||
TChild: Struct<{ key: TKey, value: TValue }>; | ||
TChild: Struct<{ key: TKey; value: TValue }>; | ||
TValue: MapLike<TKey, TValue>; | ||
@@ -564,3 +561,3 @@ } | ||
export class Map_<TKey extends DataType = any, TValue extends DataType = any> extends DataType<Type.Map> { | ||
constructor(child: Field<Struct<{ key: TKey, value: TValue }>>, keysSorted = false) { | ||
constructor(child: Field<Struct<{ key: TKey; value: TValue }>>, keysSorted = false) { | ||
super(); | ||
@@ -571,3 +568,3 @@ this.children = [child]; | ||
public readonly keysSorted: boolean; | ||
public readonly children: Field<Struct<{ key: TKey, value: TValue }>>[]; | ||
public readonly children: Field<Struct<{ key: TKey; value: TValue }>>[]; | ||
public get typeId() { return Type.Map as Type.Map; } | ||
@@ -591,3 +588,3 @@ public get keyType(): TKey { return this.children[0].type.children[0].type as TKey; } | ||
/** @ignore */ | ||
export interface Dictionary<T extends DataType = any, TKey extends TKeys = TKeys> extends DataType<Type.Dictionary> { TArray: TKey['TArray']; TValue: T['TValue']; } | ||
export interface Dictionary<T extends DataType = any, TKey extends TKeys = TKeys> extends DataType<Type.Dictionary> { TArray: TKey['TArray']; TValue: T['TValue'] } | ||
/** @ignore */ | ||
@@ -629,3 +626,3 @@ export class Dictionary<T extends DataType = any, TKey extends TKeys = TKeys> extends DataType<Type.Dictionary> { | ||
export function strideForType(type: DataType) { | ||
let t: any = type; | ||
const t: any = type; | ||
switch (type.typeId) { | ||
@@ -632,0 +629,0 @@ case Type.Decimal: return 4; |
@@ -57,7 +57,6 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
let dtype: T['TType'] = Type.NONE; | ||
// tslint:disable | ||
if (node instanceof Data ) { dtype = inferDType(node.type as T); } | ||
else if (node instanceof Vector ) { dtype = inferDType(node.type as T); } | ||
else if (node instanceof DataType) { dtype = inferDType(node as T); } | ||
else if (typeof (dtype = node) !== 'number') { dtype = Type[node] as any as T['TType']; } | ||
if (node instanceof Data ) dtype = inferDType(node.type as T); | ||
else if (node instanceof Vector ) dtype = inferDType(node.type as T); | ||
else if (node instanceof DataType) dtype = inferDType(node as T); | ||
else if (typeof (dtype = node) !== 'number') dtype = Type[node] as any as T['TType']; | ||
@@ -118,3 +117,3 @@ switch (dtype) { | ||
case Type.Null: return Type.Null; | ||
case Type.Int: | ||
case Type.Int: { | ||
const { bitWidth, isSigned } = (type as any as Int); | ||
@@ -129,2 +128,3 @@ switch (bitWidth) { | ||
return Type.Int; | ||
} | ||
case Type.Float: | ||
@@ -131,0 +131,0 @@ switch((type as any as Float).precision) { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
974176
113
17651
280
1
+ Added@types/node@14.18.63(transitive)
+ Addedarray-back@3.1.04.0.2(transitive)
+ Addedcommand-line-args@5.1.1(transitive)
+ Addedcommand-line-usage@6.1.1(transitive)
+ Addedfind-replace@3.0.0(transitive)
+ Addedflatbuffers@1.12.0(transitive)
+ Addedreduce-flatten@2.0.0(transitive)
+ Addedtable-layout@1.0.2(transitive)
+ Addedtslib@2.8.1(transitive)
+ Addedtypical@4.0.05.2.0(transitive)
+ Addedwordwrapjs@4.0.1(transitive)
- Removed@types/node@12.20.55(transitive)
- Removedargv-tools@0.1.2(transitive)
- Removedarray-back@2.0.0(transitive)
- Removedcommand-line-args@5.0.2(transitive)
- Removedcommand-line-usage@5.0.5(transitive)
- Removedfind-replace@2.0.1(transitive)
- Removedflatbuffers@1.11.0(transitive)
- Removedlodash.padend@4.6.1(transitive)
- Removedreduce-flatten@1.0.1(transitive)
- Removedtable-layout@0.4.5(transitive)
- Removedtest-value@3.0.0(transitive)
- Removedtslib@1.14.1(transitive)
- Removedtypical@2.6.1(transitive)
- Removedwordwrapjs@3.0.0(transitive)
Updated@types/flatbuffers@^1.10.0
Updated@types/node@^14.14.37
Updatedcommand-line-args@5.1.1
Updatedcommand-line-usage@6.1.1
Updatedflatbuffers@1.12.0
Updatedtslib@^2.2.0