Skip to content

Commit

Permalink
Merge branch 'extern-woes' into js-cpp-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
trxcllnt committed Jan 26, 2018
2 parents f3cde1a + 25cdc4a commit e148ee4
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 37 deletions.
3 changes: 2 additions & 1 deletion js/gulp/closure-task.js
Expand Up @@ -66,7 +66,8 @@ const createClosureArgs = (entry, externs) => ({
rewrite_polyfills: false,
entry_point: `${entry}.js`,
module_resolution: `NODE`,
// formatting: `PRETTY_PRINT`, debug: true,
// formatting: `PRETTY_PRINT`,
// debug: true,
compilation_level: `ADVANCED`,
allow_method_call_decomposing: true,
package_json_entry_names: `module,jsnext:main,main`,
Expand Down
1 change: 1 addition & 0 deletions js/gulp/uglify-task.js
Expand Up @@ -91,6 +91,7 @@ const reservePublicNames = ((ESKeywords) => function reservePublicNames(target,
`../${src}/table.js`,
`../${src}/vector.js`,
`../${src}/util/int.js`,
`../${src}/predicate.js`,
`../${src}/recordbatch.js`,
`../${src}/${mainExport}.js`,
];
Expand Down
102 changes: 81 additions & 21 deletions js/src/Arrow.externs.js
Expand Up @@ -72,13 +72,47 @@ var CountByResult = function() {};
/** @type {?} */
CountByResult.prototype.asJSON;

let Col = function() {};
var col = function () {};
var lit = function () {};

var Value = function() {};
/** @type {?} */
Col.prototype.gteq;
Value.prototype.gteq;
/** @type {?} */
Col.prototype.lteq;
Value.prototype.lteq;
/** @type {?} */
Col.prototype.eq;
Value.prototype.eq;

var Col = function() {};
/** @type {?} */
Col.prototype.bind;
var Or = function() {};
var And = function() {};
var GTeq = function () {};
/** @type {?} */
GTeq.prototype.and;
/** @type {?} */
GTeq.prototype.or;
var LTeq = function () {};
/** @type {?} */
LTeq.prototype.and;
/** @type {?} */
LTeq.prototype.or;
var Equals = function () {};
/** @type {?} */
Equals.prototype.and;
/** @type {?} */
Equals.prototype.or;
var Predicate = function() {};
/** @type {?} */
Predicate.prototype.bind;
/** @type {?} */
Predicate.prototype.and;
/** @type {?} */
Predicate.prototype.or;
/** @type {?} */
Predicate.prototype.ands;
var Literal = function() {};

var TableToStringIterator = function() {};
/** @type {?} */
Expand Down Expand Up @@ -118,8 +152,6 @@ Vector.prototype.get;
/** @type {?} */
Vector.prototype.set;
/** @type {?} */
Vector.prototype.setData;
/** @type {?} */
Vector.prototype.toArray;
/** @type {?} */
Vector.prototype.concat;
Expand Down Expand Up @@ -441,97 +473,125 @@ var FlatView = function() {};
/** @type {?} */
FlatView.prototype.get;
/** @type {?} */
FlatView.prototype.clone;
/** @type {?} */
FlatView.prototype.isValid;
/** @type {?} */
FlatView.prototype.toArray;
/** @type {?} */
FlatView.prototype.set;

var PrimitiveView = function() {};
/** @type {?} */
PrimitiveView.prototype.size;
/** @type {?} */
FlatView.prototype.setData;
PrimitiveView.prototype.clone;

var NullView = function() {};
/** @type {?} */
NullView.prototype.get;
/** @type {?} */
NullView.prototype.clone;
/** @type {?} */
NullView.prototype.isValid;
/** @type {?} */
NullView.prototype.toArray;
/** @type {?} */
NullView.prototype.set;
/** @type {?} */
NullView.prototype.setData;

var BoolView = function() {};
/** @type {?} */
BoolView.prototype.get;
/** @type {?} */
BoolView.prototype.clone;
/** @type {?} */
BoolView.prototype.isValid;
/** @type {?} */
BoolView.prototype.toArray;
/** @type {?} */
BoolView.prototype.set;
/** @type {?} */
BoolView.prototype.setData;

var ValidityView = function() {};
/** @type {?} */
ValidityView.prototype.get;
/** @type {?} */
ValidityView.prototype.clone;
/** @type {?} */
ValidityView.prototype.isValid;
/** @type {?} */
ValidityView.prototype.toArray;
/** @type {?} */
ValidityView.prototype.set;
/** @type {?} */
ValidityView.prototype.setData;

var DictionaryView = function() {};
/** @type {?} */
DictionaryView.prototype.get;
/** @type {?} */
DictionaryView.prototype.clone;
/** @type {?} */
DictionaryView.prototype.isValid;
/** @type {?} */
DictionaryView.prototype.toArray;
/** @type {?} */
DictionaryView.prototype.set;
/** @type {?} */
DictionaryView.prototype.setData;

var ListViewBase = function() {};
/** @type {?} */
ListViewBase.prototype.get;
/** @type {?} */
ListViewBase.prototype.clone;
/** @type {?} */
ListViewBase.prototype.isValid;
/** @type {?} */
ListViewBase.prototype.toArray;
/** @type {?} */
ListViewBase.prototype.set;
/** @type {?} */
ListViewBase.prototype.setData;

var NestedView = function() {};
/** @type {?} */
NestedView.prototype.get;
/** @type {?} */
NestedView.prototype.clone;
/** @type {?} */
NestedView.prototype.isValid;
/** @type {?} */
NestedView.prototype.toArray;
/** @type {?} */
NestedView.prototype.set;
/** @type {?} */
NestedView.prototype.setData;

var ChunkedView = function() {};
/** @type {?} */
ChunkedView.prototype.get;
/** @type {?} */
ChunkedView.prototype.clone;
/** @type {?} */
ChunkedView.prototype.isValid;
/** @type {?} */
ChunkedView.prototype.toArray;
/** @type {?} */
ChunkedView.prototype.set;
/** @type {?} */
ChunkedView.prototype.setData;

var ListView = function() {};
var FixedSizeListView = function() {};
var BinaryView = function() {};
var Utf8View = function() {};
var UnionView = function() {};
var DenseUnionView = function() {};
var StructView = function() {};
var MapView = function() {};
var NullView = function() {};
var FixedSizeView = function() {};
var Float16View = function() {};
var DateDayView = function() {};
var DateMillisecondView = function() {};
var TimestampDayView = function() {};
var TimestampSecondView = function() {};
var TimestampMillisecondView = function() {};
var TimestampMicrosecondView = function() {};
var TimestampNanosecondView = function() {};
var IntervalYearMonthView = function() {};
var IntervalYearView = function() {};
var IntervalMonthView = function() {};

var TypeVisitor = function() {};
/** @type {?} */
Expand Down
29 changes: 21 additions & 8 deletions js/src/Arrow.ts
Expand Up @@ -21,11 +21,11 @@ import * as vector_ from './vector';
import * as util_ from './util/int';
import * as visitor_ from './visitor';
import * as view_ from './vector/view';
import * as predicate_ from './predicate';
import { Vector } from './vector';
import { RecordBatch } from './recordbatch';
import { Schema, Field, Type } from './type';
import { Table, CountByResult } from './table';
import { lit, col, Col, Value } from './predicate';
import { Table, DataFrame, NextFunc, CountByResult } from './table';
import { read, readAsync } from './ipc/reader/arrow';

export import View = vector_.View;
Expand All @@ -36,8 +36,7 @@ export import TimeBitWidth = type_.TimeBitWidth;
export import TypedArrayConstructor = type_.TypedArrayConstructor;

export { read, readAsync };
export { Table, CountByResult };
export { lit, col, Col, Value };
export { Table, DataFrame, NextFunc, CountByResult };
export { Field, Schema, RecordBatch, Vector, Type };

export namespace util {
Expand Down Expand Up @@ -154,6 +153,23 @@ export namespace view {
export import IntervalMonthView = view_.IntervalMonthView;
}

export namespace predicate {
export import col = predicate_.col;
export import lit = predicate_.lit;

export import Or = predicate_.Or;
export import Col = predicate_.Col;
export import And = predicate_.And;
export import GTeq = predicate_.GTeq;
export import LTeq = predicate_.LTeq;
export import Value = predicate_.Value;
export import Equals = predicate_.Equals;
export import Literal = predicate_.Literal;
export import Predicate = predicate_.Predicate;

export import PredicateFunc = predicate_.PredicateFunc;
}

/* These exports are needed for the closure and uglify umd targets */
try {
let Arrow: any = eval('exports');
Expand All @@ -165,6 +181,7 @@ try {
Arrow['view'] = view;
Arrow['vector'] = vector;
Arrow['visitor'] = visitor;
Arrow['predicate'] = predicate;

Arrow['read'] = read;
Arrow['readAsync'] = readAsync;
Expand All @@ -177,10 +194,6 @@ try {

Arrow['Table'] = Table;
Arrow['CountByResult'] = CountByResult;
Arrow['Value'] = Value;
Arrow['lit'] = lit;
Arrow['col'] = col;
Arrow['Col'] = Col;
}
} catch (e) { /* not the UMD bundle */ }
/* end umd exports */
Expand Down
6 changes: 3 additions & 3 deletions js/src/predicate.ts
Expand Up @@ -102,13 +102,13 @@ export abstract class ComparisonPredicate<T= any> extends Predicate {
protected abstract _bindColLit(batch: RecordBatch, col: Col, lit: Literal): PredicateFunc;
}

abstract class CombinationPredicate extends Predicate {
export abstract class CombinationPredicate extends Predicate {
constructor(public readonly left: Predicate, public readonly right: Predicate) {
super();
}
}

class And extends CombinationPredicate {
export class And extends CombinationPredicate {
bind(batch: RecordBatch) {
const left = this.left.bind(batch);
const right = this.right.bind(batch);
Expand All @@ -117,7 +117,7 @@ class And extends CombinationPredicate {
ands(): Predicate[] { return this.left.ands().concat(this.right.ands()); }
}

class Or extends CombinationPredicate {
export class Or extends CombinationPredicate {
bind(batch: RecordBatch) {
const left = this.left.bind(batch);
const right = this.right.bind(batch);
Expand Down
7 changes: 3 additions & 4 deletions js/test/unit/table-tests.ts
Expand Up @@ -17,10 +17,9 @@

import Arrow from '../Arrow';

const {
col,
Table,
} = Arrow;
const { predicate, Table } = Arrow;

const { col } = predicate;

describe(`Table`, () => {
test(`can create an empty table`, () => {
Expand Down

0 comments on commit e148ee4

Please sign in to comment.