@apache-arrow/ts
Advanced tools
Comparing version 0.15.1 to 0.16.0
@@ -135,10 +135,15 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
const batch = batches[batchIndex]; | ||
// TODO: bind batches lazily | ||
// If predicate doesn't match anything in the batch we don't need | ||
// to bind the callback | ||
if (bind) { bind(batch); } | ||
const predicate = this._predicate.bind(batch); | ||
let isBound = false; | ||
// yield all indices | ||
for (let index = -1, numRows = batch.length; ++index < numRows;) { | ||
if (predicate(index, batch)) { next(index, batch); } | ||
if (predicate(index, batch)) { | ||
// bind batches lazily - if predicate doesn't match anything | ||
// in the batch we don't need to call bind on the batch | ||
if (bind && !isBound) { | ||
bind(batch); | ||
isBound = true; | ||
} | ||
next(index, batch); | ||
} | ||
} | ||
@@ -153,10 +158,15 @@ } | ||
const batch = batches[batchIndex]; | ||
// TODO: bind batches lazily | ||
// If predicate doesn't match anything in the batch we don't need | ||
// to bind the callback | ||
if (bind) { bind(batch); } | ||
const predicate = this._predicate.bind(batch); | ||
let isBound = false; | ||
// yield all indices | ||
for (let index = batch.length; --index >= 0;) { | ||
if (predicate(index, batch)) { next(index, batch); } | ||
if (predicate(index, batch)) { | ||
// bind batches lazily - if predicate doesn't match anything | ||
// in the batch we don't need to call bind on the batch | ||
if (bind && !isBound) { | ||
bind(batch); | ||
isBound = true; | ||
} | ||
next(index, batch); | ||
} | ||
} | ||
@@ -163,0 +173,0 @@ } |
@@ -130,3 +130,3 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
} | ||
// add children to protoype so it doesn't get mangled in es2015/umd | ||
// add children to prototype so it doesn't get mangled in es2015/umd | ||
(<any> CombinationPredicate.prototype).children = Object.freeze([]); // freeze for safety | ||
@@ -212,3 +212,3 @@ | ||
protected _bindLitCol(batch: RecordBatch, lit: Literal, col: Col) { | ||
// Equals is comutative | ||
// Equals is commutative | ||
return this._bindColLit(batch, col, lit); | ||
@@ -215,0 +215,0 @@ } |
{ | ||
"version": "0.15.1", | ||
"version": "0.16.0", | ||
"name": "@apache-arrow/ts", | ||
@@ -4,0 +4,0 @@ "browser": "Arrow.dom.ts", |
@@ -46,2 +46,3 @@ <!--- | ||
* [Observable: Manipulating flat arrays arrow-style][6] | ||
* [Observable: Rich columnar data tables - Dictionary-encoded strings, 64bit ints, and nested structs][8] | ||
* [/js/test/unit](https://github.com/apache/arrow/tree/master/js/test/unit) - Unit tests for Table and Vector | ||
@@ -281,1 +282,2 @@ | ||
[7]: https://arrow.apache.org/docs/js/ | ||
[8]: https://observablehq.com/@lmeyerov/rich-data-types-in-apache-arrow-js-efficient-data-tables-wit |
@@ -431,3 +431,4 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
export class Struct<T extends { [key: string]: DataType } = any> extends DataType<Type.Struct, T> { | ||
constructor(public readonly children: Field<T[keyof T]>[]) { | ||
public readonly children: Field<T[keyof T]>[]; | ||
constructor(children: Field<T[keyof T]>[]) { | ||
super(); | ||
@@ -434,0 +435,0 @@ this.children = children; |
@@ -178,3 +178,3 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
* Down-convert the bytes to a 53-bit precision integer. Invoked by JS for | ||
* arithmatic operators, like `+`. Easy (and unsafe) way to convert BN to | ||
* arithmetic operators, like `+`. Easy (and unsafe) way to convert BN to | ||
* number via `+bn_inst` | ||
@@ -181,0 +181,0 @@ */ |
@@ -100,7 +100,7 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
function createArrayLikeComparator(lhs: ArrayLike<any>) { | ||
const comparitors = [] as ((x: any) => boolean)[]; | ||
const comparators = [] as ((x: any) => boolean)[]; | ||
for (let i = -1, n = lhs.length; ++i < n;) { | ||
comparitors[i] = createElementComparator(lhs[i]); | ||
comparators[i] = createElementComparator(lhs[i]); | ||
} | ||
return createSubElementsComparator(comparitors); | ||
return createSubElementsComparator(comparators); | ||
} | ||
@@ -111,5 +111,5 @@ | ||
let i = -1; | ||
const comparitors = [] as ((x: any) => boolean)[]; | ||
lhs.forEach((v) => comparitors[++i] = createElementComparator(v)); | ||
return createSubElementsComparator(comparitors); | ||
const comparators = [] as ((x: any) => boolean)[]; | ||
lhs.forEach((v) => comparators[++i] = createElementComparator(v)); | ||
return createSubElementsComparator(comparators); | ||
} | ||
@@ -119,7 +119,7 @@ | ||
function createVectorComparator(lhs: Vector<any>) { | ||
const comparitors = [] as ((x: any) => boolean)[]; | ||
const comparators = [] as ((x: any) => boolean)[]; | ||
for (let i = -1, n = lhs.length; ++i < n;) { | ||
comparitors[i] = createElementComparator(lhs.get(i)); | ||
comparators[i] = createElementComparator(lhs.get(i)); | ||
} | ||
return createSubElementsComparator(comparitors); | ||
return createSubElementsComparator(comparators); | ||
} | ||
@@ -132,10 +132,10 @@ | ||
if (keys.length === 0) { return () => false; } | ||
const comparitors = [] as ((x: any) => boolean)[]; | ||
const comparators = [] as ((x: any) => boolean)[]; | ||
for (let i = -1, n = keys.length; ++i < n;) { | ||
comparitors[i] = createElementComparator(lhs[keys[i]]); | ||
comparators[i] = createElementComparator(lhs[keys[i]]); | ||
} | ||
return createSubElementsComparator(comparitors, keys); | ||
return createSubElementsComparator(comparators, keys); | ||
} | ||
function createSubElementsComparator(comparitors: ((x: any) => boolean)[], keys?: Iterable<string>) { | ||
function createSubElementsComparator(comparators: ((x: any) => boolean)[], keys?: Iterable<string>) { | ||
return (rhs: any) => { | ||
@@ -146,20 +146,20 @@ if (!rhs || typeof rhs !== 'object') { | ||
switch (rhs.constructor) { | ||
case Array: return compareArray(comparitors, rhs); | ||
case Array: return compareArray(comparators, rhs); | ||
case Map: | ||
case MapRow: | ||
case StructRow: | ||
return compareObject(comparitors, rhs, rhs.keys()); | ||
return compareObject(comparators, rhs, rhs.keys()); | ||
case Object: | ||
case undefined: // support `Object.create(null)` objects | ||
return compareObject(comparitors, rhs, keys || Object.keys(rhs)); | ||
return compareObject(comparators, rhs, keys || Object.keys(rhs)); | ||
} | ||
return rhs instanceof Vector ? compareVector(comparitors, rhs) : false; | ||
return rhs instanceof Vector ? compareVector(comparators, rhs) : false; | ||
}; | ||
} | ||
function compareArray(comparitors: ((x: any) => boolean)[], arr: any[]) { | ||
const n = comparitors.length; | ||
function compareArray(comparators: ((x: any) => boolean)[], arr: any[]) { | ||
const n = comparators.length; | ||
if (arr.length !== n) { return false; } | ||
for (let i = -1; ++i < n;) { | ||
if (!(comparitors[i](arr[i]))) { return false; } | ||
if (!(comparators[i](arr[i]))) { return false; } | ||
} | ||
@@ -169,7 +169,7 @@ return true; | ||
function compareVector(comparitors: ((x: any) => boolean)[], vec: Vector) { | ||
const n = comparitors.length; | ||
function compareVector(comparators: ((x: any) => boolean)[], vec: Vector) { | ||
const n = comparators.length; | ||
if (vec.length !== n) { return false; } | ||
for (let i = -1; ++i < n;) { | ||
if (!(comparitors[i](vec.get(i)))) { return false; } | ||
if (!(comparators[i](vec.get(i)))) { return false; } | ||
} | ||
@@ -179,3 +179,3 @@ return true; | ||
function compareObject(comparitors: ((x: any) => boolean)[], obj: Map<any, any>, keys: Iterable<string>) { | ||
function compareObject(comparators: ((x: any) => boolean)[], obj: Map<any, any>, keys: Iterable<string>) { | ||
@@ -187,3 +187,3 @@ const lKeyItr = keys[Symbol.iterator](); | ||
let i = 0; | ||
let n = comparitors.length; | ||
let n = comparators.length; | ||
let rVal = rValItr.next(); | ||
@@ -195,3 +195,3 @@ let lKey = lKeyItr.next(); | ||
++i, lKey = lKeyItr.next(), rKey = rKeyItr.next(), rVal = rValItr.next()) { | ||
if (lKey.value !== rKey.value || !comparitors[i](rVal.value)) { | ||
if (lKey.value !== rKey.value || !comparators[i](rVal.value)) { | ||
break; | ||
@@ -198,0 +198,0 @@ } |
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
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
950873
17000
282