@apache-arrow/ts
Advanced tools
Comparing version 0.3.0 to 0.3.1
27
Arrow.ts
@@ -21,3 +21,4 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
import * as vector_ from './vector'; | ||
import * as util_ from './util/int'; | ||
import * as util_int_ from './util/int'; | ||
import * as util_bit_ from './util/bit'; | ||
import * as visitor_ from './visitor'; | ||
@@ -44,5 +45,6 @@ import * as view_ from './vector/view'; | ||
export namespace util { | ||
export import Uint64 = util_.Uint64; | ||
export import Int64 = util_.Int64; | ||
export import Int128 = util_.Int128; | ||
export import Uint64 = util_int_.Uint64; | ||
export import Int64 = util_int_.Int64; | ||
export import Int128 = util_int_.Int128; | ||
export import packBools = util_bit_.packBools; | ||
} | ||
@@ -178,2 +180,3 @@ | ||
export import And = predicate_.And; | ||
export import Not = predicate_.Not; | ||
export import GTeq = predicate_.GTeq; | ||
@@ -228,12 +231,12 @@ export import LTeq = predicate_.LTeq; | ||
util_.Uint64['add'] = util_.Uint64.add; | ||
util_.Uint64['multiply'] = util_.Uint64.multiply; | ||
util_int_.Uint64['add'] = util_int_.Uint64.add; | ||
util_int_.Uint64['multiply'] = util_int_.Uint64.multiply; | ||
util_.Int64['add'] = util_.Int64.add; | ||
util_.Int64['multiply'] = util_.Int64.multiply; | ||
util_.Int64['fromString'] = util_.Int64.fromString; | ||
util_int_.Int64['add'] = util_int_.Int64.add; | ||
util_int_.Int64['multiply'] = util_int_.Int64.multiply; | ||
util_int_.Int64['fromString'] = util_int_.Int64.fromString; | ||
util_.Int128['add'] = util_.Int128.add; | ||
util_.Int128['multiply'] = util_.Int128.multiply; | ||
util_.Int128['fromString'] = util_.Int128.fromString; | ||
util_int_.Int128['add'] = util_int_.Int128.add; | ||
util_int_.Int128['multiply'] = util_int_.Int128.multiply; | ||
util_int_.Int128['fromString'] = util_int_.Int128.fromString; | ||
@@ -240,0 +243,0 @@ data_.ChunkedData['computeOffsets'] = data_.ChunkedData.computeOffsets; |
@@ -87,3 +87,2 @@ #! /usr/bin/env node | ||
files.forEach((source) => { | ||
debugger; | ||
let table: Arrow.Table, input = fs.readFileSync(source); | ||
@@ -93,3 +92,2 @@ try { | ||
} catch (e) { | ||
debugger; | ||
table = Arrow.Table.from(parse(input + '')); | ||
@@ -96,0 +94,0 @@ } |
20
data.ts
@@ -151,12 +151,12 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
protected _dictionary: Vector<T>; | ||
protected _indicies: Data<Int<any>>; | ||
public get indicies() { return this._indicies; } | ||
protected _indices: Data<Int<any>>; | ||
public get indices() { return this._indices; } | ||
public get dictionary() { return this._dictionary; } | ||
constructor(type: Dictionary<T>, dictionary: Vector<T>, indicies: Data<Int<any>>) { | ||
super(type, indicies.length, (indicies as any)._nullCount); | ||
this._indicies = indicies; | ||
constructor(type: Dictionary<T>, dictionary: Vector<T>, indices: Data<Int<any>>) { | ||
super(type, indices.length, indices.offset, (indices as any)._nullCount); | ||
this._indices = indices; | ||
this._dictionary = dictionary; | ||
this.length = this._indicies.length; | ||
} | ||
public get nullCount() { return this._indicies.nullCount; } | ||
public get nullCount() { return this._indices.nullCount; } | ||
public get nullBitmap() { return this._indices.nullBitmap; } | ||
public clone<R extends Dictionary<T>>(type: R, length = this.length, offset = this.offset) { | ||
@@ -167,8 +167,8 @@ const data = this._dictionary.data.clone(type.dictionary as any); | ||
this._dictionary.clone(data) as any, | ||
this._indicies.slice(offset - this.offset, length) | ||
this._indices.slice(offset - this.offset, length) | ||
) as any; | ||
} | ||
protected sliceInternal(clone: this, _offset: number, _length: number) { | ||
clone.length = clone._indicies.length; | ||
clone._nullCount = (clone._indicies as any)._nullCount; | ||
clone.length = clone._indices.length; | ||
clone._nullCount = (clone._indices as any)._nullCount; | ||
return clone; | ||
@@ -175,0 +175,0 @@ } |
@@ -52,3 +52,3 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
const bb = toByteBuffer(source); | ||
if ((!schema && ({ schema, readMessages } = readSchema(bb))) && schema && readMessages) { | ||
if ((!schema && ({ schema, readMessages } = readSchema(bb)) || true) && schema && readMessages) { | ||
for (const message of readMessages(bb)) { | ||
@@ -75,3 +75,3 @@ yield { | ||
const bb = toByteBuffer(source); | ||
if ((!schema && ({ schema, readMessages } = readSchema(bb))) && schema && readMessages) { | ||
if ((!schema && ({ schema, readMessages } = readSchema(bb)) || true) && schema && readMessages) { | ||
for (const message of readMessages(bb)) { | ||
@@ -78,0 +78,0 @@ yield { |
@@ -95,3 +95,3 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
public visitDictionary (type: Dictionary) { | ||
return new DictionaryData(type, this.dictionaries.get(type.id)!, this.visit(type.indicies)); | ||
return new DictionaryData(type, this.dictionaries.get(type.id)!, this.visit(type.indices)); | ||
} | ||
@@ -98,0 +98,0 @@ protected getFieldMetadata() { return this.nodes.next().value; } |
{ | ||
"name": "@apache-arrow/ts", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"main": "Arrow.ts", | ||
@@ -5,0 +5,0 @@ "types": "Arrow.ts", |
@@ -29,10 +29,19 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
} | ||
lteq(other: Value<T> | T): Predicate { | ||
le(other: Value<T> | T): Predicate { | ||
if (!(other instanceof Value)) { other = new Literal(other); } | ||
return new LTeq(this, other); | ||
} | ||
gteq(other: Value<T> | T): Predicate { | ||
ge(other: Value<T> | T): Predicate { | ||
if (!(other instanceof Value)) { other = new Literal(other); } | ||
return new GTeq(this, other); | ||
} | ||
lt(other: Value<T> | T): Predicate { | ||
return new Not(this.ge(other)); | ||
} | ||
gt(other: Value<T> | T): Predicate { | ||
return new Not(this.le(other)); | ||
} | ||
ne(other: Value<T> | T): Predicate { | ||
return new Not(this.eq(other)); | ||
} | ||
} | ||
@@ -74,2 +83,3 @@ | ||
or(expr: Predicate): Predicate { return new Or(this, expr); } | ||
not(): Predicate { return new Not(this); } | ||
ands(): Predicate[] { return [this]; } | ||
@@ -227,2 +237,13 @@ } | ||
export class Not extends Predicate { | ||
constructor(public readonly child: Predicate) { | ||
super(); | ||
} | ||
bind(batch: RecordBatch) { | ||
const func = this.child.bind(batch); | ||
return (idx: number, batch: RecordBatch) => !func(idx, batch); | ||
} | ||
} | ||
export class CustomPredicate extends Predicate { | ||
@@ -229,0 +250,0 @@ constructor(private next: PredicateFunc, private bind_: (batch: RecordBatch) => void) { |
@@ -189,3 +189,3 @@ <!--- | ||
npm install @apache-arrow/es2015-umd # standalone es2015/UMD package | ||
npm install @apache-arrow/esnext-esm # standalone esNext/CommonJS package | ||
npm install @apache-arrow/esnext-cjs # standalone esNext/CommonJS package | ||
npm install @apache-arrow/esnext-esm # standalone esNext/ESModules package | ||
@@ -216,2 +216,3 @@ npm install @apache-arrow/esnext-umd # standalone esNext/UMD package | ||
* [rxjs-mapd](https://github.com/graphistry/rxjs-mapd) -- A MapD Core node-driver that returns query results as Arrow columns | ||
* [Perspective](https://github.com/jpmorganchase/perspective) -- Perspective is a streaming data visualization engine by J.P. Morgan for JavaScript for building real-time & user-configurable analytics entirely in the browser. | ||
@@ -218,0 +219,0 @@ ## Companies & Organizations |
@@ -163,3 +163,3 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
count_by.bind(batch); | ||
const keys = (count_by.vector as DictionaryVector).indicies; | ||
const keys = (count_by.vector as DictionaryVector).indices; | ||
// yield all indices | ||
@@ -262,3 +262,3 @@ for (let index = -1, numRows = batch.length; ++index < numRows;) { | ||
count_by.bind(batch); | ||
const keys = (count_by.vector as DictionaryVector).indicies; | ||
const keys = (count_by.vector as DictionaryVector).indices; | ||
// yield all indices | ||
@@ -265,0 +265,0 @@ for (let index = -1, numRows = batch.length; ++index < numRows;) { |
12
type.ts
@@ -86,4 +86,4 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
public get [Symbol.toStringTag](): string { return 'Field'; } | ||
public get indicies(): T | Int<any> { | ||
return DataType.isDictionary(this.type) ? this.type.indicies : this.type; | ||
public get indices(): T | Int<any> { | ||
return DataType.isDictionary(this.type) ? this.type.indices : this.type; | ||
} | ||
@@ -447,7 +447,7 @@ } | ||
public readonly dictionary: T; | ||
public readonly indicies: Int<any>; | ||
public readonly indices: Int<any>; | ||
public readonly isOrdered: boolean; | ||
constructor(dictionary: T, indicies: Int<any>, id?: Long | number | null, isOrdered?: boolean | null) { | ||
constructor(dictionary: T, indices: Int<any>, id?: Long | number | null, isOrdered?: boolean | null) { | ||
super(Type.Dictionary); | ||
this.indicies = indicies; | ||
this.indices = indices; | ||
this.dictionary = dictionary; | ||
@@ -458,3 +458,3 @@ this.isOrdered = isOrdered || false; | ||
public get ArrayType() { return this.dictionary.ArrayType; } | ||
public toString() { return `Dictionary<${this.indicies}, ${this.dictionary}>`; } | ||
public toString() { return `Dictionary<${this.indices}, ${this.dictionary}>`; } | ||
protected static [Symbol.toStringTag] = ((proto: Dictionary) => { | ||
@@ -461,0 +461,0 @@ return proto[Symbol.toStringTag] = 'Dictionary'; |
@@ -397,9 +397,12 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
// @ts-ignore | ||
public readonly indicies: Vector<Int>; | ||
public readonly indices: Vector<Int>; | ||
// @ts-ignore | ||
public readonly dictionary: Vector<T>; | ||
constructor(data: Data<Dictionary<T>>, view: View<Dictionary<T>> = new DictionaryView<T>(data.dictionary, new IntVector(data.indicies))) { | ||
constructor(data: Data<Dictionary<T>>, view: View<Dictionary<T>> = new DictionaryView<T>(data.dictionary, new IntVector(data.indices))) { | ||
super(data as Data<any>, view); | ||
if (view instanceof ValidityView) { | ||
view = (view as any).view; | ||
} | ||
if (data instanceof DictionaryData && view instanceof DictionaryView) { | ||
this.indicies = view.indicies; | ||
this.indices = view.indices; | ||
this.dictionary = data.dictionary; | ||
@@ -411,5 +414,5 @@ } else if (data instanceof ChunkedData && view instanceof ChunkedView) { | ||
this.dictionary = chunks[chunks.length - 1].dictionary; | ||
this.indicies = chunks.reduce<Vector<Int> | null>( | ||
this.indices = chunks.reduce<Vector<Int> | null>( | ||
(idxs: Vector<Int> | null, dict: DictionaryVector<T>) => | ||
!idxs ? dict.indicies! : idxs.concat(dict.indicies!), | ||
!idxs ? dict.indices! : idxs.concat(dict.indices!), | ||
null | ||
@@ -421,3 +424,3 @@ )!; | ||
} | ||
public getKey(index: number) { return this.indicies.get(index); } | ||
public getKey(index: number) { return this.indices.get(index); } | ||
public getValue(key: number) { return this.dictionary.get(key); } | ||
@@ -424,0 +427,0 @@ public reverseLookup(value: T) { return this.dictionary.indexOf(value); } |
@@ -23,19 +23,19 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
export class DictionaryView<T extends DataType> implements View<T> { | ||
public indicies: Vector<Int>; | ||
public indices: Vector<Int>; | ||
public dictionary: Vector<T>; | ||
constructor(dictionary: Vector<T>, indicies: Vector<Int>) { | ||
this.indicies = indicies; | ||
constructor(dictionary: Vector<T>, indices: Vector<Int>) { | ||
this.indices = indices; | ||
this.dictionary = dictionary; | ||
} | ||
public clone(data: Data<Dictionary<T>>): this { | ||
return new DictionaryView(data.dictionary, this.indicies.clone(data.indicies)) as this; | ||
return new DictionaryView(data.dictionary, this.indices.clone(data.indices)) as this; | ||
} | ||
public isValid(index: number): boolean { | ||
return this.indicies.isValid(index); | ||
return this.indices.isValid(index); | ||
} | ||
public get(index: number): T['TValue'] { | ||
return this.dictionary.get(this.indicies.get(index)); | ||
return this.dictionary.get(this.indices.get(index)); | ||
} | ||
public set(index: number, value: T['TValue']): void { | ||
this.dictionary.set(this.indicies.get(index), value); | ||
this.dictionary.set(this.indices.get(index), value); | ||
} | ||
@@ -46,5 +46,5 @@ public toArray(): IterableArrayLike<T['TValue']> { | ||
public *[Symbol.iterator](): IterableIterator<T['TValue']> { | ||
const values = this.dictionary, indicies = this.indicies; | ||
for (let index = -1, n = indicies.length; ++index < n;) { | ||
yield values.get(indicies.get(index)); | ||
const values = this.dictionary, indices = this.indices; | ||
for (let index = -1, n = indices.length; ++index < n;) { | ||
yield values.get(indices.get(index)); | ||
} | ||
@@ -57,5 +57,5 @@ } | ||
// ... then find the first occurence of that key in indicies | ||
return this.indicies.indexOf(key!); | ||
// ... then find the first occurence of that key in indices | ||
return this.indices.indexOf(key!); | ||
} | ||
} |
@@ -329,5 +329,5 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
export function epochDaysToMs(data: Int32Array, index: number) { return 86400000 * data[index]; } | ||
export function epochMillisecondsLongToMs(data: Int32Array, index: number) { return 4294967296 * (data[index + 1]) + data[index]; } | ||
export function epochMicrosecondsLongToMs(data: Int32Array, index: number) { return 4294967296 * (data[index + 1] / 1000) + (data[index] / 1000); } | ||
export function epochNanosecondsLongToMs(data: Int32Array, index: number) { return 4294967296 * (data[index + 1] / 1000000) + (data[index] / 1000000); } | ||
export function epochMillisecondsLongToMs(data: Int32Array, index: number) { return 4294967296 * (data[index + 1]) + (data[index] >>> 0); } | ||
export function epochMicrosecondsLongToMs(data: Int32Array, index: number) { return 4294967296 * (data[index + 1] / 1000) + ((data[index] >>> 0) / 1000); } | ||
export function epochNanosecondsLongToMs(data: Int32Array, index: number) { return 4294967296 * (data[index + 1] / 1000000) + ((data[index] >>> 0) / 1000000); } | ||
@@ -334,0 +334,0 @@ export function epochMillisecondsToDate(epochMs: number) { return new Date(epochMs); } |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
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
361971
7419
231