@loaders.gl/schema 3.4.11 → 3.4.12
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/package.json +2 -2
- package/dist/bundle.js +0 -5
- package/dist/category/common.js +0 -10
- package/dist/category/gis.js +0 -2
- package/dist/category/image/image.js +0 -2
- package/dist/category/mesh/convert-mesh.js +0 -40
- package/dist/category/mesh/deduce-mesh-schema.js +0 -62
- package/dist/category/mesh/mesh-to-arrow-table.js +0 -34
- package/dist/category/mesh/mesh-types.js +0 -2
- package/dist/category/mesh/mesh-utils.js +0 -51
- package/dist/category/table/deduce-table-schema.js +0 -106
- package/dist/category/table/table-types.js +0 -2
- package/dist/category/texture/texture.js +0 -2
- package/dist/index.js +0 -75
- package/dist/lib/arrow/arrow-like-type-utils.js +0 -27
- package/dist/lib/arrow/arrow-type-utils.js +0 -50
- package/dist/lib/arrow/get-type-info.js +0 -28
- package/dist/lib/batches/base-table-batch-aggregator.js +0 -58
- package/dist/lib/batches/columnar-table-batch-aggregator.js +0 -90
- package/dist/lib/batches/row-table-batch-aggregator.js +0 -79
- package/dist/lib/batches/table-batch-aggregator.js +0 -2
- package/dist/lib/batches/table-batch-builder.js +0 -153
- package/dist/lib/schema/impl/enum.js +0 -97
- package/dist/lib/schema/impl/field.js +0 -32
- package/dist/lib/schema/impl/schema.js +0 -83
- package/dist/lib/schema/impl/type.js +0 -462
- package/dist/lib/schema/schema.js +0 -90
- package/dist/lib/schema-utils/deduce-column-type.js +0 -92
- package/dist/lib/utils/assert.js +0 -12
- package/dist/lib/utils/async-queue.js +0 -92
- package/dist/lib/utils/row-utils.js +0 -33
- package/dist/types.js +0 -2
|
@@ -1,462 +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
|
-
class DataType {
|
|
10
|
-
static isNull(x) {
|
|
11
|
-
return x && x.typeId === enum_1.Type.Null;
|
|
12
|
-
}
|
|
13
|
-
static isInt(x) {
|
|
14
|
-
return x && x.typeId === enum_1.Type.Int;
|
|
15
|
-
}
|
|
16
|
-
static isFloat(x) {
|
|
17
|
-
return x && x.typeId === enum_1.Type.Float;
|
|
18
|
-
}
|
|
19
|
-
static isBinary(x) {
|
|
20
|
-
return x && x.typeId === enum_1.Type.Binary;
|
|
21
|
-
}
|
|
22
|
-
static isUtf8(x) {
|
|
23
|
-
return x && x.typeId === enum_1.Type.Utf8;
|
|
24
|
-
}
|
|
25
|
-
static isBool(x) {
|
|
26
|
-
return x && x.typeId === enum_1.Type.Bool;
|
|
27
|
-
}
|
|
28
|
-
static isDecimal(x) {
|
|
29
|
-
return x && x.typeId === enum_1.Type.Decimal;
|
|
30
|
-
}
|
|
31
|
-
static isDate(x) {
|
|
32
|
-
return x && x.typeId === enum_1.Type.Date;
|
|
33
|
-
}
|
|
34
|
-
static isTime(x) {
|
|
35
|
-
return x && x.typeId === enum_1.Type.Time;
|
|
36
|
-
}
|
|
37
|
-
static isTimestamp(x) {
|
|
38
|
-
return x && x.typeId === enum_1.Type.Timestamp;
|
|
39
|
-
}
|
|
40
|
-
static isInterval(x) {
|
|
41
|
-
return x && x.typeId === enum_1.Type.Interval;
|
|
42
|
-
}
|
|
43
|
-
static isList(x) {
|
|
44
|
-
return x && x.typeId === enum_1.Type.List;
|
|
45
|
-
}
|
|
46
|
-
static isStruct(x) {
|
|
47
|
-
return x && x.typeId === enum_1.Type.Struct;
|
|
48
|
-
}
|
|
49
|
-
static isUnion(x) {
|
|
50
|
-
return x && x.typeId === enum_1.Type.Union;
|
|
51
|
-
}
|
|
52
|
-
static isFixedSizeBinary(x) {
|
|
53
|
-
return x && x.typeId === enum_1.Type.FixedSizeBinary;
|
|
54
|
-
}
|
|
55
|
-
static isFixedSizeList(x) {
|
|
56
|
-
return x && x.typeId === enum_1.Type.FixedSizeList;
|
|
57
|
-
}
|
|
58
|
-
static isMap(x) {
|
|
59
|
-
return x && x.typeId === enum_1.Type.Map;
|
|
60
|
-
}
|
|
61
|
-
static isDictionary(x) {
|
|
62
|
-
return x && x.typeId === enum_1.Type.Dictionary;
|
|
63
|
-
}
|
|
64
|
-
get typeId() {
|
|
65
|
-
return enum_1.Type.NONE;
|
|
66
|
-
}
|
|
67
|
-
// get ArrayType(): AnyArrayType {
|
|
68
|
-
// return Int8Array;
|
|
69
|
-
// }
|
|
70
|
-
// get ArrayType() { return Array; }
|
|
71
|
-
compareTo(other) {
|
|
72
|
-
// TODO
|
|
73
|
-
return this === other; // comparer.visit(this, other);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.DataType = DataType;
|
|
77
|
-
// NULL
|
|
78
|
-
class Null extends DataType {
|
|
79
|
-
get typeId() {
|
|
80
|
-
return enum_1.Type.Null;
|
|
81
|
-
}
|
|
82
|
-
get [Symbol.toStringTag]() {
|
|
83
|
-
return 'Null';
|
|
84
|
-
}
|
|
85
|
-
toString() {
|
|
86
|
-
return 'Null';
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
exports.Null = Null;
|
|
90
|
-
// BOOLEANS
|
|
91
|
-
class Bool extends DataType {
|
|
92
|
-
get typeId() {
|
|
93
|
-
return enum_1.Type.Bool;
|
|
94
|
-
}
|
|
95
|
-
// get ArrayType() {
|
|
96
|
-
// return Uint8Array;
|
|
97
|
-
// }
|
|
98
|
-
get [Symbol.toStringTag]() {
|
|
99
|
-
return 'Bool';
|
|
100
|
-
}
|
|
101
|
-
toString() {
|
|
102
|
-
return 'Bool';
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
exports.Bool = Bool;
|
|
106
|
-
// INTS
|
|
107
|
-
class Int extends DataType {
|
|
108
|
-
constructor(isSigned, bitWidth) {
|
|
109
|
-
super();
|
|
110
|
-
this.isSigned = isSigned;
|
|
111
|
-
this.bitWidth = bitWidth;
|
|
112
|
-
}
|
|
113
|
-
get typeId() {
|
|
114
|
-
return enum_1.Type.Int;
|
|
115
|
-
}
|
|
116
|
-
// get ArrayType() {
|
|
117
|
-
// switch (this.bitWidth) {
|
|
118
|
-
// case 8:
|
|
119
|
-
// return this.isSigned ? Int8Array : Uint8Array;
|
|
120
|
-
// case 16:
|
|
121
|
-
// return this.isSigned ? Int16Array : Uint16Array;
|
|
122
|
-
// case 32:
|
|
123
|
-
// return this.isSigned ? Int32Array : Uint32Array;
|
|
124
|
-
// case 64:
|
|
125
|
-
// return this.isSigned ? Int32Array : Uint32Array;
|
|
126
|
-
// default:
|
|
127
|
-
// throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);
|
|
128
|
-
// }
|
|
129
|
-
// }
|
|
130
|
-
get [Symbol.toStringTag]() {
|
|
131
|
-
return 'Int';
|
|
132
|
-
}
|
|
133
|
-
toString() {
|
|
134
|
-
return `${this.isSigned ? 'I' : 'Ui'}nt${this.bitWidth}`;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
exports.Int = Int;
|
|
138
|
-
class Int8 extends Int {
|
|
139
|
-
constructor() {
|
|
140
|
-
super(true, 8);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
exports.Int8 = Int8;
|
|
144
|
-
class Int16 extends Int {
|
|
145
|
-
constructor() {
|
|
146
|
-
super(true, 16);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
exports.Int16 = Int16;
|
|
150
|
-
class Int32 extends Int {
|
|
151
|
-
constructor() {
|
|
152
|
-
super(true, 32);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
exports.Int32 = Int32;
|
|
156
|
-
class Int64 extends Int {
|
|
157
|
-
constructor() {
|
|
158
|
-
super(true, 64);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
exports.Int64 = Int64;
|
|
162
|
-
class Uint8 extends Int {
|
|
163
|
-
constructor() {
|
|
164
|
-
super(false, 8);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
exports.Uint8 = Uint8;
|
|
168
|
-
class Uint16 extends Int {
|
|
169
|
-
constructor() {
|
|
170
|
-
super(false, 16);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
exports.Uint16 = Uint16;
|
|
174
|
-
class Uint32 extends Int {
|
|
175
|
-
constructor() {
|
|
176
|
-
super(false, 32);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
exports.Uint32 = Uint32;
|
|
180
|
-
class Uint64 extends Int {
|
|
181
|
-
constructor() {
|
|
182
|
-
super(false, 64);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
exports.Uint64 = Uint64;
|
|
186
|
-
// FLOATS
|
|
187
|
-
const Precision = {
|
|
188
|
-
HALF: 16,
|
|
189
|
-
SINGLE: 32,
|
|
190
|
-
DOUBLE: 64
|
|
191
|
-
};
|
|
192
|
-
class Float extends DataType {
|
|
193
|
-
constructor(precision) {
|
|
194
|
-
super();
|
|
195
|
-
this.precision = precision;
|
|
196
|
-
}
|
|
197
|
-
get typeId() {
|
|
198
|
-
return enum_1.Type.Float;
|
|
199
|
-
}
|
|
200
|
-
// get ArrayType() {
|
|
201
|
-
// switch (this.precision) {
|
|
202
|
-
// case Precision.HALF:
|
|
203
|
-
// return Uint16Array;
|
|
204
|
-
// case Precision.SINGLE:
|
|
205
|
-
// return Float32Array;
|
|
206
|
-
// case Precision.DOUBLE:
|
|
207
|
-
// return Float64Array;
|
|
208
|
-
// default:
|
|
209
|
-
// throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);
|
|
210
|
-
// }
|
|
211
|
-
// }
|
|
212
|
-
get [Symbol.toStringTag]() {
|
|
213
|
-
return 'Float';
|
|
214
|
-
}
|
|
215
|
-
toString() {
|
|
216
|
-
return `Float${this.precision}`;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
exports.Float = Float;
|
|
220
|
-
class Float16 extends Float {
|
|
221
|
-
constructor() {
|
|
222
|
-
super(Precision.HALF);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
exports.Float16 = Float16;
|
|
226
|
-
class Float32 extends Float {
|
|
227
|
-
constructor() {
|
|
228
|
-
super(Precision.SINGLE);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
exports.Float32 = Float32;
|
|
232
|
-
class Float64 extends Float {
|
|
233
|
-
constructor() {
|
|
234
|
-
super(Precision.DOUBLE);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
exports.Float64 = Float64;
|
|
238
|
-
class Binary extends DataType {
|
|
239
|
-
constructor() {
|
|
240
|
-
super();
|
|
241
|
-
}
|
|
242
|
-
get typeId() {
|
|
243
|
-
return enum_1.Type.Binary;
|
|
244
|
-
}
|
|
245
|
-
toString() {
|
|
246
|
-
return 'Binary';
|
|
247
|
-
}
|
|
248
|
-
get [Symbol.toStringTag]() {
|
|
249
|
-
return 'Binary';
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
exports.Binary = Binary;
|
|
253
|
-
// STRINGS
|
|
254
|
-
class Utf8 extends DataType {
|
|
255
|
-
get typeId() {
|
|
256
|
-
return enum_1.Type.Utf8;
|
|
257
|
-
}
|
|
258
|
-
// get ArrayType() {
|
|
259
|
-
// return Uint8Array;
|
|
260
|
-
// }
|
|
261
|
-
get [Symbol.toStringTag]() {
|
|
262
|
-
return 'Utf8';
|
|
263
|
-
}
|
|
264
|
-
toString() {
|
|
265
|
-
return 'Utf8';
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
exports.Utf8 = Utf8;
|
|
269
|
-
// DATES, TIMES AND INTERVALS
|
|
270
|
-
const DateUnit = {
|
|
271
|
-
DAY: 0,
|
|
272
|
-
MILLISECOND: 1
|
|
273
|
-
};
|
|
274
|
-
class Date extends DataType {
|
|
275
|
-
constructor(unit) {
|
|
276
|
-
super();
|
|
277
|
-
this.unit = unit;
|
|
278
|
-
}
|
|
279
|
-
get typeId() {
|
|
280
|
-
return enum_1.Type.Date;
|
|
281
|
-
}
|
|
282
|
-
// get ArrayType() {
|
|
283
|
-
// return Int32Array;
|
|
284
|
-
// }
|
|
285
|
-
get [Symbol.toStringTag]() {
|
|
286
|
-
return 'Date';
|
|
287
|
-
}
|
|
288
|
-
toString() {
|
|
289
|
-
return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
exports.Date = Date;
|
|
293
|
-
class DateDay extends Date {
|
|
294
|
-
constructor() {
|
|
295
|
-
super(DateUnit.DAY);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
exports.DateDay = DateDay;
|
|
299
|
-
class DateMillisecond extends Date {
|
|
300
|
-
constructor() {
|
|
301
|
-
super(DateUnit.MILLISECOND);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
exports.DateMillisecond = DateMillisecond;
|
|
305
|
-
const TimeUnit = {
|
|
306
|
-
SECOND: 1,
|
|
307
|
-
MILLISECOND: 1e3,
|
|
308
|
-
MICROSECOND: 1e6,
|
|
309
|
-
NANOSECOND: 1e9
|
|
310
|
-
};
|
|
311
|
-
class Time extends DataType {
|
|
312
|
-
constructor(unit, bitWidth) {
|
|
313
|
-
super();
|
|
314
|
-
this.unit = unit;
|
|
315
|
-
this.bitWidth = bitWidth;
|
|
316
|
-
}
|
|
317
|
-
get typeId() {
|
|
318
|
-
return enum_1.Type.Time;
|
|
319
|
-
}
|
|
320
|
-
toString() {
|
|
321
|
-
return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`;
|
|
322
|
-
}
|
|
323
|
-
get [Symbol.toStringTag]() {
|
|
324
|
-
return 'Time';
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
exports.Time = Time;
|
|
328
|
-
class TimeSecond extends Time {
|
|
329
|
-
constructor() {
|
|
330
|
-
super(TimeUnit.SECOND, 32);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
exports.TimeSecond = TimeSecond;
|
|
334
|
-
class TimeMillisecond extends Time {
|
|
335
|
-
constructor() {
|
|
336
|
-
super(TimeUnit.MILLISECOND, 32);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
exports.TimeMillisecond = TimeMillisecond;
|
|
340
|
-
// export class TimeMicrosecond extends Time { constructor() { super(TimeUnit.MICROSECOND, 64); } }
|
|
341
|
-
// export class TimeNanosecond extends Time { constructor() { super(TimeUnit.NANOSECOND, 64); } }
|
|
342
|
-
class Timestamp extends DataType {
|
|
343
|
-
constructor(unit, timezone = null) {
|
|
344
|
-
super();
|
|
345
|
-
this.unit = unit;
|
|
346
|
-
this.timezone = timezone;
|
|
347
|
-
}
|
|
348
|
-
get typeId() {
|
|
349
|
-
return enum_1.Type.Timestamp;
|
|
350
|
-
}
|
|
351
|
-
// get ArrayType() {
|
|
352
|
-
// return Int32Array;
|
|
353
|
-
// }
|
|
354
|
-
get [Symbol.toStringTag]() {
|
|
355
|
-
return 'Timestamp';
|
|
356
|
-
}
|
|
357
|
-
toString() {
|
|
358
|
-
return `Timestamp<${TimeUnit[this.unit]}${this.timezone ? `, ${this.timezone}` : ''}>`;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
exports.Timestamp = Timestamp;
|
|
362
|
-
class TimestampSecond extends Timestamp {
|
|
363
|
-
constructor(timezone = null) {
|
|
364
|
-
super(TimeUnit.SECOND, timezone);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
exports.TimestampSecond = TimestampSecond;
|
|
368
|
-
class TimestampMillisecond extends Timestamp {
|
|
369
|
-
constructor(timezone = null) {
|
|
370
|
-
super(TimeUnit.MILLISECOND, timezone);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
exports.TimestampMillisecond = TimestampMillisecond;
|
|
374
|
-
class TimestampMicrosecond extends Timestamp {
|
|
375
|
-
constructor(timezone = null) {
|
|
376
|
-
super(TimeUnit.MICROSECOND, timezone);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
exports.TimestampMicrosecond = TimestampMicrosecond;
|
|
380
|
-
class TimestampNanosecond extends Timestamp {
|
|
381
|
-
constructor(timezone = null) {
|
|
382
|
-
super(TimeUnit.NANOSECOND, timezone);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
exports.TimestampNanosecond = TimestampNanosecond;
|
|
386
|
-
const IntervalUnit = {
|
|
387
|
-
DAY_TIME: 0,
|
|
388
|
-
YEAR_MONTH: 1
|
|
389
|
-
};
|
|
390
|
-
class Interval extends DataType {
|
|
391
|
-
constructor(unit) {
|
|
392
|
-
super();
|
|
393
|
-
this.unit = unit;
|
|
394
|
-
}
|
|
395
|
-
get typeId() {
|
|
396
|
-
return enum_1.Type.Interval;
|
|
397
|
-
}
|
|
398
|
-
// get ArrayType() {
|
|
399
|
-
// return Int32Array;
|
|
400
|
-
// }
|
|
401
|
-
get [Symbol.toStringTag]() {
|
|
402
|
-
return 'Interval';
|
|
403
|
-
}
|
|
404
|
-
toString() {
|
|
405
|
-
return `Interval<${IntervalUnit[this.unit]}>`;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
exports.Interval = Interval;
|
|
409
|
-
class IntervalDayTime extends Interval {
|
|
410
|
-
constructor() {
|
|
411
|
-
super(IntervalUnit.DAY_TIME);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
exports.IntervalDayTime = IntervalDayTime;
|
|
415
|
-
class IntervalYearMonth extends Interval {
|
|
416
|
-
constructor() {
|
|
417
|
-
super(IntervalUnit.YEAR_MONTH);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
exports.IntervalYearMonth = IntervalYearMonth;
|
|
421
|
-
class FixedSizeList extends DataType {
|
|
422
|
-
constructor(listSize, child) {
|
|
423
|
-
super();
|
|
424
|
-
this.listSize = listSize;
|
|
425
|
-
this.children = [child];
|
|
426
|
-
}
|
|
427
|
-
get typeId() {
|
|
428
|
-
return enum_1.Type.FixedSizeList;
|
|
429
|
-
}
|
|
430
|
-
get valueType() {
|
|
431
|
-
return this.children[0].type;
|
|
432
|
-
}
|
|
433
|
-
get valueField() {
|
|
434
|
-
return this.children[0];
|
|
435
|
-
}
|
|
436
|
-
// get ArrayType() {
|
|
437
|
-
// return this.valueType.ArrayType;
|
|
438
|
-
// }
|
|
439
|
-
get [Symbol.toStringTag]() {
|
|
440
|
-
return 'FixedSizeList';
|
|
441
|
-
}
|
|
442
|
-
toString() {
|
|
443
|
-
return `FixedSizeList[${this.listSize}]<${this.valueType}>`;
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
exports.FixedSizeList = FixedSizeList;
|
|
447
|
-
class Struct extends DataType {
|
|
448
|
-
constructor(children) {
|
|
449
|
-
super();
|
|
450
|
-
this.children = children;
|
|
451
|
-
}
|
|
452
|
-
get typeId() {
|
|
453
|
-
return enum_1.Type.Struct;
|
|
454
|
-
}
|
|
455
|
-
toString() {
|
|
456
|
-
return `Struct<{${this.children.map((f) => `${f.name}:${f.type}`).join(', ')}}>`;
|
|
457
|
-
}
|
|
458
|
-
get [Symbol.toStringTag]() {
|
|
459
|
-
return 'Struct';
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
exports.Struct = Struct;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
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 = exports.Field = exports.Schema = void 0;
|
|
7
|
-
/*
|
|
8
|
-
export {
|
|
9
|
-
Schema,
|
|
10
|
-
Field,
|
|
11
|
-
DataType,
|
|
12
|
-
Null,
|
|
13
|
-
Bool,
|
|
14
|
-
Int,
|
|
15
|
-
Int8,
|
|
16
|
-
Int16,
|
|
17
|
-
Int32,
|
|
18
|
-
Int64,
|
|
19
|
-
Uint8,
|
|
20
|
-
Uint16,
|
|
21
|
-
Uint32,
|
|
22
|
-
Uint64,
|
|
23
|
-
Float,
|
|
24
|
-
Float16,
|
|
25
|
-
Float32,
|
|
26
|
-
Float64,
|
|
27
|
-
Binary,
|
|
28
|
-
Utf8,
|
|
29
|
-
Date,
|
|
30
|
-
DateDay,
|
|
31
|
-
DateMillisecond,
|
|
32
|
-
Time,
|
|
33
|
-
TimeSecond,
|
|
34
|
-
TimeMillisecond,
|
|
35
|
-
TimeMicrosecond,
|
|
36
|
-
TimeNanosecond,
|
|
37
|
-
Timestamp,
|
|
38
|
-
TimestampSecond,
|
|
39
|
-
TimestampMillisecond,
|
|
40
|
-
TimestampMicrosecond,
|
|
41
|
-
TimestampNanosecond,
|
|
42
|
-
Interval,
|
|
43
|
-
IntervalDayTime,
|
|
44
|
-
IntervalYearMonth,
|
|
45
|
-
FixedSizeList
|
|
46
|
-
} from 'apache-arrow';
|
|
47
|
-
*/
|
|
48
|
-
var schema_1 = require("./impl/schema");
|
|
49
|
-
Object.defineProperty(exports, "Schema", { enumerable: true, get: function () { return __importDefault(schema_1).default; } });
|
|
50
|
-
var field_1 = require("./impl/field");
|
|
51
|
-
Object.defineProperty(exports, "Field", { enumerable: true, get: function () { return __importDefault(field_1).default; } });
|
|
52
|
-
var type_1 = require("./impl/type");
|
|
53
|
-
Object.defineProperty(exports, "Type", { enumerable: true, get: function () { return type_1.Type; } });
|
|
54
|
-
var type_2 = require("./impl/type");
|
|
55
|
-
Object.defineProperty(exports, "DataType", { enumerable: true, get: function () { return type_2.DataType; } });
|
|
56
|
-
Object.defineProperty(exports, "Null", { enumerable: true, get: function () { return type_2.Null; } });
|
|
57
|
-
Object.defineProperty(exports, "Bool", { enumerable: true, get: function () { return type_2.Bool; } });
|
|
58
|
-
Object.defineProperty(exports, "Int", { enumerable: true, get: function () { return type_2.Int; } });
|
|
59
|
-
Object.defineProperty(exports, "Int8", { enumerable: true, get: function () { return type_2.Int8; } });
|
|
60
|
-
Object.defineProperty(exports, "Int16", { enumerable: true, get: function () { return type_2.Int16; } });
|
|
61
|
-
Object.defineProperty(exports, "Int32", { enumerable: true, get: function () { return type_2.Int32; } });
|
|
62
|
-
Object.defineProperty(exports, "Int64", { enumerable: true, get: function () { return type_2.Int64; } });
|
|
63
|
-
Object.defineProperty(exports, "Uint8", { enumerable: true, get: function () { return type_2.Uint8; } });
|
|
64
|
-
Object.defineProperty(exports, "Uint16", { enumerable: true, get: function () { return type_2.Uint16; } });
|
|
65
|
-
Object.defineProperty(exports, "Uint32", { enumerable: true, get: function () { return type_2.Uint32; } });
|
|
66
|
-
Object.defineProperty(exports, "Uint64", { enumerable: true, get: function () { return type_2.Uint64; } });
|
|
67
|
-
Object.defineProperty(exports, "Float", { enumerable: true, get: function () { return type_2.Float; } });
|
|
68
|
-
Object.defineProperty(exports, "Float16", { enumerable: true, get: function () { return type_2.Float16; } });
|
|
69
|
-
Object.defineProperty(exports, "Float32", { enumerable: true, get: function () { return type_2.Float32; } });
|
|
70
|
-
Object.defineProperty(exports, "Float64", { enumerable: true, get: function () { return type_2.Float64; } });
|
|
71
|
-
Object.defineProperty(exports, "Binary", { enumerable: true, get: function () { return type_2.Binary; } });
|
|
72
|
-
Object.defineProperty(exports, "Utf8", { enumerable: true, get: function () { return type_2.Utf8; } });
|
|
73
|
-
Object.defineProperty(exports, "Date", { enumerable: true, get: function () { return type_2.Date; } });
|
|
74
|
-
Object.defineProperty(exports, "DateDay", { enumerable: true, get: function () { return type_2.DateDay; } });
|
|
75
|
-
Object.defineProperty(exports, "DateMillisecond", { enumerable: true, get: function () { return type_2.DateMillisecond; } });
|
|
76
|
-
Object.defineProperty(exports, "Time", { enumerable: true, get: function () { return type_2.Time; } });
|
|
77
|
-
Object.defineProperty(exports, "TimeSecond", { enumerable: true, get: function () { return type_2.TimeSecond; } });
|
|
78
|
-
Object.defineProperty(exports, "TimeMillisecond", { enumerable: true, get: function () { return type_2.TimeMillisecond; } });
|
|
79
|
-
// TimeMicrosecond,
|
|
80
|
-
// TimeNanosecond,
|
|
81
|
-
Object.defineProperty(exports, "Timestamp", { enumerable: true, get: function () { return type_2.Timestamp; } });
|
|
82
|
-
Object.defineProperty(exports, "TimestampSecond", { enumerable: true, get: function () { return type_2.TimestampSecond; } });
|
|
83
|
-
Object.defineProperty(exports, "TimestampMillisecond", { enumerable: true, get: function () { return type_2.TimestampMillisecond; } });
|
|
84
|
-
Object.defineProperty(exports, "TimestampMicrosecond", { enumerable: true, get: function () { return type_2.TimestampMicrosecond; } });
|
|
85
|
-
Object.defineProperty(exports, "TimestampNanosecond", { enumerable: true, get: function () { return type_2.TimestampNanosecond; } });
|
|
86
|
-
Object.defineProperty(exports, "Interval", { enumerable: true, get: function () { return type_2.Interval; } });
|
|
87
|
-
Object.defineProperty(exports, "IntervalDayTime", { enumerable: true, get: function () { return type_2.IntervalDayTime; } });
|
|
88
|
-
Object.defineProperty(exports, "IntervalYearMonth", { enumerable: true, get: function () { return type_2.IntervalYearMonth; } });
|
|
89
|
-
Object.defineProperty(exports, "FixedSizeList", { enumerable: true, get: function () { return type_2.FixedSizeList; } });
|
|
90
|
-
Object.defineProperty(exports, "Struct", { enumerable: true, get: function () { return type_2.Struct; } });
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Type deduction
|
|
3
|
-
// import {
|
|
4
|
-
// Schema
|
|
5
|
-
// Int,
|
|
6
|
-
// Int8,
|
|
7
|
-
// Int16,
|
|
8
|
-
// Int32,
|
|
9
|
-
// Uint8,
|
|
10
|
-
// Uint16,
|
|
11
|
-
// Uint32,
|
|
12
|
-
// Float32,
|
|
13
|
-
// Float64
|
|
14
|
-
// Bool,
|
|
15
|
-
// Utf8,
|
|
16
|
-
// TimestampMillisecond,
|
|
17
|
-
// Null
|
|
18
|
-
// } from '../schema';
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.deduceTypeFromValue = exports.deduceTypeFromColumn = void 0;
|
|
21
|
-
// const TYPED_ARRAY_TO_TYPE = {
|
|
22
|
-
// Int8Array: new Int8(),
|
|
23
|
-
// Int16Array: new Int16(),
|
|
24
|
-
// Int32Array: new Int32(),
|
|
25
|
-
// Uint8Array: new Uint8(),
|
|
26
|
-
// Uint8ClampedArray: new Uint8(),
|
|
27
|
-
// Uint16Array: new Uint16(),
|
|
28
|
-
// Uint32Array: new Uint32(),
|
|
29
|
-
// Float32Array: new Float32(),
|
|
30
|
-
// Float64Array: new Float64()
|
|
31
|
-
// };
|
|
32
|
-
// if (typeof BigInt64Array !== 'undefined') {
|
|
33
|
-
// TYPED_ARRAY_TO_TYPE.BigInt64Array = new Int64();
|
|
34
|
-
// TYPED_ARRAY_TO_TYPE.BigUint64Array = new Uint64();
|
|
35
|
-
// }
|
|
36
|
-
function deduceTypeFromColumn(value) {
|
|
37
|
-
if (value instanceof Date) {
|
|
38
|
-
return Date;
|
|
39
|
-
}
|
|
40
|
-
else if (value instanceof Number) {
|
|
41
|
-
return Float32Array;
|
|
42
|
-
}
|
|
43
|
-
else if (typeof value === 'string') {
|
|
44
|
-
return String;
|
|
45
|
-
}
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
exports.deduceTypeFromColumn = deduceTypeFromColumn;
|
|
49
|
-
function deduceTypeFromValue(value) {
|
|
50
|
-
if (value instanceof Date) {
|
|
51
|
-
return Date;
|
|
52
|
-
}
|
|
53
|
-
else if (value instanceof Number) {
|
|
54
|
-
return Float32Array;
|
|
55
|
-
}
|
|
56
|
-
else if (typeof value === 'string') {
|
|
57
|
-
return String;
|
|
58
|
-
}
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
exports.deduceTypeFromValue = deduceTypeFromValue;
|
|
62
|
-
/*
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
64
|
-
function deduceSchema(rows) {
|
|
65
|
-
const row = rows[0];
|
|
66
|
-
|
|
67
|
-
const schema = {};
|
|
68
|
-
let i = 0;
|
|
69
|
-
for (const columnName in row) {
|
|
70
|
-
const value = row[columnName];
|
|
71
|
-
switch (typeof value) {
|
|
72
|
-
case 'number':
|
|
73
|
-
case 'boolean':
|
|
74
|
-
// TODO - booleans could be handled differently...
|
|
75
|
-
schema[columnName] = {name: String(columnName), index: i, type: Float32Array};
|
|
76
|
-
break;
|
|
77
|
-
|
|
78
|
-
case 'object':
|
|
79
|
-
schema[columnName] = {name: String(columnName), index: i, type: Array};
|
|
80
|
-
break;
|
|
81
|
-
|
|
82
|
-
case 'string':
|
|
83
|
-
default:
|
|
84
|
-
schema[columnName] = {name: String(columnName), index: i, type: Array};
|
|
85
|
-
// We currently only handle numeric rows
|
|
86
|
-
// TODO we could offer a function to map strings to numbers?
|
|
87
|
-
}
|
|
88
|
-
i++;
|
|
89
|
-
}
|
|
90
|
-
return schema;
|
|
91
|
-
}
|
|
92
|
-
*/
|
package/dist/lib/utils/assert.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assert = void 0;
|
|
4
|
-
// Replacement for the external assert method to reduce bundle size
|
|
5
|
-
// Note: We don't use the second "message" argument in calling code,
|
|
6
|
-
// so no need to support it here
|
|
7
|
-
function assert(condition, message) {
|
|
8
|
-
if (!condition) {
|
|
9
|
-
throw new Error(message || 'loader assertion failed.');
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.assert = assert;
|