This is an automated email from the ASF dual-hosted git repository.
bhulette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 8c493cd ARROW-2219: [JS] rename indicies to indices
8c493cd is described below
commit 8c493cdcf8a3f70369d6c6ab73561bb0fed46be8
Author: Paul Taylor <[email protected]>
AuthorDate: Mon Feb 26 14:38:09 2018 -0500
ARROW-2219: [JS] rename indicies to indices
@TheNeuralBit I think this is my bad as "indicies" isn't a real word. what
do you think, is this PR worth it? should we name this "keys" instead?
Author: Paul Taylor <[email protected]>
Closes #1666 from trxcllnt/js-fix-indicies-typo and squashes the following
commits:
711571a <Paul Taylor> fix typo -- rename indicies to indices
---
js/src/Arrow.externs.js | 2 +-
js/src/data.ts | 22 +++++++++++-----------
js/src/ipc/reader/vector.ts | 2 +-
js/src/table.ts | 4 ++--
js/src/type.ts | 12 ++++++------
js/src/vector.ts | 12 ++++++------
js/src/vector/dictionary.ts | 24 ++++++++++++------------
7 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/js/src/Arrow.externs.js b/js/src/Arrow.externs.js
index de1e653..cf4db91 100644
--- a/js/src/Arrow.externs.js
+++ b/js/src/Arrow.externs.js
@@ -447,7 +447,7 @@ FlatListData.prototype.valueOffsets;
var DictionaryData = function() {};
/** @type {?} */
-DictionaryData.prototype.indicies;
+DictionaryData.prototype.indices;
/** @type {?} */
DictionaryData.prototype.dictionary;
diff --git a/js/src/data.ts b/js/src/data.ts
index d49fb79..cdd9f29 100644
--- a/js/src/data.ts
+++ b/js/src/data.ts
@@ -148,28 +148,28 @@ export class FlatListData<T extends FlatListType> extends
FlatData<T> {
export class DictionaryData<T extends DataType> extends
BaseData<Dictionary<T>> {
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 as any)._nullCount);
+ this._indices = indices;
this._dictionary = dictionary;
- this.length = this._indicies.length;
+ this.length = this._indices.length;
}
- public get nullCount() { return this._indicies.nullCount; }
- public get nullBitmap() { return this._indicies.nullBitmap; }
+ 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) {
const data = this._dictionary.data.clone(type.dictionary as any);
return new DictionaryData<R>(
this.type 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;
}
}
diff --git a/js/src/ipc/reader/vector.ts b/js/src/ipc/reader/vector.ts
index 809069c..b8c4871 100644
--- a/js/src/ipc/reader/vector.ts
+++ b/js/src/ipc/reader/vector.ts
@@ -92,7 +92,7 @@ export abstract class TypeDataLoader extends TypeVisitor {
public visitFixedSizeList (type: FixedSizeList) { return
this.visitFixedSizeListType(type); }
public visitMap (type: Map_) { return
this.visitNestedType(type); }
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));
}
protected getFieldMetadata() { return this.nodes.next().value; }
protected getBufferMetadata() { return this.buffers.next().value; }
diff --git a/js/src/table.ts b/js/src/table.ts
index 3e50d16..d0d699f 100644
--- a/js/src/table.ts
+++ b/js/src/table.ts
@@ -160,7 +160,7 @@ export class Table implements DataFrame {
const batch = batches[batchIndex];
// rebind the countBy Col
count_by.bind(batch);
- const keys = (count_by.vector as DictionaryVector).indicies;
+ const keys = (count_by.vector as DictionaryVector).indices;
// yield all indices
for (let index = -1, numRows = batch.length; ++index < numRows;) {
let key = keys.get(index);
@@ -258,7 +258,7 @@ class FilteredDataFrame implements DataFrame {
const predicate = this.predicate.bind(batch);
// rebind the countBy Col
count_by.bind(batch);
- const keys = (count_by.vector as DictionaryVector).indicies;
+ const keys = (count_by.vector as DictionaryVector).indices;
// yield all indices
for (let index = -1, numRows = batch.length; ++index < numRows;) {
let key = keys.get(index);
diff --git a/js/src/type.ts b/js/src/type.ts
index 5e6c939..370be0d 100644
--- a/js/src/type.ts
+++ b/js/src/type.ts
@@ -83,8 +83,8 @@ export class Field<T extends DataType = DataType> {
public toString() { return `${this.name}: ${this.type}`; }
public get typeId(): T['TType'] { return this.type.TType; }
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;
}
}
@@ -443,17 +443,17 @@ export interface Dictionary<T extends DataType = any>
extends DataType<Type.Dict
export class Dictionary<T extends DataType> extends DataType<Type.Dictionary> {
public readonly id: number;
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;
this.isOrdered = isOrdered || false;
this.id = id == null ? DictionaryBatch.getId() : typeof id ===
'number' ? id : id.low;
}
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) => {
return proto[Symbol.toStringTag] = 'Dictionary';
})(Dictionary.prototype);
diff --git a/js/src/vector.ts b/js/src/vector.ts
index fa1d16e..f36c691 100644
--- a/js/src/vector.ts
+++ b/js/src/vector.ts
@@ -394,29 +394,29 @@ export class UnionVector<T extends (SparseUnion |
DenseUnion) = any> extends Nes
export class DictionaryVector<T extends DataType = DataType> extends
Vector<Dictionary<T>> {
// @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 (data instanceof DictionaryData && view instanceof DictionaryView) {
- this.indicies = view.indicies;
+ this.indices = view.indices;
this.dictionary = data.dictionary;
} else if (data instanceof ChunkedData && view instanceof ChunkedView)
{
const chunks = view.chunkVectors as DictionaryVector<T>[];
// Assume the last chunk's dictionary data is the most up-to-date,
// including data from DictionaryBatches that were marked as deltas
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
)!;
} else {
throw new TypeError(`Unrecognized DictionaryVector view`);
}
}
- 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); }
public reverseLookup(value: T) { return this.dictionary.indexOf(value); }
}
diff --git a/js/src/vector/dictionary.ts b/js/src/vector/dictionary.ts
index f4de810..21f9bac 100644
--- a/js/src/vector/dictionary.ts
+++ b/js/src/vector/dictionary.ts
@@ -20,31 +20,31 @@ import { View, Vector } from '../vector';
import { IterableArrayLike, DataType, Dictionary, Int } from '../type';
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);
}
public toArray(): IterableArrayLike<T['TValue']> {
return [...this];
}
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));
}
}
public indexOf(search: T['TValue']) {
@@ -52,7 +52,7 @@ export class DictionaryView<T extends DataType> implements
View<T> {
const key = this.dictionary.indexOf(search);
if (key === -1) { return key; }
- // ... 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!);
}
}
--
To stop receiving notification emails like this one, please contact
[email protected].