@loaders.gl/schema 4.0.0-alpha.8 → 4.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.min.js +558 -943
- package/dist/es5/index.js +7 -0
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/table/arrow-api/arrow-like-table.js +4 -3
- package/dist/es5/lib/table/arrow-api/arrow-like-table.js.map +1 -1
- package/dist/es5/lib/table/batches/row-table-batch-aggregator.js.map +1 -1
- package/dist/es5/lib/table/simple-table/convert-table.js +24 -0
- package/dist/es5/lib/table/simple-table/convert-table.js.map +1 -1
- package/dist/es5/lib/table/simple-table/table-accessors.js +69 -42
- package/dist/es5/lib/table/simple-table/table-accessors.js.map +1 -1
- package/dist/es5/types/batch.js +2 -0
- package/dist/es5/types/batch.js.map +1 -0
- package/dist/es5/types/binary-geometries.js +2 -0
- package/dist/es5/types/binary-geometries.js.map +1 -0
- package/dist/es5/types/category-gis.js.map +1 -1
- package/dist/es5/types/category-image.js.map +1 -1
- package/dist/es5/types/category-table.js.map +1 -1
- package/dist/es5/types/flat-geometries.js +2 -0
- package/dist/es5/types/flat-geometries.js.map +1 -0
- package/dist/es5/types/schema.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/table/arrow-api/arrow-like-table.js +4 -3
- package/dist/esm/lib/table/arrow-api/arrow-like-table.js.map +1 -1
- package/dist/esm/lib/table/batches/row-table-batch-aggregator.js.map +1 -1
- package/dist/esm/lib/table/simple-table/convert-table.js +22 -0
- package/dist/esm/lib/table/simple-table/convert-table.js.map +1 -1
- package/dist/esm/lib/table/simple-table/table-accessors.js +49 -22
- package/dist/esm/lib/table/simple-table/table-accessors.js.map +1 -1
- package/dist/esm/types/batch.js +2 -0
- package/dist/esm/types/batch.js.map +1 -0
- package/dist/esm/types/binary-geometries.js +2 -0
- package/dist/esm/types/binary-geometries.js.map +1 -0
- package/dist/esm/types/category-gis.js.map +1 -1
- package/dist/esm/types/category-image.js.map +1 -1
- package/dist/esm/types/category-table.js.map +1 -1
- package/dist/esm/types/flat-geometries.js +2 -0
- package/dist/esm/types/flat-geometries.js.map +1 -0
- package/dist/esm/types/schema.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/table/arrow-api/arrow-like-table.d.ts +1 -5
- package/dist/lib/table/arrow-api/arrow-like-table.d.ts.map +1 -1
- package/dist/lib/table/batches/row-table-batch-aggregator.d.ts +3 -3
- package/dist/lib/table/batches/row-table-batch-aggregator.d.ts.map +1 -1
- package/dist/lib/table/simple-table/convert-table.d.ts +34 -1
- package/dist/lib/table/simple-table/convert-table.d.ts.map +1 -1
- package/dist/lib/table/simple-table/table-accessors.d.ts.map +1 -1
- package/dist/types/batch.d.ts +34 -0
- package/dist/types/batch.d.ts.map +1 -0
- package/dist/types/binary-geometries.d.ts +56 -0
- package/dist/types/binary-geometries.d.ts.map +1 -0
- package/dist/types/category-gis.d.ts +3 -84
- package/dist/types/category-gis.d.ts.map +1 -1
- package/dist/types/category-image.d.ts +1 -1
- package/dist/types/category-image.d.ts.map +1 -1
- package/dist/types/category-table.d.ts +42 -22
- package/dist/types/category-table.d.ts.map +1 -1
- package/dist/types/flat-geometries.d.ts +30 -0
- package/dist/types/flat-geometries.d.ts.map +1 -0
- package/dist/types/schema.d.ts +0 -15
- package/dist/types/schema.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +13 -7
- package/src/lib/table/arrow-api/arrow-like-table.ts +3 -2
- package/src/lib/table/batches/row-table-batch-aggregator.ts +2 -2
- package/src/lib/table/simple-table/convert-table.ts +73 -1
- package/src/lib/table/simple-table/table-accessors.ts +56 -22
- package/src/types/batch.ts +41 -0
- package/src/types/binary-geometries.ts +62 -0
- package/src/types/category-gis.ts +30 -104
- package/src/types/category-image.ts +1 -1
- package/src/types/category-table.ts +49 -27
- package/src/types/flat-geometries.ts +40 -0
- package/src/types/schema.ts +0 -17
- package/dist/bundle.js +0 -5
- package/dist/index.js +0 -92
- package/dist/lib/mesh/convert-mesh.js +0 -40
- package/dist/lib/mesh/deduce-mesh-schema.js +0 -66
- package/dist/lib/mesh/mesh-to-arrow-table.js +0 -44
- package/dist/lib/mesh/mesh-utils.js +0 -51
- package/dist/lib/table/arrow/arrow-type-utils.js +0 -53
- package/dist/lib/table/arrow/convert-schema-arrow.js +0 -187
- package/dist/lib/table/arrow/convert-table-to-arrow.js +0 -57
- package/dist/lib/table/arrow-api/arrow-like-field.js +0 -34
- package/dist/lib/table/arrow-api/arrow-like-schema.js +0 -81
- package/dist/lib/table/arrow-api/arrow-like-table.js +0 -53
- package/dist/lib/table/arrow-api/arrow-like-type.js +0 -463
- package/dist/lib/table/arrow-api/enum.js +0 -97
- package/dist/lib/table/arrow-api/get-type-info.js +0 -29
- package/dist/lib/table/arrow-api/index.js +0 -25
- package/dist/lib/table/batches/base-table-batch-aggregator.js +0 -60
- package/dist/lib/table/batches/columnar-table-batch-aggregator.js +0 -92
- package/dist/lib/table/batches/row-table-batch-aggregator.js +0 -81
- package/dist/lib/table/batches/table-batch-aggregator.js +0 -3
- package/dist/lib/table/batches/table-batch-builder.js +0 -152
- package/dist/lib/table/simple-table/convert-table.js +0 -65
- package/dist/lib/table/simple-table/data-type.js +0 -93
- package/dist/lib/table/simple-table/make-table.js +0 -95
- package/dist/lib/table/simple-table/row-utils.js +0 -33
- package/dist/lib/table/simple-table/table-accessors.js +0 -319
- package/dist/lib/table/simple-table/table-column.js +0 -41
- package/dist/lib/table/simple-table/table-schema.js +0 -85
- package/dist/lib/utils/assert.js +0 -12
- package/dist/lib/utils/async-queue.js +0 -92
- package/dist/types/category-gis.js +0 -2
- package/dist/types/category-image.js +0 -2
- package/dist/types/category-mesh.js +0 -3
- package/dist/types/category-table.js +0 -3
- package/dist/types/category-texture.js +0 -3
- package/dist/types/schema.js +0 -3
- package/dist/types/types.js +0 -2
|
@@ -1,463 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This code is adapted from ArrowJS https://github.com/apache/arrow
|
|
3
|
-
// under Apache license http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.Struct = exports.FixedSizeList = exports.IntervalYearMonth = exports.IntervalDayTime = exports.Interval = exports.TimestampNanosecond = exports.TimestampMicrosecond = exports.TimestampMillisecond = exports.TimestampSecond = exports.Timestamp = exports.TimeMillisecond = exports.TimeSecond = exports.Time = exports.DateMillisecond = exports.DateDay = exports.Date = exports.Utf8 = exports.Binary = exports.Float64 = exports.Float32 = exports.Float16 = exports.Float = exports.Uint64 = exports.Uint32 = exports.Uint16 = exports.Uint8 = exports.Int64 = exports.Int32 = exports.Int16 = exports.Int8 = exports.Int = exports.Bool = exports.Null = exports.DataType = exports.Type = void 0;
|
|
6
|
-
const enum_1 = require("./enum");
|
|
7
|
-
var enum_2 = require("./enum");
|
|
8
|
-
Object.defineProperty(exports, "Type", { enumerable: true, get: function () { return enum_2.Type; } });
|
|
9
|
-
/** ArrowLike DataType class */
|
|
10
|
-
class DataType {
|
|
11
|
-
static isNull(x) {
|
|
12
|
-
return x && x.typeId === enum_1.Type.Null;
|
|
13
|
-
}
|
|
14
|
-
static isInt(x) {
|
|
15
|
-
return x && x.typeId === enum_1.Type.Int;
|
|
16
|
-
}
|
|
17
|
-
static isFloat(x) {
|
|
18
|
-
return x && x.typeId === enum_1.Type.Float;
|
|
19
|
-
}
|
|
20
|
-
static isBinary(x) {
|
|
21
|
-
return x && x.typeId === enum_1.Type.Binary;
|
|
22
|
-
}
|
|
23
|
-
static isUtf8(x) {
|
|
24
|
-
return x && x.typeId === enum_1.Type.Utf8;
|
|
25
|
-
}
|
|
26
|
-
static isBool(x) {
|
|
27
|
-
return x && x.typeId === enum_1.Type.Bool;
|
|
28
|
-
}
|
|
29
|
-
static isDecimal(x) {
|
|
30
|
-
return x && x.typeId === enum_1.Type.Decimal;
|
|
31
|
-
}
|
|
32
|
-
static isDate(x) {
|
|
33
|
-
return x && x.typeId === enum_1.Type.Date;
|
|
34
|
-
}
|
|
35
|
-
static isTime(x) {
|
|
36
|
-
return x && x.typeId === enum_1.Type.Time;
|
|
37
|
-
}
|
|
38
|
-
static isTimestamp(x) {
|
|
39
|
-
return x && x.typeId === enum_1.Type.Timestamp;
|
|
40
|
-
}
|
|
41
|
-
static isInterval(x) {
|
|
42
|
-
return x && x.typeId === enum_1.Type.Interval;
|
|
43
|
-
}
|
|
44
|
-
static isList(x) {
|
|
45
|
-
return x && x.typeId === enum_1.Type.List;
|
|
46
|
-
}
|
|
47
|
-
static isStruct(x) {
|
|
48
|
-
return x && x.typeId === enum_1.Type.Struct;
|
|
49
|
-
}
|
|
50
|
-
static isUnion(x) {
|
|
51
|
-
return x && x.typeId === enum_1.Type.Union;
|
|
52
|
-
}
|
|
53
|
-
static isFixedSizeBinary(x) {
|
|
54
|
-
return x && x.typeId === enum_1.Type.FixedSizeBinary;
|
|
55
|
-
}
|
|
56
|
-
static isFixedSizeList(x) {
|
|
57
|
-
return x && x.typeId === enum_1.Type.FixedSizeList;
|
|
58
|
-
}
|
|
59
|
-
static isMap(x) {
|
|
60
|
-
return x && x.typeId === enum_1.Type.Map;
|
|
61
|
-
}
|
|
62
|
-
static isDictionary(x) {
|
|
63
|
-
return x && x.typeId === enum_1.Type.Dictionary;
|
|
64
|
-
}
|
|
65
|
-
get typeId() {
|
|
66
|
-
return enum_1.Type.NONE;
|
|
67
|
-
}
|
|
68
|
-
// get ArrayType(): AnyArrayType {
|
|
69
|
-
// return Int8Array;
|
|
70
|
-
// }
|
|
71
|
-
// get ArrayType() { return Array; }
|
|
72
|
-
compareTo(other) {
|
|
73
|
-
// TODO
|
|
74
|
-
return this === other; // comparer.visit(this, other);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.DataType = DataType;
|
|
78
|
-
// NULL
|
|
79
|
-
class Null extends DataType {
|
|
80
|
-
get typeId() {
|
|
81
|
-
return enum_1.Type.Null;
|
|
82
|
-
}
|
|
83
|
-
get [Symbol.toStringTag]() {
|
|
84
|
-
return 'Null';
|
|
85
|
-
}
|
|
86
|
-
toString() {
|
|
87
|
-
return 'Null';
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
exports.Null = Null;
|
|
91
|
-
// BOOLEANS
|
|
92
|
-
class Bool extends DataType {
|
|
93
|
-
get typeId() {
|
|
94
|
-
return enum_1.Type.Bool;
|
|
95
|
-
}
|
|
96
|
-
// get ArrayType() {
|
|
97
|
-
// return Uint8Array;
|
|
98
|
-
// }
|
|
99
|
-
get [Symbol.toStringTag]() {
|
|
100
|
-
return 'Bool';
|
|
101
|
-
}
|
|
102
|
-
toString() {
|
|
103
|
-
return 'Bool';
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
exports.Bool = Bool;
|
|
107
|
-
// INTS
|
|
108
|
-
class Int extends DataType {
|
|
109
|
-
constructor(isSigned, bitWidth) {
|
|
110
|
-
super();
|
|
111
|
-
this.isSigned = isSigned;
|
|
112
|
-
this.bitWidth = bitWidth;
|
|
113
|
-
}
|
|
114
|
-
get typeId() {
|
|
115
|
-
return enum_1.Type.Int;
|
|
116
|
-
}
|
|
117
|
-
// get ArrayType() {
|
|
118
|
-
// switch (this.bitWidth) {
|
|
119
|
-
// case 8:
|
|
120
|
-
// return this.isSigned ? Int8Array : Uint8Array;
|
|
121
|
-
// case 16:
|
|
122
|
-
// return this.isSigned ? Int16Array : Uint16Array;
|
|
123
|
-
// case 32:
|
|
124
|
-
// return this.isSigned ? Int32Array : Uint32Array;
|
|
125
|
-
// case 64:
|
|
126
|
-
// return this.isSigned ? Int32Array : Uint32Array;
|
|
127
|
-
// default:
|
|
128
|
-
// throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);
|
|
129
|
-
// }
|
|
130
|
-
// }
|
|
131
|
-
get [Symbol.toStringTag]() {
|
|
132
|
-
return 'Int';
|
|
133
|
-
}
|
|
134
|
-
toString() {
|
|
135
|
-
return `${this.isSigned ? 'I' : 'Ui'}nt${this.bitWidth}`;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
exports.Int = Int;
|
|
139
|
-
class Int8 extends Int {
|
|
140
|
-
constructor() {
|
|
141
|
-
super(true, 8);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
exports.Int8 = Int8;
|
|
145
|
-
class Int16 extends Int {
|
|
146
|
-
constructor() {
|
|
147
|
-
super(true, 16);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
exports.Int16 = Int16;
|
|
151
|
-
class Int32 extends Int {
|
|
152
|
-
constructor() {
|
|
153
|
-
super(true, 32);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
exports.Int32 = Int32;
|
|
157
|
-
class Int64 extends Int {
|
|
158
|
-
constructor() {
|
|
159
|
-
super(true, 64);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
exports.Int64 = Int64;
|
|
163
|
-
class Uint8 extends Int {
|
|
164
|
-
constructor() {
|
|
165
|
-
super(false, 8);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
exports.Uint8 = Uint8;
|
|
169
|
-
class Uint16 extends Int {
|
|
170
|
-
constructor() {
|
|
171
|
-
super(false, 16);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
exports.Uint16 = Uint16;
|
|
175
|
-
class Uint32 extends Int {
|
|
176
|
-
constructor() {
|
|
177
|
-
super(false, 32);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
exports.Uint32 = Uint32;
|
|
181
|
-
class Uint64 extends Int {
|
|
182
|
-
constructor() {
|
|
183
|
-
super(false, 64);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
exports.Uint64 = Uint64;
|
|
187
|
-
// FLOATS
|
|
188
|
-
const Precision = {
|
|
189
|
-
HALF: 16,
|
|
190
|
-
SINGLE: 32,
|
|
191
|
-
DOUBLE: 64
|
|
192
|
-
};
|
|
193
|
-
class Float extends DataType {
|
|
194
|
-
constructor(precision) {
|
|
195
|
-
super();
|
|
196
|
-
this.precision = precision;
|
|
197
|
-
}
|
|
198
|
-
get typeId() {
|
|
199
|
-
return enum_1.Type.Float;
|
|
200
|
-
}
|
|
201
|
-
// get ArrayType() {
|
|
202
|
-
// switch (this.precision) {
|
|
203
|
-
// case Precision.HALF:
|
|
204
|
-
// return Uint16Array;
|
|
205
|
-
// case Precision.SINGLE:
|
|
206
|
-
// return Float32Array;
|
|
207
|
-
// case Precision.DOUBLE:
|
|
208
|
-
// return Float64Array;
|
|
209
|
-
// default:
|
|
210
|
-
// throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);
|
|
211
|
-
// }
|
|
212
|
-
// }
|
|
213
|
-
get [Symbol.toStringTag]() {
|
|
214
|
-
return 'Float';
|
|
215
|
-
}
|
|
216
|
-
toString() {
|
|
217
|
-
return `Float${this.precision}`;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
exports.Float = Float;
|
|
221
|
-
class Float16 extends Float {
|
|
222
|
-
constructor() {
|
|
223
|
-
super(Precision.HALF);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
exports.Float16 = Float16;
|
|
227
|
-
class Float32 extends Float {
|
|
228
|
-
constructor() {
|
|
229
|
-
super(Precision.SINGLE);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
exports.Float32 = Float32;
|
|
233
|
-
class Float64 extends Float {
|
|
234
|
-
constructor() {
|
|
235
|
-
super(Precision.DOUBLE);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
exports.Float64 = Float64;
|
|
239
|
-
class Binary extends DataType {
|
|
240
|
-
constructor() {
|
|
241
|
-
super();
|
|
242
|
-
}
|
|
243
|
-
get typeId() {
|
|
244
|
-
return enum_1.Type.Binary;
|
|
245
|
-
}
|
|
246
|
-
toString() {
|
|
247
|
-
return 'Binary';
|
|
248
|
-
}
|
|
249
|
-
get [Symbol.toStringTag]() {
|
|
250
|
-
return 'Binary';
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
exports.Binary = Binary;
|
|
254
|
-
// STRINGS
|
|
255
|
-
class Utf8 extends DataType {
|
|
256
|
-
get typeId() {
|
|
257
|
-
return enum_1.Type.Utf8;
|
|
258
|
-
}
|
|
259
|
-
// get ArrayType() {
|
|
260
|
-
// return Uint8Array;
|
|
261
|
-
// }
|
|
262
|
-
get [Symbol.toStringTag]() {
|
|
263
|
-
return 'Utf8';
|
|
264
|
-
}
|
|
265
|
-
toString() {
|
|
266
|
-
return 'Utf8';
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
exports.Utf8 = Utf8;
|
|
270
|
-
// DATES, TIMES AND INTERVALS
|
|
271
|
-
const DateUnit = {
|
|
272
|
-
DAY: 0,
|
|
273
|
-
MILLISECOND: 1
|
|
274
|
-
};
|
|
275
|
-
class Date extends DataType {
|
|
276
|
-
constructor(unit) {
|
|
277
|
-
super();
|
|
278
|
-
this.unit = unit;
|
|
279
|
-
}
|
|
280
|
-
get typeId() {
|
|
281
|
-
return enum_1.Type.Date;
|
|
282
|
-
}
|
|
283
|
-
// get ArrayType() {
|
|
284
|
-
// return Int32Array;
|
|
285
|
-
// }
|
|
286
|
-
get [Symbol.toStringTag]() {
|
|
287
|
-
return 'Date';
|
|
288
|
-
}
|
|
289
|
-
toString() {
|
|
290
|
-
return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
exports.Date = Date;
|
|
294
|
-
class DateDay extends Date {
|
|
295
|
-
constructor() {
|
|
296
|
-
super(DateUnit.DAY);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
exports.DateDay = DateDay;
|
|
300
|
-
class DateMillisecond extends Date {
|
|
301
|
-
constructor() {
|
|
302
|
-
super(DateUnit.MILLISECOND);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
exports.DateMillisecond = DateMillisecond;
|
|
306
|
-
const TimeUnit = {
|
|
307
|
-
SECOND: 1,
|
|
308
|
-
MILLISECOND: 1e3,
|
|
309
|
-
MICROSECOND: 1e6,
|
|
310
|
-
NANOSECOND: 1e9
|
|
311
|
-
};
|
|
312
|
-
class Time extends DataType {
|
|
313
|
-
constructor(unit, bitWidth) {
|
|
314
|
-
super();
|
|
315
|
-
this.unit = unit;
|
|
316
|
-
this.bitWidth = bitWidth;
|
|
317
|
-
}
|
|
318
|
-
get typeId() {
|
|
319
|
-
return enum_1.Type.Time;
|
|
320
|
-
}
|
|
321
|
-
toString() {
|
|
322
|
-
return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`;
|
|
323
|
-
}
|
|
324
|
-
get [Symbol.toStringTag]() {
|
|
325
|
-
return 'Time';
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
exports.Time = Time;
|
|
329
|
-
class TimeSecond extends Time {
|
|
330
|
-
constructor() {
|
|
331
|
-
super(TimeUnit.SECOND, 32);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
exports.TimeSecond = TimeSecond;
|
|
335
|
-
class TimeMillisecond extends Time {
|
|
336
|
-
constructor() {
|
|
337
|
-
super(TimeUnit.MILLISECOND, 32);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
exports.TimeMillisecond = TimeMillisecond;
|
|
341
|
-
// export class TimeMicrosecond extends Time { constructor() { super(TimeUnit.MICROSECOND, 64); } }
|
|
342
|
-
// export class TimeNanosecond extends Time { constructor() { super(TimeUnit.NANOSECOND, 64); } }
|
|
343
|
-
class Timestamp extends DataType {
|
|
344
|
-
constructor(unit, timezone = null) {
|
|
345
|
-
super();
|
|
346
|
-
this.unit = unit;
|
|
347
|
-
this.timezone = timezone;
|
|
348
|
-
}
|
|
349
|
-
get typeId() {
|
|
350
|
-
return enum_1.Type.Timestamp;
|
|
351
|
-
}
|
|
352
|
-
// get ArrayType() {
|
|
353
|
-
// return Int32Array;
|
|
354
|
-
// }
|
|
355
|
-
get [Symbol.toStringTag]() {
|
|
356
|
-
return 'Timestamp';
|
|
357
|
-
}
|
|
358
|
-
toString() {
|
|
359
|
-
return `Timestamp<${TimeUnit[this.unit]}${this.timezone ? `, ${this.timezone}` : ''}>`;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
exports.Timestamp = Timestamp;
|
|
363
|
-
class TimestampSecond extends Timestamp {
|
|
364
|
-
constructor(timezone = null) {
|
|
365
|
-
super(TimeUnit.SECOND, timezone);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
exports.TimestampSecond = TimestampSecond;
|
|
369
|
-
class TimestampMillisecond extends Timestamp {
|
|
370
|
-
constructor(timezone = null) {
|
|
371
|
-
super(TimeUnit.MILLISECOND, timezone);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
exports.TimestampMillisecond = TimestampMillisecond;
|
|
375
|
-
class TimestampMicrosecond extends Timestamp {
|
|
376
|
-
constructor(timezone = null) {
|
|
377
|
-
super(TimeUnit.MICROSECOND, timezone);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
exports.TimestampMicrosecond = TimestampMicrosecond;
|
|
381
|
-
class TimestampNanosecond extends Timestamp {
|
|
382
|
-
constructor(timezone = null) {
|
|
383
|
-
super(TimeUnit.NANOSECOND, timezone);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
exports.TimestampNanosecond = TimestampNanosecond;
|
|
387
|
-
const IntervalUnit = {
|
|
388
|
-
DAY_TIME: 0,
|
|
389
|
-
YEAR_MONTH: 1
|
|
390
|
-
};
|
|
391
|
-
class Interval extends DataType {
|
|
392
|
-
constructor(unit) {
|
|
393
|
-
super();
|
|
394
|
-
this.unit = unit;
|
|
395
|
-
}
|
|
396
|
-
get typeId() {
|
|
397
|
-
return enum_1.Type.Interval;
|
|
398
|
-
}
|
|
399
|
-
// get ArrayType() {
|
|
400
|
-
// return Int32Array;
|
|
401
|
-
// }
|
|
402
|
-
get [Symbol.toStringTag]() {
|
|
403
|
-
return 'Interval';
|
|
404
|
-
}
|
|
405
|
-
toString() {
|
|
406
|
-
return `Interval<${IntervalUnit[this.unit]}>`;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
exports.Interval = Interval;
|
|
410
|
-
class IntervalDayTime extends Interval {
|
|
411
|
-
constructor() {
|
|
412
|
-
super(IntervalUnit.DAY_TIME);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
exports.IntervalDayTime = IntervalDayTime;
|
|
416
|
-
class IntervalYearMonth extends Interval {
|
|
417
|
-
constructor() {
|
|
418
|
-
super(IntervalUnit.YEAR_MONTH);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
exports.IntervalYearMonth = IntervalYearMonth;
|
|
422
|
-
class FixedSizeList extends DataType {
|
|
423
|
-
constructor(listSize, child) {
|
|
424
|
-
super();
|
|
425
|
-
this.listSize = listSize;
|
|
426
|
-
this.children = [child];
|
|
427
|
-
}
|
|
428
|
-
get typeId() {
|
|
429
|
-
return enum_1.Type.FixedSizeList;
|
|
430
|
-
}
|
|
431
|
-
get valueType() {
|
|
432
|
-
return this.children[0].type;
|
|
433
|
-
}
|
|
434
|
-
get valueField() {
|
|
435
|
-
return this.children[0];
|
|
436
|
-
}
|
|
437
|
-
// get ArrayType() {
|
|
438
|
-
// return this.valueType.ArrayType;
|
|
439
|
-
// }
|
|
440
|
-
get [Symbol.toStringTag]() {
|
|
441
|
-
return 'FixedSizeList';
|
|
442
|
-
}
|
|
443
|
-
toString() {
|
|
444
|
-
return `FixedSizeList[${this.listSize}]<${this.valueType}>`;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
exports.FixedSizeList = FixedSizeList;
|
|
448
|
-
class Struct extends DataType {
|
|
449
|
-
constructor(children) {
|
|
450
|
-
super();
|
|
451
|
-
this.children = children;
|
|
452
|
-
}
|
|
453
|
-
get typeId() {
|
|
454
|
-
return enum_1.Type.Struct;
|
|
455
|
-
}
|
|
456
|
-
toString() {
|
|
457
|
-
return `Struct<{${this.children.map((f) => `${f.name}:${f.type}`).join(', ')}}>`;
|
|
458
|
-
}
|
|
459
|
-
get [Symbol.toStringTag]() {
|
|
460
|
-
return 'Struct';
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
exports.Struct = Struct;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This code is adapted from ArrowJS https://github.com/apache/arrow
|
|
3
|
-
// under Apache license http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.Type = void 0;
|
|
6
|
-
/**
|
|
7
|
-
* Main data type enumeration.
|
|
8
|
-
*
|
|
9
|
-
* Data types in this library are all *logical*. They can be expressed as
|
|
10
|
-
* either a primitive physical type (bytes or bits of some fixed size), a
|
|
11
|
-
* nested type consisting of other data types, or another data type (e.g. a
|
|
12
|
-
* timestamp encoded as an int64).
|
|
13
|
-
*
|
|
14
|
-
* **Note**: Only enum values 0-17 (NONE through Map) are written to an Arrow
|
|
15
|
-
* IPC payload.
|
|
16
|
-
*
|
|
17
|
-
* The rest of the values are specified here so TypeScript can narrow the type
|
|
18
|
-
* signatures further beyond the base Arrow Types. The Arrow DataTypes include
|
|
19
|
-
* metadata like `bitWidth` that impact the type signatures of the values we
|
|
20
|
-
* accept and return.
|
|
21
|
-
*
|
|
22
|
-
* For example, the `Int8Vector` reads 1-byte numbers from an `Int8Array`, an
|
|
23
|
-
* `Int32Vector` reads a 4-byte number from an `Int32Array`, and an `Int64Vector`
|
|
24
|
-
* reads a pair of 4-byte lo, hi 32-bit integers as a zero-copy slice from the
|
|
25
|
-
* underlying `Int32Array`.
|
|
26
|
-
*
|
|
27
|
-
* Library consumers benefit by knowing the narrowest type, since we can ensure
|
|
28
|
-
* the types across all public methods are propagated, and never bail to `any`.
|
|
29
|
-
* These values are _never_ used at runtime, and they will _never_ be written
|
|
30
|
-
* to the flatbuffers metadata of serialized Arrow IPC payloads.
|
|
31
|
-
*/
|
|
32
|
-
var Type;
|
|
33
|
-
(function (Type) {
|
|
34
|
-
/** The default placeholder type */
|
|
35
|
-
Type[Type["NONE"] = 0] = "NONE";
|
|
36
|
-
/** A NULL type having no physical storage */
|
|
37
|
-
Type[Type["Null"] = 1] = "Null";
|
|
38
|
-
/** Signed or unsigned 8, 16, 32, or 64-bit little-endian integer */
|
|
39
|
-
Type[Type["Int"] = 2] = "Int";
|
|
40
|
-
/** 2, 4, or 8-byte floating point value */
|
|
41
|
-
Type[Type["Float"] = 3] = "Float";
|
|
42
|
-
/** Variable-length bytes (no guarantee of UTF8-ness) */
|
|
43
|
-
Type[Type["Binary"] = 4] = "Binary";
|
|
44
|
-
/** UTF8 variable-length string as List<Char> */
|
|
45
|
-
Type[Type["Utf8"] = 5] = "Utf8";
|
|
46
|
-
/** Boolean as 1 bit, LSB bit-packed ordering */
|
|
47
|
-
Type[Type["Bool"] = 6] = "Bool";
|
|
48
|
-
/** Precision-and-scale-based decimal type. Storage type depends on the parameters. */
|
|
49
|
-
Type[Type["Decimal"] = 7] = "Decimal";
|
|
50
|
-
/** int32_t days or int64_t milliseconds since the UNIX epoch */
|
|
51
|
-
Type[Type["Date"] = 8] = "Date";
|
|
52
|
-
/** Time as signed 32 or 64-bit integer, representing either seconds, milliseconds, microseconds, or nanoseconds since midnight since midnight */
|
|
53
|
-
Type[Type["Time"] = 9] = "Time";
|
|
54
|
-
/** Exact timestamp encoded with int64 since UNIX epoch (Default unit millisecond) */
|
|
55
|
-
Type[Type["Timestamp"] = 10] = "Timestamp";
|
|
56
|
-
/** YEAR_MONTH or DAY_TIME interval in SQL style */
|
|
57
|
-
Type[Type["Interval"] = 11] = "Interval";
|
|
58
|
-
/** A list of some logical data type */
|
|
59
|
-
Type[Type["List"] = 12] = "List";
|
|
60
|
-
/** Struct of logical types */
|
|
61
|
-
Type[Type["Struct"] = 13] = "Struct";
|
|
62
|
-
/** Union of logical types */
|
|
63
|
-
Type[Type["Union"] = 14] = "Union";
|
|
64
|
-
/** Fixed-size binary. Each value occupies the same number of bytes */
|
|
65
|
-
Type[Type["FixedSizeBinary"] = 15] = "FixedSizeBinary";
|
|
66
|
-
/** Fixed-size list. Each value occupies the same number of bytes */
|
|
67
|
-
Type[Type["FixedSizeList"] = 16] = "FixedSizeList";
|
|
68
|
-
/** Map of named logical types */
|
|
69
|
-
Type[Type["Map"] = 17] = "Map";
|
|
70
|
-
/** Dictionary aka Category type */
|
|
71
|
-
Type[Type["Dictionary"] = -1] = "Dictionary";
|
|
72
|
-
Type[Type["Int8"] = -2] = "Int8";
|
|
73
|
-
Type[Type["Int16"] = -3] = "Int16";
|
|
74
|
-
Type[Type["Int32"] = -4] = "Int32";
|
|
75
|
-
Type[Type["Int64"] = -5] = "Int64";
|
|
76
|
-
Type[Type["Uint8"] = -6] = "Uint8";
|
|
77
|
-
Type[Type["Uint16"] = -7] = "Uint16";
|
|
78
|
-
Type[Type["Uint32"] = -8] = "Uint32";
|
|
79
|
-
Type[Type["Uint64"] = -9] = "Uint64";
|
|
80
|
-
Type[Type["Float16"] = -10] = "Float16";
|
|
81
|
-
Type[Type["Float32"] = -11] = "Float32";
|
|
82
|
-
Type[Type["Float64"] = -12] = "Float64";
|
|
83
|
-
Type[Type["DateDay"] = -13] = "DateDay";
|
|
84
|
-
Type[Type["DateMillisecond"] = -14] = "DateMillisecond";
|
|
85
|
-
Type[Type["TimestampSecond"] = -15] = "TimestampSecond";
|
|
86
|
-
Type[Type["TimestampMillisecond"] = -16] = "TimestampMillisecond";
|
|
87
|
-
Type[Type["TimestampMicrosecond"] = -17] = "TimestampMicrosecond";
|
|
88
|
-
Type[Type["TimestampNanosecond"] = -18] = "TimestampNanosecond";
|
|
89
|
-
Type[Type["TimeSecond"] = -19] = "TimeSecond";
|
|
90
|
-
Type[Type["TimeMillisecond"] = -20] = "TimeMillisecond";
|
|
91
|
-
Type[Type["TimeMicrosecond"] = -21] = "TimeMicrosecond";
|
|
92
|
-
Type[Type["TimeNanosecond"] = -22] = "TimeNanosecond";
|
|
93
|
-
Type[Type["DenseUnion"] = -23] = "DenseUnion";
|
|
94
|
-
Type[Type["SparseUnion"] = -24] = "SparseUnion";
|
|
95
|
-
Type[Type["IntervalDayTime"] = -25] = "IntervalDayTime";
|
|
96
|
-
Type[Type["IntervalYearMonth"] = -26] = "IntervalYearMonth";
|
|
97
|
-
})(Type = exports.Type || (exports.Type = {}));
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getTypeInfo = void 0;
|
|
5
|
-
const arrow_like_type_1 = require("./arrow-like-type");
|
|
6
|
-
/**
|
|
7
|
-
* Gets type information from an Arrow type object or "mock" Arrow type object
|
|
8
|
-
* @param arrowTypeLike Arrow Type or type object of similar shape
|
|
9
|
-
*/
|
|
10
|
-
function getTypeInfo(arrowTypeLike) {
|
|
11
|
-
return {
|
|
12
|
-
typeId: arrowTypeLike.typeId,
|
|
13
|
-
ArrayType: arrowTypeLike.ArrayType,
|
|
14
|
-
typeName: arrowTypeLike.toString(),
|
|
15
|
-
typeEnumName: getTypeKey(arrowTypeLike.typeId),
|
|
16
|
-
precision: arrowTypeLike.precision
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
exports.getTypeInfo = getTypeInfo;
|
|
20
|
-
let ReverseType = null;
|
|
21
|
-
function getTypeKey(typeKey) {
|
|
22
|
-
if (!ReverseType) {
|
|
23
|
-
ReverseType = {};
|
|
24
|
-
for (const key in arrow_like_type_1.Type) {
|
|
25
|
-
ReverseType[arrow_like_type_1.Type[key]] = key;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return ReverseType[typeKey];
|
|
29
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.Table = exports.Schema = exports.Field = void 0;
|
|
19
|
-
var arrow_like_field_1 = require("./arrow-like-field");
|
|
20
|
-
Object.defineProperty(exports, "Field", { enumerable: true, get: function () { return arrow_like_field_1.ArrowLikeField; } });
|
|
21
|
-
var arrow_like_schema_1 = require("./arrow-like-schema");
|
|
22
|
-
Object.defineProperty(exports, "Schema", { enumerable: true, get: function () { return arrow_like_schema_1.ArrowLikeSchema; } });
|
|
23
|
-
var arrow_like_table_1 = require("./arrow-like-table");
|
|
24
|
-
Object.defineProperty(exports, "Table", { enumerable: true, get: function () { return arrow_like_table_1.ArrowLikeTable; } });
|
|
25
|
-
__exportStar(require("./arrow-like-type"), exports);
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.BaseTableBatchAggregator = void 0;
|
|
5
|
-
const DEFAULT_ROW_COUNT = 100;
|
|
6
|
-
class BaseTableBatchAggregator {
|
|
7
|
-
constructor(schema, options) {
|
|
8
|
-
this.length = 0;
|
|
9
|
-
this.rows = null;
|
|
10
|
-
this.cursor = 0;
|
|
11
|
-
this._headers = [];
|
|
12
|
-
this.options = options;
|
|
13
|
-
this.schema = schema;
|
|
14
|
-
// schema is an array if there're no headers
|
|
15
|
-
// object if there are headers
|
|
16
|
-
if (!Array.isArray(schema)) {
|
|
17
|
-
this._headers = [];
|
|
18
|
-
for (const key in schema) {
|
|
19
|
-
this._headers[schema[key].index] = schema[key].name;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
rowCount() {
|
|
24
|
-
return this.length;
|
|
25
|
-
}
|
|
26
|
-
addArrayRow(row, cursor) {
|
|
27
|
-
if (Number.isFinite(cursor)) {
|
|
28
|
-
this.cursor = cursor;
|
|
29
|
-
}
|
|
30
|
-
this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
|
|
31
|
-
this.rows[this.length] = row;
|
|
32
|
-
this.length++;
|
|
33
|
-
}
|
|
34
|
-
addObjectRow(row, cursor) {
|
|
35
|
-
if (Number.isFinite(cursor)) {
|
|
36
|
-
this.cursor = cursor;
|
|
37
|
-
}
|
|
38
|
-
this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
|
|
39
|
-
this.rows[this.length] = row;
|
|
40
|
-
this.length++;
|
|
41
|
-
}
|
|
42
|
-
getBatch() {
|
|
43
|
-
let rows = this.rows;
|
|
44
|
-
if (!rows) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
rows = rows.slice(0, this.length);
|
|
48
|
-
this.rows = null;
|
|
49
|
-
const batch = {
|
|
50
|
-
shape: this.options.shape,
|
|
51
|
-
batchType: 'data',
|
|
52
|
-
data: rows,
|
|
53
|
-
length: this.length,
|
|
54
|
-
schema: this.schema,
|
|
55
|
-
cursor: this.cursor
|
|
56
|
-
};
|
|
57
|
-
return batch;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.BaseTableBatchAggregator = BaseTableBatchAggregator;
|