@loaders.gl/schema 4.0.0-alpha.23 → 4.0.0-alpha.24
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 +517 -927
- package/dist/es5/index.js +7 -0
- package/dist/es5/index.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/types/binary-geometries.js.map +1 -1
- package/dist/es5/types/category-gis.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.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/types/binary-geometries.js.map +1 -1
- package/dist/esm/types/category-gis.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.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/types/binary-geometries.d.ts +9 -7
- package/dist/types/binary-geometries.d.ts.map +1 -1
- package/dist/types/category-gis.d.ts +1 -1
- package/dist/types/category-gis.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +8 -4
- package/src/lib/table/simple-table/convert-table.ts +73 -1
- package/src/types/binary-geometries.ts +10 -7
- package/src/types/category-gis.ts +5 -4
- 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/binary-geometries.js +0 -2
- package/dist/types/category-gis.js +0 -3
- 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/flat-geometries.js +0 -3
- package/dist/types/schema.js +0 -3
- package/dist/types/types.js +0 -2
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ArrowLikeField = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* ArrowJS `Field` API-compatible class for row-based tables
|
|
7
|
-
* https://loaders.gl/arrowjs/docs/api-reference/field
|
|
8
|
-
* A field holds name, nullable, and metadata information about a table "column"
|
|
9
|
-
* A Schema is essentially a list of fields
|
|
10
|
-
*/
|
|
11
|
-
class ArrowLikeField {
|
|
12
|
-
constructor(name, type, nullable = false, metadata = new Map()) {
|
|
13
|
-
this.name = name;
|
|
14
|
-
this.type = type;
|
|
15
|
-
this.nullable = nullable;
|
|
16
|
-
this.metadata = metadata;
|
|
17
|
-
}
|
|
18
|
-
get typeId() {
|
|
19
|
-
return this.type && this.type.typeId;
|
|
20
|
-
}
|
|
21
|
-
clone() {
|
|
22
|
-
return new ArrowLikeField(this.name, this.type, this.nullable, this.metadata);
|
|
23
|
-
}
|
|
24
|
-
compareTo(other) {
|
|
25
|
-
return (this.name === other.name &&
|
|
26
|
-
this.type === other.type &&
|
|
27
|
-
this.nullable === other.nullable &&
|
|
28
|
-
this.metadata === other.metadata);
|
|
29
|
-
}
|
|
30
|
-
toString() {
|
|
31
|
-
return `${this.type}${this.nullable ? ', nullable' : ''}${this.metadata ? `, metadata: ${this.metadata}` : ''}`;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.ArrowLikeField = ArrowLikeField;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ArrowLikeSchema = void 0;
|
|
5
|
-
const arrow_like_field_1 = require("./arrow-like-field");
|
|
6
|
-
class ArrowLikeSchema {
|
|
7
|
-
constructor(fields, metadata = new Map()) {
|
|
8
|
-
// checkNames(fields);
|
|
9
|
-
// For kepler fields, create arrow compatible `Fields` that have kepler fields as `metadata`
|
|
10
|
-
this.fields = fields.map((field) => new arrow_like_field_1.ArrowLikeField(field.name, field.type, field.nullable, field.metadata));
|
|
11
|
-
this.metadata =
|
|
12
|
-
metadata instanceof Map ? metadata : new Map(Object.entries(metadata));
|
|
13
|
-
}
|
|
14
|
-
// TODO - arrow only seems to compare fields, not metadata
|
|
15
|
-
compareTo(other) {
|
|
16
|
-
if (this.metadata !== other.metadata) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
if (this.fields.length !== other.fields.length) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
for (let i = 0; i < this.fields.length; ++i) {
|
|
23
|
-
if (!this.fields[i].compareTo(other.fields[i])) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
select(...columnNames) {
|
|
30
|
-
// Ensure column names reference valid fields
|
|
31
|
-
const nameMap = Object.create(null);
|
|
32
|
-
for (const name of columnNames) {
|
|
33
|
-
nameMap[name] = true;
|
|
34
|
-
}
|
|
35
|
-
const selectedFields = this.fields.filter((field) => nameMap[field.name]);
|
|
36
|
-
return new ArrowLikeSchema(selectedFields, this.metadata);
|
|
37
|
-
}
|
|
38
|
-
selectAt(...columnIndices) {
|
|
39
|
-
// Ensure column indices reference valid fields
|
|
40
|
-
const selectedFields = columnIndices.map((index) => this.fields[index]).filter(Boolean);
|
|
41
|
-
return new ArrowLikeSchema(selectedFields, this.metadata);
|
|
42
|
-
}
|
|
43
|
-
assign(schemaOrFields) {
|
|
44
|
-
let fields;
|
|
45
|
-
let metadata = this.metadata;
|
|
46
|
-
if (schemaOrFields instanceof ArrowLikeSchema) {
|
|
47
|
-
const otherArrowLikeSchema = schemaOrFields;
|
|
48
|
-
fields = otherArrowLikeSchema.fields;
|
|
49
|
-
metadata = mergeMaps(mergeMaps(new Map(), this.metadata), otherArrowLikeSchema.metadata);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
fields = schemaOrFields;
|
|
53
|
-
}
|
|
54
|
-
// Create a merged list of fields, overwrite fields in place, new fields at end
|
|
55
|
-
const fieldMap = Object.create(null);
|
|
56
|
-
for (const field of this.fields) {
|
|
57
|
-
fieldMap[field.name] = field;
|
|
58
|
-
}
|
|
59
|
-
for (const field of fields) {
|
|
60
|
-
fieldMap[field.name] = field;
|
|
61
|
-
}
|
|
62
|
-
const mergedFields = Object.values(fieldMap);
|
|
63
|
-
return new ArrowLikeSchema(mergedFields, metadata);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.ArrowLikeSchema = ArrowLikeSchema;
|
|
67
|
-
// Warn if any duplicated field names
|
|
68
|
-
// function checkNames(fields: Field[]): void {
|
|
69
|
-
// const usedNames: Record<string, boolean> = {};
|
|
70
|
-
// for (const field of fields) {
|
|
71
|
-
// if (usedNames[field.name]) {
|
|
72
|
-
// // eslint-disable-next-line
|
|
73
|
-
// console.warn('ArrowLikeSchema: duplicated field name', field.name, field);
|
|
74
|
-
// }
|
|
75
|
-
// usedNames[field.name] = true;
|
|
76
|
-
// }
|
|
77
|
-
// }
|
|
78
|
-
function mergeMaps(m1, m2) {
|
|
79
|
-
// @ts-ignore
|
|
80
|
-
return new Map([...(m1 || new Map()), ...(m2 || new Map())]);
|
|
81
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ArrowLikeTable = void 0;
|
|
5
|
-
const arrow_like_schema_1 = require("./arrow-like-schema");
|
|
6
|
-
const table_schema_1 = require("../simple-table/table-schema");
|
|
7
|
-
const table_accessors_1 = require("../simple-table/table-accessors");
|
|
8
|
-
class ArrowLikeVector {
|
|
9
|
-
constructor(table, columnName) {
|
|
10
|
-
this.table = table;
|
|
11
|
-
this.columnName = columnName;
|
|
12
|
-
}
|
|
13
|
-
get(rowIndex) {
|
|
14
|
-
return (0, table_accessors_1.getTableCell)(this.table, rowIndex, this.columnName);
|
|
15
|
-
}
|
|
16
|
-
toArray() {
|
|
17
|
-
switch (this.table.shape) {
|
|
18
|
-
case 'arrow-table':
|
|
19
|
-
return this.table.data.getChild(this.columnName)?.toArray();
|
|
20
|
-
case 'columnar-table':
|
|
21
|
-
return this.table.data[this.columnName];
|
|
22
|
-
default:
|
|
23
|
-
throw new Error(this.table.shape);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Class that provides an API similar to Apache Arrow Table class
|
|
29
|
-
* Forwards methods directly if the underlying table is Arrow, otherwise calls accessor functions
|
|
30
|
-
*/
|
|
31
|
-
class ArrowLikeTable {
|
|
32
|
-
constructor(table) {
|
|
33
|
-
const schema = table.schema || (0, table_schema_1.deduceTableSchema)(table);
|
|
34
|
-
this.schema = new arrow_like_schema_1.ArrowLikeSchema(schema.fields, schema.metadata);
|
|
35
|
-
this.table = { ...table, schema };
|
|
36
|
-
}
|
|
37
|
-
// get schema() {
|
|
38
|
-
// return this.table.schema;
|
|
39
|
-
// }
|
|
40
|
-
get data() {
|
|
41
|
-
return this.table.data;
|
|
42
|
-
}
|
|
43
|
-
get numCols() {
|
|
44
|
-
return (0, table_accessors_1.getTableNumCols)(this.table);
|
|
45
|
-
}
|
|
46
|
-
get length() {
|
|
47
|
-
return (0, table_accessors_1.getTableLength)(this.table);
|
|
48
|
-
}
|
|
49
|
-
getChild(columnName) {
|
|
50
|
-
return new ArrowLikeVector(this.table, columnName);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.ArrowLikeTable = ArrowLikeTable;
|
|
@@ -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;
|