@loaders.gl/schema 4.2.0-alpha.4 → 4.2.0-alpha.6
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.dev.js +216 -147
- package/dist/dist.min.js +9 -0
- package/dist/index.cjs +128 -97
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +30 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/lib/mesh/convert-mesh.d.ts +2 -2
- package/dist/lib/mesh/convert-mesh.d.ts.map +1 -1
- package/dist/lib/mesh/convert-mesh.js +33 -18
- package/dist/lib/mesh/deduce-mesh-schema.d.ts +2 -2
- package/dist/lib/mesh/deduce-mesh-schema.d.ts.map +1 -1
- package/dist/lib/mesh/deduce-mesh-schema.js +54 -40
- package/dist/lib/mesh/mesh-to-arrow-table.js +46 -1
- package/dist/lib/mesh/mesh-utils.d.ts +2 -2
- package/dist/lib/mesh/mesh-utils.d.ts.map +1 -1
- package/dist/lib/mesh/mesh-utils.js +41 -28
- package/dist/lib/table/arrow-api/arrow-like-field.d.ts +1 -1
- package/dist/lib/table/arrow-api/arrow-like-field.d.ts.map +1 -1
- package/dist/lib/table/arrow-api/arrow-like-field.js +34 -25
- package/dist/lib/table/arrow-api/arrow-like-schema.d.ts +2 -2
- package/dist/lib/table/arrow-api/arrow-like-schema.d.ts.map +1 -1
- package/dist/lib/table/arrow-api/arrow-like-schema.js +71 -56
- package/dist/lib/table/arrow-api/arrow-like-table.d.ts +2 -2
- package/dist/lib/table/arrow-api/arrow-like-table.d.ts.map +1 -1
- package/dist/lib/table/arrow-api/arrow-like-table.js +57 -45
- package/dist/lib/table/arrow-api/arrow-like-type.d.ts +3 -3
- package/dist/lib/table/arrow-api/arrow-like-type.d.ts.map +1 -1
- package/dist/lib/table/arrow-api/arrow-like-type.js +371 -321
- package/dist/lib/table/arrow-api/enum.js +97 -48
- package/dist/lib/table/arrow-api/get-type-info.d.ts +1 -1
- package/dist/lib/table/arrow-api/get-type-info.d.ts.map +1 -1
- package/dist/lib/table/arrow-api/get-type-info.js +20 -14
- package/dist/lib/table/arrow-api/index.d.ts +4 -4
- package/dist/lib/table/arrow-api/index.d.ts.map +1 -1
- package/dist/lib/table/arrow-api/index.js +3 -1
- package/dist/lib/table/batches/base-table-batch-aggregator.d.ts +3 -3
- package/dist/lib/table/batches/base-table-batch-aggregator.d.ts.map +1 -1
- package/dist/lib/table/batches/base-table-batch-aggregator.js +56 -52
- package/dist/lib/table/batches/columnar-table-batch-aggregator.d.ts +3 -3
- package/dist/lib/table/batches/columnar-table-batch-aggregator.d.ts.map +1 -1
- package/dist/lib/table/batches/columnar-table-batch-aggregator.js +82 -67
- 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/batches/row-table-batch-aggregator.js +76 -67
- package/dist/lib/table/batches/table-batch-aggregator.d.ts +2 -2
- package/dist/lib/table/batches/table-batch-aggregator.d.ts.map +1 -1
- package/dist/lib/table/batches/table-batch-aggregator.js +3 -1
- package/dist/lib/table/batches/table-batch-builder.d.ts +3 -3
- package/dist/lib/table/batches/table-batch-builder.d.ts.map +1 -1
- package/dist/lib/table/batches/table-batch-builder.js +131 -116
- package/dist/lib/table/simple-table/convert-table.d.ts +1 -1
- package/dist/lib/table/simple-table/convert-table.d.ts.map +1 -1
- package/dist/lib/table/simple-table/convert-table.js +97 -62
- package/dist/lib/table/simple-table/data-type.d.ts +2 -2
- package/dist/lib/table/simple-table/data-type.d.ts.map +1 -1
- package/dist/lib/table/simple-table/data-type.js +79 -76
- package/dist/lib/table/simple-table/make-table-from-batches.js +70 -67
- package/dist/lib/table/simple-table/make-table.d.ts +1 -1
- package/dist/lib/table/simple-table/make-table.d.ts.map +1 -1
- package/dist/lib/table/simple-table/make-table.js +85 -41
- package/dist/lib/table/simple-table/row-utils.js +38 -31
- package/dist/lib/table/simple-table/table-accessors.d.ts +1 -1
- package/dist/lib/table/simple-table/table-accessors.d.ts.map +1 -1
- package/dist/lib/table/simple-table/table-accessors.js +314 -270
- package/dist/lib/table/simple-table/table-column.d.ts +1 -1
- package/dist/lib/table/simple-table/table-column.d.ts.map +1 -1
- package/dist/lib/table/simple-table/table-column.js +36 -3
- package/dist/lib/table/simple-table/table-schema.d.ts +2 -2
- package/dist/lib/table/simple-table/table-schema.d.ts.map +1 -1
- package/dist/lib/table/simple-table/table-schema.js +69 -56
- package/dist/lib/utils/assert.js +6 -4
- package/dist/lib/utils/async-queue.js +79 -82
- package/dist/types/batch.d.ts +1 -1
- package/dist/types/batch.d.ts.map +1 -1
- package/dist/types/batch.js +3 -1
- package/dist/types/binary-geometries.d.ts +1 -1
- package/dist/types/binary-geometries.d.ts.map +1 -1
- package/dist/types/binary-geometries.js +3 -1
- package/dist/types/category-gis.d.ts +2 -2
- package/dist/types/category-gis.d.ts.map +1 -1
- package/dist/types/category-gis.js +3 -1
- package/dist/types/category-image.js +3 -1
- package/dist/types/category-mesh.d.ts +3 -3
- package/dist/types/category-mesh.d.ts.map +1 -1
- package/dist/types/category-mesh.js +3 -1
- package/dist/types/category-table.d.ts +3 -3
- package/dist/types/category-table.d.ts.map +1 -1
- package/dist/types/category-table.js +3 -1
- package/dist/types/category-texture.d.ts +1 -1
- package/dist/types/category-texture.d.ts.map +1 -1
- package/dist/types/category-texture.js +3 -1
- package/dist/types/flat-geometries.js +3 -1
- package/dist/types/schema.js +3 -1
- package/dist/types/types.js +3 -1
- package/package.json +8 -4
- package/src/index.ts +1 -1
- package/src/lib/table/arrow-api/arrow-like-field.ts +2 -2
- package/src/lib/table/arrow-api/arrow-like-type.ts +4 -2
- package/dist/index.js.map +0 -1
- package/dist/lib/mesh/convert-mesh.js.map +0 -1
- package/dist/lib/mesh/deduce-mesh-schema.js.map +0 -1
- package/dist/lib/mesh/mesh-to-arrow-table.js.map +0 -1
- package/dist/lib/mesh/mesh-utils.js.map +0 -1
- package/dist/lib/table/arrow-api/arrow-like-field.js.map +0 -1
- package/dist/lib/table/arrow-api/arrow-like-schema.js.map +0 -1
- package/dist/lib/table/arrow-api/arrow-like-table.js.map +0 -1
- package/dist/lib/table/arrow-api/arrow-like-type.js.map +0 -1
- package/dist/lib/table/arrow-api/enum.js.map +0 -1
- package/dist/lib/table/arrow-api/get-type-info.js.map +0 -1
- package/dist/lib/table/arrow-api/index.js.map +0 -1
- package/dist/lib/table/batches/base-table-batch-aggregator.js.map +0 -1
- package/dist/lib/table/batches/columnar-table-batch-aggregator.js.map +0 -1
- package/dist/lib/table/batches/row-table-batch-aggregator.js.map +0 -1
- package/dist/lib/table/batches/table-batch-aggregator.js.map +0 -1
- package/dist/lib/table/batches/table-batch-builder.js.map +0 -1
- package/dist/lib/table/simple-table/convert-table.js.map +0 -1
- package/dist/lib/table/simple-table/data-type.js.map +0 -1
- package/dist/lib/table/simple-table/make-table-from-batches.js.map +0 -1
- package/dist/lib/table/simple-table/make-table.js.map +0 -1
- package/dist/lib/table/simple-table/row-utils.js.map +0 -1
- package/dist/lib/table/simple-table/table-accessors.js.map +0 -1
- package/dist/lib/table/simple-table/table-column.js.map +0 -1
- package/dist/lib/table/simple-table/table-schema.js.map +0 -1
- package/dist/lib/utils/assert.js.map +0 -1
- package/dist/lib/utils/async-queue.js.map +0 -1
- package/dist/types/batch.js.map +0 -1
- package/dist/types/binary-geometries.js.map +0 -1
- package/dist/types/category-gis.js.map +0 -1
- package/dist/types/category-image.js.map +0 -1
- package/dist/types/category-mesh.js.map +0 -1
- package/dist/types/category-table.js.map +0 -1
- package/dist/types/category-texture.js.map +0 -1
- package/dist/types/flat-geometries.js.map +0 -1
- package/dist/types/schema.js.map +0 -1
- package/dist/types/types.js.map +0 -1
|
@@ -1,48 +1,97 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
// This code is adapted from ArrowJS https://github.com/apache/arrow
|
|
5
|
+
// under Apache license http://www.apache.org/licenses/LICENSE-2.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
|
+
export 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 || (Type = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-type-info.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/arrow-api/get-type-info.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,IAAI,EAAC,
|
|
1
|
+
{"version":3,"file":"get-type-info.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/arrow-api/get-type-info.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,IAAI,EAAC,6BAA0B;AAEvC;;;GAGG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,GAAG,GAAG;IAC/C,MAAM,EAAE,IAAI,CAAC;IACb,SAAS,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAQA"}
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { Type } from "./arrow-like-type.js";
|
|
5
|
+
/**
|
|
6
|
+
* Gets type information from an Arrow type object or "mock" Arrow type object
|
|
7
|
+
* @param arrowTypeLike Arrow Type or type object of similar shape
|
|
8
|
+
*/
|
|
2
9
|
export function getTypeInfo(arrowTypeLike) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
return {
|
|
11
|
+
typeId: arrowTypeLike.typeId,
|
|
12
|
+
ArrayType: arrowTypeLike.ArrayType,
|
|
13
|
+
typeName: arrowTypeLike.toString(),
|
|
14
|
+
typeEnumName: getTypeKey(arrowTypeLike.typeId),
|
|
15
|
+
precision: arrowTypeLike.precision
|
|
16
|
+
};
|
|
10
17
|
}
|
|
11
18
|
let ReverseType = null;
|
|
12
19
|
function getTypeKey(typeKey) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
if (!ReverseType) {
|
|
21
|
+
ReverseType = {};
|
|
22
|
+
for (const key in Type) {
|
|
23
|
+
ReverseType[Type[key]] = key;
|
|
24
|
+
}
|
|
17
25
|
}
|
|
18
|
-
|
|
19
|
-
return ReverseType[typeKey];
|
|
26
|
+
return ReverseType[typeKey];
|
|
20
27
|
}
|
|
21
|
-
//# sourceMappingURL=get-type-info.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ArrowLikeField as Field } from
|
|
2
|
-
export { ArrowLikeSchema as Schema } from
|
|
3
|
-
export { ArrowLikeTable as Table } from
|
|
4
|
-
export * from
|
|
1
|
+
export { ArrowLikeField as Field } from "./arrow-like-field.js";
|
|
2
|
+
export { ArrowLikeSchema as Schema } from "./arrow-like-schema.js";
|
|
3
|
+
export { ArrowLikeTable as Table } from "./arrow-like-table.js";
|
|
4
|
+
export * from "./arrow-like-type.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/arrow-api/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,IAAI,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/arrow-api/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,IAAI,KAAK,EAAC,8BAA2B;AAC3D,OAAO,EAAC,eAAe,IAAI,MAAM,EAAC,+BAA4B;AAC9D,OAAO,EAAC,cAAc,IAAI,KAAK,EAAC,8BAA2B;AAC3D,qCAAkC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
export { ArrowLikeField as Field } from "./arrow-like-field.js";
|
|
2
5
|
export { ArrowLikeSchema as Schema } from "./arrow-like-schema.js";
|
|
3
6
|
export { ArrowLikeTable as Table } from "./arrow-like-table.js";
|
|
4
7
|
export * from "./arrow-like-type.js";
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Schema } from
|
|
2
|
-
import type { TableBatch } from
|
|
3
|
-
import { TableBatchAggregator, TableBatchOptions } from
|
|
1
|
+
import type { Schema } from "../../../types/schema.js";
|
|
2
|
+
import type { TableBatch } from "../../../types/category-table.js";
|
|
3
|
+
import { TableBatchAggregator, TableBatchOptions } from "./table-batch-aggregator.js";
|
|
4
4
|
export declare class BaseTableBatchAggregator implements TableBatchAggregator {
|
|
5
5
|
schema: Schema;
|
|
6
6
|
options: TableBatchOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-table-batch-aggregator.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/batches/base-table-batch-aggregator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,
|
|
1
|
+
{"version":3,"file":"base-table-batch-aggregator.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/batches/base-table-batch-aggregator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,iCAA8B;AAClD,OAAO,KAAK,EAAC,UAAU,EAAC,yCAAsC;AAC9D,OAAO,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,oCAAiC;AAIjF,qBAAa,wBAAyB,YAAW,oBAAoB;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,iBAAiB,CAAC;IAE3B,KAAK,CAAC,EAAE,iBAAiB,GAAG,kBAAkB,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAK;IACnB,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAQ;IAC1B,MAAM,EAAE,MAAM,CAAK;IACnB,OAAO,CAAC,QAAQ,CAAgB;gBAEpB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB;IActD,QAAQ,IAAI,MAAM;IAIlB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAY9C,YAAY,CAAC,GAAG,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAYrE,QAAQ,IAAI,UAAU,GAAG,IAAI;CAoB9B"}
|
|
@@ -1,59 +1,63 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
const DEFAULT_ROW_COUNT = 100;
|
|
2
5
|
export class BaseTableBatchAggregator {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
schema;
|
|
7
|
+
options;
|
|
8
|
+
shape;
|
|
9
|
+
length = 0;
|
|
10
|
+
rows = null;
|
|
11
|
+
cursor = 0;
|
|
12
|
+
_headers = [];
|
|
13
|
+
constructor(schema, options) {
|
|
14
|
+
this.options = options;
|
|
15
|
+
this.schema = schema;
|
|
16
|
+
// schema is an array if there're no headers
|
|
17
|
+
// object if there are headers
|
|
18
|
+
if (!Array.isArray(schema)) {
|
|
19
|
+
this._headers = [];
|
|
20
|
+
for (const key in schema) {
|
|
21
|
+
this._headers[schema[key].index] = schema[key].name;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
18
24
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return this.length;
|
|
22
|
-
}
|
|
23
|
-
addArrayRow(row, cursor) {
|
|
24
|
-
if (Number.isFinite(cursor)) {
|
|
25
|
-
this.cursor = cursor;
|
|
25
|
+
rowCount() {
|
|
26
|
+
return this.length;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
addArrayRow(row, cursor) {
|
|
29
|
+
if (Number.isFinite(cursor)) {
|
|
30
|
+
this.cursor = cursor;
|
|
31
|
+
}
|
|
32
|
+
this.shape = 'array-row-table';
|
|
33
|
+
this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
|
|
34
|
+
this.rows[this.length] = row;
|
|
35
|
+
this.length++;
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
addObjectRow(row, cursor) {
|
|
38
|
+
if (Number.isFinite(cursor)) {
|
|
39
|
+
this.cursor = cursor;
|
|
40
|
+
}
|
|
41
|
+
this.shape = 'object-row-table';
|
|
42
|
+
this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
|
|
43
|
+
this.rows[this.length] = row;
|
|
44
|
+
this.length++;
|
|
45
|
+
}
|
|
46
|
+
getBatch() {
|
|
47
|
+
let rows = this.rows;
|
|
48
|
+
if (!rows) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
rows = rows.slice(0, this.length);
|
|
52
|
+
this.rows = null;
|
|
53
|
+
const batch = {
|
|
54
|
+
shape: this.shape || 'array-row-table',
|
|
55
|
+
batchType: 'data',
|
|
56
|
+
data: rows,
|
|
57
|
+
length: this.length,
|
|
58
|
+
schema: this.schema,
|
|
59
|
+
cursor: this.cursor
|
|
60
|
+
};
|
|
61
|
+
return batch;
|
|
45
62
|
}
|
|
46
|
-
rows = rows.slice(0, this.length);
|
|
47
|
-
this.rows = null;
|
|
48
|
-
const batch = {
|
|
49
|
-
shape: this.shape || 'array-row-table',
|
|
50
|
-
batchType: 'data',
|
|
51
|
-
data: rows,
|
|
52
|
-
length: this.length,
|
|
53
|
-
schema: this.schema,
|
|
54
|
-
cursor: this.cursor
|
|
55
|
-
};
|
|
56
|
-
return batch;
|
|
57
|
-
}
|
|
58
63
|
}
|
|
59
|
-
//# sourceMappingURL=base-table-batch-aggregator.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Schema } from
|
|
2
|
-
import type { ColumnarTableBatch, ArrowTableBatch } from
|
|
3
|
-
import { TableBatchAggregator } from
|
|
1
|
+
import type { Schema } from "../../../types/schema.js";
|
|
2
|
+
import type { ColumnarTableBatch, ArrowTableBatch } from "../../../types/category-table.js";
|
|
3
|
+
import { TableBatchAggregator } from "./table-batch-aggregator.js";
|
|
4
4
|
type ColumnarTableBatchOptions = {};
|
|
5
5
|
export declare class ColumnarTableBatchAggregator implements TableBatchAggregator {
|
|
6
6
|
schema: Schema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnar-table-batch-aggregator.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/batches/columnar-table-batch-aggregator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,
|
|
1
|
+
{"version":3,"file":"columnar-table-batch-aggregator.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/batches/columnar-table-batch-aggregator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,iCAA8B;AAClD,OAAO,KAAK,EAAC,kBAAkB,EAAE,eAAe,EAAC,yCAAsC;AACvF,OAAO,EAAC,oBAAoB,EAAC,oCAAiC;AAE9D,KAAK,yBAAyB,GAAG,EAAE,CAAC;AAIpC,qBAAa,4BAA6B,YAAW,oBAAoB;IACvE,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAK;IACnB,SAAS,EAAE,MAAM,CAAK;IACtB,OAAO,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,EAAE,CAAA;KAAC,CAAM;gBAEhC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,yBAAyB;IAK9D,QAAQ,IAAI,MAAM;IAIlB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;IAWtB,YAAY,CAAC,GAAG,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,GAAG,IAAI;IASpD,QAAQ,IAAI,kBAAkB,GAAG,eAAe,GAAG,IAAI;IA6BvD,kBAAkB;IA8BlB,aAAa;CAKd"}
|
|
@@ -1,76 +1,91 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
const DEFAULT_ROW_COUNT = 100;
|
|
2
5
|
export class ColumnarTableBatchAggregator {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
rowCount() {
|
|
12
|
-
return this.length;
|
|
13
|
-
}
|
|
14
|
-
addArrayRow(row) {
|
|
15
|
-
this._reallocateColumns();
|
|
16
|
-
let i = 0;
|
|
17
|
-
for (const fieldName in this.columns) {
|
|
18
|
-
this.columns[fieldName][this.length] = row[i++];
|
|
6
|
+
schema;
|
|
7
|
+
length = 0;
|
|
8
|
+
allocated = 0;
|
|
9
|
+
columns = {};
|
|
10
|
+
constructor(schema, options) {
|
|
11
|
+
this.schema = schema;
|
|
12
|
+
this._reallocateColumns();
|
|
19
13
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
addObjectRow(row) {
|
|
23
|
-
this._reallocateColumns();
|
|
24
|
-
for (const fieldName in row) {
|
|
25
|
-
this.columns[fieldName][this.length] = row[fieldName];
|
|
14
|
+
rowCount() {
|
|
15
|
+
return this.length;
|
|
26
16
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
17
|
+
addArrayRow(row) {
|
|
18
|
+
// If user keeps pushing rows beyond batch size, reallocate
|
|
19
|
+
this._reallocateColumns();
|
|
20
|
+
let i = 0;
|
|
21
|
+
// TODO what if no csv header, columns not populated?
|
|
22
|
+
for (const fieldName in this.columns) {
|
|
23
|
+
this.columns[fieldName][this.length] = row[i++];
|
|
24
|
+
}
|
|
25
|
+
this.length++;
|
|
37
26
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
46
|
-
return batch;
|
|
47
|
-
}
|
|
48
|
-
_reallocateColumns() {
|
|
49
|
-
if (this.length < this.allocated) {
|
|
50
|
-
return;
|
|
27
|
+
addObjectRow(row) {
|
|
28
|
+
// If user keeps pushing rows beyond batch size, reallocate
|
|
29
|
+
this._reallocateColumns();
|
|
30
|
+
for (const fieldName in row) {
|
|
31
|
+
this.columns[fieldName][this.length] = row[fieldName];
|
|
32
|
+
}
|
|
33
|
+
this.length++;
|
|
51
34
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.columns
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
35
|
+
getBatch() {
|
|
36
|
+
this._pruneColumns();
|
|
37
|
+
const columns = Array.isArray(this.schema) ? this.columns : {};
|
|
38
|
+
// schema is an array if there're no headers
|
|
39
|
+
// object if there are headers
|
|
40
|
+
// columns should match schema format
|
|
41
|
+
if (!Array.isArray(this.schema)) {
|
|
42
|
+
for (const fieldName in this.schema) {
|
|
43
|
+
const field = this.schema[fieldName];
|
|
44
|
+
columns[field.name] = this.columns[field.index];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
this.columns = {};
|
|
48
|
+
const batch = {
|
|
49
|
+
shape: 'columnar-table',
|
|
50
|
+
batchType: 'data',
|
|
51
|
+
data: columns,
|
|
52
|
+
schema: this.schema,
|
|
53
|
+
length: this.length
|
|
54
|
+
};
|
|
55
|
+
return batch;
|
|
68
56
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
57
|
+
// HELPERS
|
|
58
|
+
_reallocateColumns() {
|
|
59
|
+
if (this.length < this.allocated) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
// @ts-ignore TODO
|
|
63
|
+
this.allocated = this.allocated > 0 ? (this.allocated *= 2) : DEFAULT_ROW_COUNT;
|
|
64
|
+
this.columns = {};
|
|
65
|
+
for (const fieldName in this.schema) {
|
|
66
|
+
const field = this.schema[fieldName];
|
|
67
|
+
const ArrayType = field.type || Float32Array;
|
|
68
|
+
const oldColumn = this.columns[field.index];
|
|
69
|
+
if (oldColumn && ArrayBuffer.isView(oldColumn)) {
|
|
70
|
+
// Copy the old data to the new array
|
|
71
|
+
const typedArray = new ArrayType(this.allocated);
|
|
72
|
+
typedArray.set(oldColumn);
|
|
73
|
+
this.columns[field.index] = typedArray;
|
|
74
|
+
}
|
|
75
|
+
else if (oldColumn) {
|
|
76
|
+
// Plain array
|
|
77
|
+
oldColumn.length = this.allocated;
|
|
78
|
+
this.columns[field.index] = oldColumn;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// Create new
|
|
82
|
+
this.columns[field.index] = new ArrayType(this.allocated);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
_pruneColumns() {
|
|
87
|
+
for (const [columnName, column] of Object.entries(this.columns)) {
|
|
88
|
+
this.columns[columnName] = column.slice(0, this.length);
|
|
89
|
+
}
|
|
73
90
|
}
|
|
74
|
-
}
|
|
75
91
|
}
|
|
76
|
-
//# sourceMappingURL=columnar-table-batch-aggregator.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Schema } from
|
|
2
|
-
import type { TableBatch } from
|
|
3
|
-
import { TableBatchAggregator, TableBatchOptions } from
|
|
1
|
+
import type { Schema } from "../../../types/schema.js";
|
|
2
|
+
import type { TableBatch } from "../../../types/category-table.js";
|
|
3
|
+
import { TableBatchAggregator, TableBatchOptions } from "./table-batch-aggregator.js";
|
|
4
4
|
export declare class RowTableBatchAggregator implements TableBatchAggregator {
|
|
5
5
|
schema: Schema | null;
|
|
6
6
|
options: TableBatchOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row-table-batch-aggregator.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/batches/row-table-batch-aggregator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,
|
|
1
|
+
{"version":3,"file":"row-table-batch-aggregator.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/batches/row-table-batch-aggregator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,iCAA8B;AAClD,OAAO,KAAK,EAAC,UAAU,EAAC,yCAAsC;AAC9D,OAAO,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,oCAAiC;AAUjF,qBAAa,uBAAwB,YAAW,oBAAoB;IAClE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,iBAAiB,CAAC;IAE3B,MAAM,EAAE,MAAM,CAAK;IACnB,UAAU,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC,EAAE,GAAG,IAAI,CAAQ;IAC5D,SAAS,EAAE,OAAO,EAAE,EAAE,GAAG,IAAI,CAAQ;IACrC,MAAM,EAAE,MAAM,CAAK;IACnB,OAAO,CAAC,QAAQ,CAAyB;gBAE7B,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,iBAAiB;IAc7D,QAAQ,IAAI,MAAM;IAIlB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAsB9C,YAAY,CAAC,GAAG,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAsBrE,QAAQ,IAAI,UAAU,GAAG,IAAI;CAoB9B"}
|