Skip to content

Commit e148ee4

Browse files
committed
Merge branch 'extern-woes' into js-cpp-refactor
2 parents f3cde1a + 25cdc4a commit e148ee4

File tree

6 files changed

+111
-37
lines changed

6 files changed

+111
-37
lines changed

js/gulp/closure-task.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ const createClosureArgs = (entry, externs) => ({
6666
rewrite_polyfills: false,
6767
entry_point: `${entry}.js`,
6868
module_resolution: `NODE`,
69-
// formatting: `PRETTY_PRINT`, debug: true,
69+
// formatting: `PRETTY_PRINT`,
70+
// debug: true,
7071
compilation_level: `ADVANCED`,
7172
allow_method_call_decomposing: true,
7273
package_json_entry_names: `module,jsnext:main,main`,

js/gulp/uglify-task.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ const reservePublicNames = ((ESKeywords) => function reservePublicNames(target,
9191
`../${src}/table.js`,
9292
`../${src}/vector.js`,
9393
`../${src}/util/int.js`,
94+
`../${src}/predicate.js`,
9495
`../${src}/recordbatch.js`,
9596
`../${src}/${mainExport}.js`,
9697
];

js/src/Arrow.externs.js

Lines changed: 81 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,47 @@ var CountByResult = function() {};
7272
/** @type {?} */
7373
CountByResult.prototype.asJSON;
7474

75-
let Col = function() {};
75+
var col = function () {};
76+
var lit = function () {};
77+
78+
var Value = function() {};
7679
/** @type {?} */
77-
Col.prototype.gteq;
80+
Value.prototype.gteq;
7881
/** @type {?} */
79-
Col.prototype.lteq;
82+
Value.prototype.lteq;
8083
/** @type {?} */
81-
Col.prototype.eq;
84+
Value.prototype.eq;
85+
86+
var Col = function() {};
87+
/** @type {?} */
88+
Col.prototype.bind;
89+
var Or = function() {};
90+
var And = function() {};
91+
var GTeq = function () {};
92+
/** @type {?} */
93+
GTeq.prototype.and;
94+
/** @type {?} */
95+
GTeq.prototype.or;
96+
var LTeq = function () {};
97+
/** @type {?} */
98+
LTeq.prototype.and;
99+
/** @type {?} */
100+
LTeq.prototype.or;
101+
var Equals = function () {};
102+
/** @type {?} */
103+
Equals.prototype.and;
104+
/** @type {?} */
105+
Equals.prototype.or;
106+
var Predicate = function() {};
107+
/** @type {?} */
108+
Predicate.prototype.bind;
109+
/** @type {?} */
110+
Predicate.prototype.and;
111+
/** @type {?} */
112+
Predicate.prototype.or;
113+
/** @type {?} */
114+
Predicate.prototype.ands;
115+
var Literal = function() {};
82116

83117
var TableToStringIterator = function() {};
84118
/** @type {?} */
@@ -118,8 +152,6 @@ Vector.prototype.get;
118152
/** @type {?} */
119153
Vector.prototype.set;
120154
/** @type {?} */
121-
Vector.prototype.setData;
122-
/** @type {?} */
123155
Vector.prototype.toArray;
124156
/** @type {?} */
125157
Vector.prototype.concat;
@@ -441,97 +473,125 @@ var FlatView = function() {};
441473
/** @type {?} */
442474
FlatView.prototype.get;
443475
/** @type {?} */
476+
FlatView.prototype.clone;
477+
/** @type {?} */
444478
FlatView.prototype.isValid;
445479
/** @type {?} */
446480
FlatView.prototype.toArray;
447481
/** @type {?} */
448482
FlatView.prototype.set;
483+
484+
var PrimitiveView = function() {};
485+
/** @type {?} */
486+
PrimitiveView.prototype.size;
449487
/** @type {?} */
450-
FlatView.prototype.setData;
488+
PrimitiveView.prototype.clone;
451489

452490
var NullView = function() {};
453491
/** @type {?} */
454492
NullView.prototype.get;
455493
/** @type {?} */
494+
NullView.prototype.clone;
495+
/** @type {?} */
456496
NullView.prototype.isValid;
457497
/** @type {?} */
458498
NullView.prototype.toArray;
459499
/** @type {?} */
460500
NullView.prototype.set;
461-
/** @type {?} */
462-
NullView.prototype.setData;
463501

464502
var BoolView = function() {};
465503
/** @type {?} */
466504
BoolView.prototype.get;
467505
/** @type {?} */
506+
BoolView.prototype.clone;
507+
/** @type {?} */
468508
BoolView.prototype.isValid;
469509
/** @type {?} */
470510
BoolView.prototype.toArray;
471511
/** @type {?} */
472512
BoolView.prototype.set;
473-
/** @type {?} */
474-
BoolView.prototype.setData;
475513

476514
var ValidityView = function() {};
477515
/** @type {?} */
478516
ValidityView.prototype.get;
479517
/** @type {?} */
518+
ValidityView.prototype.clone;
519+
/** @type {?} */
480520
ValidityView.prototype.isValid;
481521
/** @type {?} */
482522
ValidityView.prototype.toArray;
483523
/** @type {?} */
484524
ValidityView.prototype.set;
485-
/** @type {?} */
486-
ValidityView.prototype.setData;
487525

488526
var DictionaryView = function() {};
489527
/** @type {?} */
490528
DictionaryView.prototype.get;
491529
/** @type {?} */
530+
DictionaryView.prototype.clone;
531+
/** @type {?} */
492532
DictionaryView.prototype.isValid;
493533
/** @type {?} */
494534
DictionaryView.prototype.toArray;
495535
/** @type {?} */
496536
DictionaryView.prototype.set;
497-
/** @type {?} */
498-
DictionaryView.prototype.setData;
499537

500538
var ListViewBase = function() {};
501539
/** @type {?} */
502540
ListViewBase.prototype.get;
503541
/** @type {?} */
542+
ListViewBase.prototype.clone;
543+
/** @type {?} */
504544
ListViewBase.prototype.isValid;
505545
/** @type {?} */
506546
ListViewBase.prototype.toArray;
507547
/** @type {?} */
508548
ListViewBase.prototype.set;
509-
/** @type {?} */
510-
ListViewBase.prototype.setData;
511549

512550
var NestedView = function() {};
513551
/** @type {?} */
514552
NestedView.prototype.get;
515553
/** @type {?} */
554+
NestedView.prototype.clone;
555+
/** @type {?} */
516556
NestedView.prototype.isValid;
517557
/** @type {?} */
518558
NestedView.prototype.toArray;
519559
/** @type {?} */
520560
NestedView.prototype.set;
521-
/** @type {?} */
522-
NestedView.prototype.setData;
523561

524562
var ChunkedView = function() {};
525563
/** @type {?} */
526564
ChunkedView.prototype.get;
527565
/** @type {?} */
566+
ChunkedView.prototype.clone;
567+
/** @type {?} */
528568
ChunkedView.prototype.isValid;
529569
/** @type {?} */
530570
ChunkedView.prototype.toArray;
531571
/** @type {?} */
532572
ChunkedView.prototype.set;
533-
/** @type {?} */
534-
ChunkedView.prototype.setData;
573+
574+
var ListView = function() {};
575+
var FixedSizeListView = function() {};
576+
var BinaryView = function() {};
577+
var Utf8View = function() {};
578+
var UnionView = function() {};
579+
var DenseUnionView = function() {};
580+
var StructView = function() {};
581+
var MapView = function() {};
582+
var NullView = function() {};
583+
var FixedSizeView = function() {};
584+
var Float16View = function() {};
585+
var DateDayView = function() {};
586+
var DateMillisecondView = function() {};
587+
var TimestampDayView = function() {};
588+
var TimestampSecondView = function() {};
589+
var TimestampMillisecondView = function() {};
590+
var TimestampMicrosecondView = function() {};
591+
var TimestampNanosecondView = function() {};
592+
var IntervalYearMonthView = function() {};
593+
var IntervalYearView = function() {};
594+
var IntervalMonthView = function() {};
535595

536596
var TypeVisitor = function() {};
537597
/** @type {?} */

js/src/Arrow.ts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import * as vector_ from './vector';
2121
import * as util_ from './util/int';
2222
import * as visitor_ from './visitor';
2323
import * as view_ from './vector/view';
24+
import * as predicate_ from './predicate';
2425
import { Vector } from './vector';
2526
import { RecordBatch } from './recordbatch';
2627
import { Schema, Field, Type } from './type';
27-
import { Table, CountByResult } from './table';
28-
import { lit, col, Col, Value } from './predicate';
28+
import { Table, DataFrame, NextFunc, CountByResult } from './table';
2929
import { read, readAsync } from './ipc/reader/arrow';
3030

3131
export import View = vector_.View;
@@ -36,8 +36,7 @@ export import TimeBitWidth = type_.TimeBitWidth;
3636
export import TypedArrayConstructor = type_.TypedArrayConstructor;
3737

3838
export { read, readAsync };
39-
export { Table, CountByResult };
40-
export { lit, col, Col, Value };
39+
export { Table, DataFrame, NextFunc, CountByResult };
4140
export { Field, Schema, RecordBatch, Vector, Type };
4241

4342
export namespace util {
@@ -154,6 +153,23 @@ export namespace view {
154153
export import IntervalMonthView = view_.IntervalMonthView;
155154
}
156155

156+
export namespace predicate {
157+
export import col = predicate_.col;
158+
export import lit = predicate_.lit;
159+
160+
export import Or = predicate_.Or;
161+
export import Col = predicate_.Col;
162+
export import And = predicate_.And;
163+
export import GTeq = predicate_.GTeq;
164+
export import LTeq = predicate_.LTeq;
165+
export import Value = predicate_.Value;
166+
export import Equals = predicate_.Equals;
167+
export import Literal = predicate_.Literal;
168+
export import Predicate = predicate_.Predicate;
169+
170+
export import PredicateFunc = predicate_.PredicateFunc;
171+
}
172+
157173
/* These exports are needed for the closure and uglify umd targets */
158174
try {
159175
let Arrow: any = eval('exports');
@@ -165,6 +181,7 @@ try {
165181
Arrow['view'] = view;
166182
Arrow['vector'] = vector;
167183
Arrow['visitor'] = visitor;
184+
Arrow['predicate'] = predicate;
168185

169186
Arrow['read'] = read;
170187
Arrow['readAsync'] = readAsync;
@@ -177,10 +194,6 @@ try {
177194

178195
Arrow['Table'] = Table;
179196
Arrow['CountByResult'] = CountByResult;
180-
Arrow['Value'] = Value;
181-
Arrow['lit'] = lit;
182-
Arrow['col'] = col;
183-
Arrow['Col'] = Col;
184197
}
185198
} catch (e) { /* not the UMD bundle */ }
186199
/* end umd exports */

js/src/predicate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ export abstract class ComparisonPredicate<T= any> extends Predicate {
102102
protected abstract _bindColLit(batch: RecordBatch, col: Col, lit: Literal): PredicateFunc;
103103
}
104104

105-
abstract class CombinationPredicate extends Predicate {
105+
export abstract class CombinationPredicate extends Predicate {
106106
constructor(public readonly left: Predicate, public readonly right: Predicate) {
107107
super();
108108
}
109109
}
110110

111-
class And extends CombinationPredicate {
111+
export class And extends CombinationPredicate {
112112
bind(batch: RecordBatch) {
113113
const left = this.left.bind(batch);
114114
const right = this.right.bind(batch);
@@ -117,7 +117,7 @@ class And extends CombinationPredicate {
117117
ands(): Predicate[] { return this.left.ands().concat(this.right.ands()); }
118118
}
119119

120-
class Or extends CombinationPredicate {
120+
export class Or extends CombinationPredicate {
121121
bind(batch: RecordBatch) {
122122
const left = this.left.bind(batch);
123123
const right = this.right.bind(batch);

js/test/unit/table-tests.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717

1818
import Arrow from '../Arrow';
1919

20-
const {
21-
col,
22-
Table,
23-
} = Arrow;
20+
const { predicate, Table } = Arrow;
21+
22+
const { col } = predicate;
2423

2524
describe(`Table`, () => {
2625
test(`can create an empty table`, () => {

0 commit comments

Comments
 (0)