@loaders.gl/schema 4.0.0-beta.1 → 4.0.0-beta.3
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 +1745 -0
- package/dist/index.cjs +1692 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/{esm/lib → lib}/mesh/convert-mesh.js +1 -1
- package/dist/lib/mesh/convert-mesh.js.map +1 -0
- package/dist/{esm/lib → lib}/mesh/deduce-mesh-schema.js +1 -1
- package/dist/lib/mesh/deduce-mesh-schema.js.map +1 -0
- package/dist/lib/mesh/mesh-to-arrow-table.js.map +1 -0
- package/dist/lib/mesh/mesh-utils.js.map +1 -0
- package/dist/{esm/lib → lib}/table/arrow-api/arrow-like-field.js +5 -6
- package/dist/lib/table/arrow-api/arrow-like-field.js.map +1 -0
- package/dist/{esm/lib → lib}/table/arrow-api/arrow-like-schema.js +3 -4
- package/dist/lib/table/arrow-api/arrow-like-schema.js.map +1 -0
- package/dist/{esm/lib → lib}/table/arrow-api/arrow-like-table.js +7 -8
- package/dist/lib/table/arrow-api/arrow-like-table.js.map +1 -0
- package/dist/lib/table/arrow-api/arrow-like-type.d.ts +1 -1
- package/dist/lib/table/arrow-api/arrow-like-type.d.ts.map +1 -1
- package/dist/{esm/lib → lib}/table/arrow-api/arrow-like-type.js +22 -23
- package/dist/lib/table/arrow-api/arrow-like-type.js.map +1 -0
- package/dist/lib/table/arrow-api/enum.js.map +1 -0
- package/dist/{esm/lib → lib}/table/arrow-api/get-type-info.js +1 -1
- package/dist/lib/table/arrow-api/get-type-info.js.map +1 -0
- package/dist/lib/table/arrow-api/index.js +5 -0
- package/dist/lib/table/arrow-api/index.js.map +1 -0
- package/dist/{esm/lib → lib}/table/batches/base-table-batch-aggregator.js +6 -7
- package/dist/lib/table/batches/base-table-batch-aggregator.js.map +1 -0
- package/dist/{esm/lib → lib}/table/batches/columnar-table-batch-aggregator.js +4 -5
- package/dist/lib/table/batches/columnar-table-batch-aggregator.js.map +1 -0
- package/dist/{esm/lib → lib}/table/batches/row-table-batch-aggregator.js +8 -9
- package/dist/lib/table/batches/row-table-batch-aggregator.js.map +1 -0
- package/dist/lib/table/batches/table-batch-aggregator.js.map +1 -0
- package/dist/{esm/lib → lib}/table/batches/table-batch-builder.js +14 -15
- package/dist/lib/table/batches/table-batch-builder.js.map +1 -0
- package/dist/{esm/lib → lib}/table/simple-table/convert-table.js +3 -3
- package/dist/lib/table/simple-table/convert-table.js.map +1 -0
- package/dist/lib/table/simple-table/data-type.js.map +1 -0
- package/dist/{esm/lib → lib}/table/simple-table/make-table.js +1 -1
- package/dist/lib/table/simple-table/make-table.js.map +1 -0
- package/dist/lib/table/simple-table/row-utils.js.map +1 -0
- package/dist/{esm/lib → lib}/table/simple-table/table-accessors.js +2 -2
- package/dist/lib/table/simple-table/table-accessors.js.map +1 -0
- package/dist/{esm/lib → lib}/table/simple-table/table-column.js +1 -1
- package/dist/lib/table/simple-table/table-column.js.map +1 -0
- package/dist/{esm/lib → lib}/table/simple-table/table-schema.js +1 -1
- package/dist/lib/table/simple-table/table-schema.js.map +1 -0
- package/dist/lib/utils/assert.js.map +1 -0
- package/dist/{esm/lib → lib}/utils/async-queue.js +3 -4
- package/dist/lib/utils/async-queue.js.map +1 -0
- package/dist/types/batch.d.ts +3 -2
- package/dist/types/batch.d.ts.map +1 -1
- package/dist/types/batch.js.map +1 -0
- package/dist/types/binary-geometries.js.map +1 -0
- package/dist/types/category-gis.js.map +1 -0
- package/dist/types/category-image.js.map +1 -0
- package/dist/types/category-mesh.js.map +1 -0
- package/dist/types/category-table.js.map +1 -0
- package/dist/types/category-texture.js.map +1 -0
- package/dist/types/flat-geometries.js.map +1 -0
- package/dist/types/schema.js.map +1 -0
- package/dist/types/types.d.ts +1 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js.map +1 -0
- package/package.json +14 -6
- package/src/index.ts +0 -1
- package/src/lib/table/arrow-api/arrow-like-type.ts +0 -2
- package/src/types/batch.ts +4 -2
- package/src/types/types.ts +0 -2
- package/dist/bundle.d.ts +0 -2
- package/dist/bundle.d.ts.map +0 -1
- package/dist/dist.min.js +0 -13204
- package/dist/es5/bundle.js +0 -6
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/index.js +0 -413
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/lib/mesh/convert-mesh.js +0 -34
- package/dist/es5/lib/mesh/convert-mesh.js.map +0 -1
- package/dist/es5/lib/mesh/deduce-mesh-schema.js +0 -56
- package/dist/es5/lib/mesh/deduce-mesh-schema.js.map +0 -1
- package/dist/es5/lib/mesh/mesh-to-arrow-table.js +0 -2
- package/dist/es5/lib/mesh/mesh-to-arrow-table.js.map +0 -1
- package/dist/es5/lib/mesh/mesh-utils.js +0 -40
- package/dist/es5/lib/mesh/mesh-utils.js.map +0 -1
- package/dist/es5/lib/table/arrow/arrow-type-utils.js +0 -30
- package/dist/es5/lib/table/arrow/arrow-type-utils.js.map +0 -1
- package/dist/es5/lib/table/arrow/convert-schema-arrow.js +0 -179
- package/dist/es5/lib/table/arrow/convert-schema-arrow.js.map +0 -1
- package/dist/es5/lib/table/arrow/convert-table-to-arrow.js +0 -2
- package/dist/es5/lib/table/arrow/convert-table-to-arrow.js.map +0 -1
- package/dist/es5/lib/table/arrow-api/arrow-like-field.js +0 -49
- package/dist/es5/lib/table/arrow-api/arrow-like-field.js.map +0 -1
- package/dist/es5/lib/table/arrow-api/arrow-like-schema.js +0 -118
- package/dist/es5/lib/table/arrow-api/arrow-like-schema.js.map +0 -1
- package/dist/es5/lib/table/arrow-api/arrow-like-table.js +0 -81
- package/dist/es5/lib/table/arrow-api/arrow-like-table.js.map +0 -1
- package/dist/es5/lib/table/arrow-api/arrow-like-type.js +0 -740
- package/dist/es5/lib/table/arrow-api/arrow-like-type.js.map +0 -1
- package/dist/es5/lib/table/arrow-api/enum.js +0 -55
- package/dist/es5/lib/table/arrow-api/enum.js.map +0 -1
- package/dist/es5/lib/table/arrow-api/get-type-info.js +0 -27
- package/dist/es5/lib/table/arrow-api/get-type-info.js.map +0 -1
- package/dist/es5/lib/table/arrow-api/index.js +0 -44
- package/dist/es5/lib/table/arrow-api/index.js.map +0 -1
- package/dist/es5/lib/table/batches/base-table-batch-aggregator.js +0 -78
- package/dist/es5/lib/table/batches/base-table-batch-aggregator.js.map +0 -1
- package/dist/es5/lib/table/batches/columnar-table-batch-aggregator.js +0 -106
- package/dist/es5/lib/table/batches/columnar-table-batch-aggregator.js.map +0 -1
- package/dist/es5/lib/table/batches/row-table-batch-aggregator.js +0 -96
- package/dist/es5/lib/table/batches/row-table-batch-aggregator.js.map +0 -1
- package/dist/es5/lib/table/batches/table-batch-aggregator.js +0 -2
- package/dist/es5/lib/table/batches/table-batch-aggregator.js.map +0 -1
- package/dist/es5/lib/table/batches/table-batch-builder.js +0 -173
- package/dist/es5/lib/table/batches/table-batch-builder.js.map +0 -1
- package/dist/es5/lib/table/simple-table/convert-table.js +0 -106
- package/dist/es5/lib/table/simple-table/convert-table.js.map +0 -1
- package/dist/es5/lib/table/simple-table/data-type.js +0 -94
- package/dist/es5/lib/table/simple-table/data-type.js.map +0 -1
- package/dist/es5/lib/table/simple-table/make-table.js +0 -60
- package/dist/es5/lib/table/simple-table/make-table.js.map +0 -1
- package/dist/es5/lib/table/simple-table/row-utils.js +0 -34
- package/dist/es5/lib/table/simple-table/row-utils.js.map +0 -1
- package/dist/es5/lib/table/simple-table/table-accessors.js +0 -370
- package/dist/es5/lib/table/simple-table/table-accessors.js.map +0 -1
- package/dist/es5/lib/table/simple-table/table-column.js +0 -12
- package/dist/es5/lib/table/simple-table/table-column.js.map +0 -1
- package/dist/es5/lib/table/simple-table/table-schema.js +0 -85
- package/dist/es5/lib/table/simple-table/table-schema.js.map +0 -1
- package/dist/es5/lib/utils/assert.js +0 -12
- package/dist/es5/lib/utils/assert.js.map +0 -1
- package/dist/es5/lib/utils/async-queue.js +0 -169
- package/dist/es5/lib/utils/async-queue.js.map +0 -1
- package/dist/es5/types/batch.js +0 -2
- package/dist/es5/types/batch.js.map +0 -1
- package/dist/es5/types/binary-geometries.js +0 -2
- package/dist/es5/types/binary-geometries.js.map +0 -1
- package/dist/es5/types/category-gis.js +0 -2
- package/dist/es5/types/category-gis.js.map +0 -1
- package/dist/es5/types/category-image.js +0 -2
- package/dist/es5/types/category-image.js.map +0 -1
- package/dist/es5/types/category-mesh.js +0 -2
- package/dist/es5/types/category-mesh.js.map +0 -1
- package/dist/es5/types/category-table.js +0 -2
- package/dist/es5/types/category-table.js.map +0 -1
- package/dist/es5/types/category-texture.js +0 -2
- package/dist/es5/types/category-texture.js.map +0 -1
- package/dist/es5/types/flat-geometries.js +0 -2
- package/dist/es5/types/flat-geometries.js.map +0 -1
- package/dist/es5/types/schema.js +0 -2
- package/dist/es5/types/schema.js.map +0 -1
- package/dist/es5/types/types.js +0 -2
- package/dist/es5/types/types.js.map +0 -1
- package/dist/esm/bundle.js +0 -4
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/index.js +0 -17
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/lib/mesh/convert-mesh.js.map +0 -1
- package/dist/esm/lib/mesh/deduce-mesh-schema.js.map +0 -1
- package/dist/esm/lib/mesh/mesh-to-arrow-table.js.map +0 -1
- package/dist/esm/lib/mesh/mesh-utils.js.map +0 -1
- package/dist/esm/lib/table/arrow/arrow-type-utils.js +0 -24
- package/dist/esm/lib/table/arrow/arrow-type-utils.js.map +0 -1
- package/dist/esm/lib/table/arrow/convert-schema-arrow.js +0 -158
- package/dist/esm/lib/table/arrow/convert-schema-arrow.js.map +0 -1
- package/dist/esm/lib/table/arrow/convert-table-to-arrow.js +0 -2
- package/dist/esm/lib/table/arrow/convert-table-to-arrow.js.map +0 -1
- package/dist/esm/lib/table/arrow-api/arrow-like-field.js.map +0 -1
- package/dist/esm/lib/table/arrow-api/arrow-like-schema.js.map +0 -1
- package/dist/esm/lib/table/arrow-api/arrow-like-table.js.map +0 -1
- package/dist/esm/lib/table/arrow-api/arrow-like-type.js.map +0 -1
- package/dist/esm/lib/table/arrow-api/enum.js.map +0 -1
- package/dist/esm/lib/table/arrow-api/get-type-info.js.map +0 -1
- package/dist/esm/lib/table/arrow-api/index.js +0 -5
- package/dist/esm/lib/table/arrow-api/index.js.map +0 -1
- package/dist/esm/lib/table/batches/base-table-batch-aggregator.js.map +0 -1
- package/dist/esm/lib/table/batches/columnar-table-batch-aggregator.js.map +0 -1
- package/dist/esm/lib/table/batches/row-table-batch-aggregator.js.map +0 -1
- package/dist/esm/lib/table/batches/table-batch-aggregator.js.map +0 -1
- package/dist/esm/lib/table/batches/table-batch-builder.js.map +0 -1
- package/dist/esm/lib/table/simple-table/convert-table.js.map +0 -1
- package/dist/esm/lib/table/simple-table/data-type.js.map +0 -1
- package/dist/esm/lib/table/simple-table/make-table.js.map +0 -1
- package/dist/esm/lib/table/simple-table/row-utils.js.map +0 -1
- package/dist/esm/lib/table/simple-table/table-accessors.js.map +0 -1
- package/dist/esm/lib/table/simple-table/table-column.js.map +0 -1
- package/dist/esm/lib/table/simple-table/table-schema.js.map +0 -1
- package/dist/esm/lib/utils/assert.js.map +0 -1
- package/dist/esm/lib/utils/async-queue.js.map +0 -1
- package/dist/esm/types/batch.js.map +0 -1
- package/dist/esm/types/binary-geometries.js.map +0 -1
- package/dist/esm/types/category-gis.js.map +0 -1
- package/dist/esm/types/category-image.js.map +0 -1
- package/dist/esm/types/category-mesh.js.map +0 -1
- package/dist/esm/types/category-table.js.map +0 -1
- package/dist/esm/types/category-texture.js.map +0 -1
- package/dist/esm/types/flat-geometries.js.map +0 -1
- package/dist/esm/types/schema.js.map +0 -1
- package/dist/esm/types/types.js.map +0 -1
- package/dist/lib/table/arrow/arrow-type-utils.d.ts +0 -4
- package/dist/lib/table/arrow/arrow-type-utils.d.ts.map +0 -1
- package/dist/lib/table/arrow/convert-schema-arrow.d.ts +0 -13
- package/dist/lib/table/arrow/convert-schema-arrow.d.ts.map +0 -1
- package/dist/lib/table/arrow/convert-table-to-arrow.d.ts +0 -42
- package/dist/lib/table/arrow/convert-table-to-arrow.d.ts.map +0 -1
- package/src/bundle.ts +0 -4
- package/src/lib/table/arrow/arrow-type-utils.ts +0 -71
- package/src/lib/table/arrow/convert-schema-arrow.ts +0 -232
- package/src/lib/table/arrow/convert-table-to-arrow.ts +0 -59
- /package/dist/{esm/lib → lib}/mesh/mesh-to-arrow-table.js +0 -0
- /package/dist/{esm/lib → lib}/mesh/mesh-utils.js +0 -0
- /package/dist/{esm/lib → lib}/table/arrow-api/enum.js +0 -0
- /package/dist/{esm/lib → lib}/table/batches/table-batch-aggregator.js +0 -0
- /package/dist/{esm/lib → lib}/table/simple-table/data-type.js +0 -0
- /package/dist/{esm/lib → lib}/table/simple-table/row-utils.js +0 -0
- /package/dist/{esm/lib → lib}/utils/assert.js +0 -0
- /package/dist/{esm/types → types}/batch.js +0 -0
- /package/dist/{esm/types → types}/binary-geometries.js +0 -0
- /package/dist/{esm/types → types}/category-gis.js +0 -0
- /package/dist/{esm/types → types}/category-image.js +0 -0
- /package/dist/{esm/types → types}/category-mesh.js +0 -0
- /package/dist/{esm/types → types}/category-table.js +0 -0
- /package/dist/{esm/types → types}/category-texture.js +0 -0
- /package/dist/{esm/types → types}/flat-geometries.js +0 -0
- /package/dist/{esm/types → types}/schema.js +0 -0
- /package/dist/{esm/types → types}/types.js +0 -0
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// loaders.gl, MIT license
|
|
2
|
-
|
|
3
|
-
import type {TypedArray} from '../../../types/types';
|
|
4
|
-
import {
|
|
5
|
-
DataType,
|
|
6
|
-
Float32,
|
|
7
|
-
Float64,
|
|
8
|
-
Int16,
|
|
9
|
-
Int32,
|
|
10
|
-
Int8,
|
|
11
|
-
Uint16,
|
|
12
|
-
Uint32,
|
|
13
|
-
Uint8
|
|
14
|
-
// Int8Vector,
|
|
15
|
-
// Uint8Vector,
|
|
16
|
-
// Int16Vector,
|
|
17
|
-
// Uint16Vector,
|
|
18
|
-
// Int32Vector,
|
|
19
|
-
// Uint32Vector,
|
|
20
|
-
// Float32Vector,
|
|
21
|
-
// Float64Vector
|
|
22
|
-
} from 'apache-arrow';
|
|
23
|
-
// import {AbstractVector} from 'apache-arrow/vector';
|
|
24
|
-
|
|
25
|
-
export function getArrowType(array: TypedArray): DataType {
|
|
26
|
-
switch (array.constructor) {
|
|
27
|
-
case Int8Array:
|
|
28
|
-
return new Int8();
|
|
29
|
-
case Uint8Array:
|
|
30
|
-
return new Uint8();
|
|
31
|
-
case Int16Array:
|
|
32
|
-
return new Int16();
|
|
33
|
-
case Uint16Array:
|
|
34
|
-
return new Uint16();
|
|
35
|
-
case Int32Array:
|
|
36
|
-
return new Int32();
|
|
37
|
-
case Uint32Array:
|
|
38
|
-
return new Uint32();
|
|
39
|
-
case Float32Array:
|
|
40
|
-
return new Float32();
|
|
41
|
-
case Float64Array:
|
|
42
|
-
return new Float64();
|
|
43
|
-
default:
|
|
44
|
-
throw new Error('array type not supported');
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/*
|
|
49
|
-
export function getArrowVector(array: TypedArray): AbstractVector {
|
|
50
|
-
switch (array.constructor) {
|
|
51
|
-
case Int8Array:
|
|
52
|
-
return Int8Vector.from(array);
|
|
53
|
-
case Uint8Array:
|
|
54
|
-
return Uint8Vector.from(array);
|
|
55
|
-
case Int16Array:
|
|
56
|
-
return Int16Vector.from(array);
|
|
57
|
-
case Uint16Array:
|
|
58
|
-
return Uint16Vector.from(array);
|
|
59
|
-
case Int32Array:
|
|
60
|
-
return Int32Vector.from(array);
|
|
61
|
-
case Uint32Array:
|
|
62
|
-
return Uint32Vector.from(array);
|
|
63
|
-
case Float32Array:
|
|
64
|
-
return Float32Vector.from(array);
|
|
65
|
-
case Float64Array:
|
|
66
|
-
return Float64Vector.from(array);
|
|
67
|
-
default:
|
|
68
|
-
throw new Error('array type not supported');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
*/
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
// loaders.gl, MIT license
|
|
2
|
-
|
|
3
|
-
import type {DataType, Field, Schema, SchemaMetadata} from '../../../types/schema';
|
|
4
|
-
import {
|
|
5
|
-
Field as ArrowField,
|
|
6
|
-
Schema as ArrowSchema,
|
|
7
|
-
DataType as ArrowDataType,
|
|
8
|
-
Null,
|
|
9
|
-
Binary,
|
|
10
|
-
Bool,
|
|
11
|
-
// Int,
|
|
12
|
-
Int8,
|
|
13
|
-
Int16,
|
|
14
|
-
Int32,
|
|
15
|
-
Int64,
|
|
16
|
-
Uint8,
|
|
17
|
-
Uint16,
|
|
18
|
-
Uint32,
|
|
19
|
-
Uint64,
|
|
20
|
-
// Float,
|
|
21
|
-
Float16,
|
|
22
|
-
Float32,
|
|
23
|
-
Float64,
|
|
24
|
-
Utf8,
|
|
25
|
-
// Date,
|
|
26
|
-
DateDay,
|
|
27
|
-
DateMillisecond,
|
|
28
|
-
// Time,
|
|
29
|
-
TimeMillisecond,
|
|
30
|
-
TimeSecond,
|
|
31
|
-
// Timestamp,
|
|
32
|
-
TimestampSecond,
|
|
33
|
-
TimestampMillisecond,
|
|
34
|
-
TimestampMicrosecond,
|
|
35
|
-
TimestampNanosecond,
|
|
36
|
-
// Interval,
|
|
37
|
-
IntervalDayTime,
|
|
38
|
-
IntervalYearMonth,
|
|
39
|
-
FixedSizeList,
|
|
40
|
-
Struct
|
|
41
|
-
} from 'apache-arrow/Arrow.dom';
|
|
42
|
-
|
|
43
|
-
export function serializeArrowSchema(arrowSchema: ArrowSchema): Schema {
|
|
44
|
-
return {
|
|
45
|
-
fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
|
|
46
|
-
metadata: serializeArrowMetadata(arrowSchema.metadata)
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function deserializeArrowSchema(schema: Schema): ArrowSchema {
|
|
51
|
-
return new ArrowSchema(
|
|
52
|
-
schema.fields.map((field) => deserializeArrowField(field)),
|
|
53
|
-
deserializeArrowMetadata(schema.metadata)
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function serializeArrowMetadata(arrowMetadata: Map<string, string>): SchemaMetadata {
|
|
58
|
-
return Object.fromEntries(arrowMetadata);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function deserializeArrowMetadata(metadata?: SchemaMetadata): Map<string, string> {
|
|
62
|
-
return metadata ? new Map(Object.entries(metadata)) : new Map<string, string>();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function serializeArrowField(field: ArrowField): Field {
|
|
66
|
-
return {
|
|
67
|
-
name: field.name,
|
|
68
|
-
type: serializeArrowType(field.type),
|
|
69
|
-
nullable: field.nullable,
|
|
70
|
-
metadata: serializeArrowMetadata(field.metadata)
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function deserializeArrowField(field: Field): ArrowField {
|
|
75
|
-
return new ArrowField(
|
|
76
|
-
field.name,
|
|
77
|
-
deserializeArrowType(field.type),
|
|
78
|
-
field.nullable,
|
|
79
|
-
deserializeArrowMetadata(field.metadata)
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/** Converts a serializable loaders.gl data type to hydrated arrow data type */
|
|
84
|
-
// eslint-disable-next-line complexity
|
|
85
|
-
export function serializeArrowType(arrowType: ArrowDataType): DataType {
|
|
86
|
-
switch (arrowType.constructor) {
|
|
87
|
-
case Null:
|
|
88
|
-
return 'null';
|
|
89
|
-
case Binary:
|
|
90
|
-
return 'binary';
|
|
91
|
-
case Bool:
|
|
92
|
-
return 'bool';
|
|
93
|
-
// case Int: return 'int';
|
|
94
|
-
case Int8:
|
|
95
|
-
return 'int8';
|
|
96
|
-
case Int16:
|
|
97
|
-
return 'int16';
|
|
98
|
-
case Int32:
|
|
99
|
-
return 'int32';
|
|
100
|
-
case Int64:
|
|
101
|
-
return 'int64';
|
|
102
|
-
case Uint8:
|
|
103
|
-
return 'uint8';
|
|
104
|
-
case Uint16:
|
|
105
|
-
return 'uint16';
|
|
106
|
-
case Uint32:
|
|
107
|
-
return 'uint32';
|
|
108
|
-
case Uint64:
|
|
109
|
-
return 'uint64';
|
|
110
|
-
// case Float: return 'float';
|
|
111
|
-
case Float16:
|
|
112
|
-
return 'float16';
|
|
113
|
-
case Float32:
|
|
114
|
-
return 'float32';
|
|
115
|
-
case Float64:
|
|
116
|
-
return 'float64';
|
|
117
|
-
case Utf8:
|
|
118
|
-
return 'utf8';
|
|
119
|
-
// case Date: return 'date';
|
|
120
|
-
case DateDay:
|
|
121
|
-
return 'date-day';
|
|
122
|
-
case DateMillisecond:
|
|
123
|
-
return 'date-millisecond';
|
|
124
|
-
// case Time: return 'time';
|
|
125
|
-
case TimeMillisecond:
|
|
126
|
-
return 'time-millisecond';
|
|
127
|
-
case TimeSecond:
|
|
128
|
-
return 'time-second';
|
|
129
|
-
// case Timestamp: return 'timestamp';
|
|
130
|
-
case TimestampSecond:
|
|
131
|
-
return 'timestamp-second';
|
|
132
|
-
case TimestampMillisecond:
|
|
133
|
-
return 'timestamp-millisecond';
|
|
134
|
-
case TimestampMicrosecond:
|
|
135
|
-
return 'timestamp-microsecond';
|
|
136
|
-
case TimestampNanosecond:
|
|
137
|
-
return 'timestamp-nanosecond';
|
|
138
|
-
// case Interval: return 'interval';
|
|
139
|
-
case IntervalDayTime:
|
|
140
|
-
return 'interval-daytime';
|
|
141
|
-
case IntervalYearMonth:
|
|
142
|
-
return 'interval-yearmonth';
|
|
143
|
-
case FixedSizeList:
|
|
144
|
-
return {
|
|
145
|
-
type: 'fixed-size-list',
|
|
146
|
-
listSize: (arrowType as FixedSizeList).listSize,
|
|
147
|
-
children: [serializeArrowField((arrowType as FixedSizeList).children[0])]
|
|
148
|
-
};
|
|
149
|
-
// case Struct:
|
|
150
|
-
// return {type: 'struct', children: (arrowType as Struct).children};
|
|
151
|
-
default:
|
|
152
|
-
throw new Error('array type not supported');
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/** Converts a serializable loaders.gl data type to hydrated arrow data type */
|
|
157
|
-
// eslint-disable-next-line complexity
|
|
158
|
-
export function deserializeArrowType(dataType: DataType): ArrowDataType {
|
|
159
|
-
if (typeof dataType === 'object') {
|
|
160
|
-
switch (dataType.type) {
|
|
161
|
-
case 'fixed-size-list':
|
|
162
|
-
const child = deserializeArrowField(dataType.children[0]);
|
|
163
|
-
return new FixedSizeList(dataType.listSize, child);
|
|
164
|
-
case 'struct':
|
|
165
|
-
const children = dataType.children.map((arrowField) => deserializeArrowField(arrowField));
|
|
166
|
-
return new Struct(children);
|
|
167
|
-
default:
|
|
168
|
-
throw new Error('array type not supported');
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
switch (dataType) {
|
|
173
|
-
case 'null':
|
|
174
|
-
return new Null();
|
|
175
|
-
case 'binary':
|
|
176
|
-
return new Binary();
|
|
177
|
-
case 'bool':
|
|
178
|
-
return new Bool();
|
|
179
|
-
// case 'int': return new Int();
|
|
180
|
-
case 'int8':
|
|
181
|
-
return new Int8();
|
|
182
|
-
case 'int16':
|
|
183
|
-
return new Int16();
|
|
184
|
-
case 'int32':
|
|
185
|
-
return new Int32();
|
|
186
|
-
case 'int64':
|
|
187
|
-
return new Int64();
|
|
188
|
-
case 'uint8':
|
|
189
|
-
return new Uint8();
|
|
190
|
-
case 'uint16':
|
|
191
|
-
return new Uint16();
|
|
192
|
-
case 'uint32':
|
|
193
|
-
return new Uint32();
|
|
194
|
-
case 'uint64':
|
|
195
|
-
return new Uint64();
|
|
196
|
-
// case 'float': return new Float();
|
|
197
|
-
case 'float16':
|
|
198
|
-
return new Float16();
|
|
199
|
-
case 'float32':
|
|
200
|
-
return new Float32();
|
|
201
|
-
case 'float64':
|
|
202
|
-
return new Float64();
|
|
203
|
-
case 'utf8':
|
|
204
|
-
return new Utf8();
|
|
205
|
-
// case 'date': return new Date();
|
|
206
|
-
case 'date-day':
|
|
207
|
-
return new DateDay();
|
|
208
|
-
case 'date-millisecond':
|
|
209
|
-
return new DateMillisecond();
|
|
210
|
-
// case 'time': return new Time();
|
|
211
|
-
case 'time-millisecond':
|
|
212
|
-
return new TimeMillisecond();
|
|
213
|
-
case 'time-second':
|
|
214
|
-
return new TimeSecond();
|
|
215
|
-
// case 'timestamp': return new Timestamp();
|
|
216
|
-
case 'timestamp-second':
|
|
217
|
-
return new TimestampSecond();
|
|
218
|
-
case 'timestamp-millisecond':
|
|
219
|
-
return new TimestampMillisecond();
|
|
220
|
-
case 'timestamp-microsecond':
|
|
221
|
-
return new TimestampMicrosecond();
|
|
222
|
-
case 'timestamp-nanosecond':
|
|
223
|
-
return new TimestampNanosecond();
|
|
224
|
-
// case 'interval': return new Interval();
|
|
225
|
-
case 'interval-daytime':
|
|
226
|
-
return new IntervalDayTime();
|
|
227
|
-
case 'interval-yearmonth':
|
|
228
|
-
return new IntervalYearMonth();
|
|
229
|
-
default:
|
|
230
|
-
throw new Error('array type not supported');
|
|
231
|
-
}
|
|
232
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// loaders.gl, MIT license
|
|
2
|
-
|
|
3
|
-
// import {
|
|
4
|
-
// Table as ApacheArrowTable,
|
|
5
|
-
// Schema as ApacheArrowSchema,
|
|
6
|
-
// RecordBatch,
|
|
7
|
-
// FixedSizeList,
|
|
8
|
-
// Field,
|
|
9
|
-
// Data,
|
|
10
|
-
// FixedSizeListVector
|
|
11
|
-
// } from 'apache-arrow/Arrow.dom';
|
|
12
|
-
// import {AbstractVector} from 'apache-arrow/vector';
|
|
13
|
-
|
|
14
|
-
// import {Table} from '../../types/category-table';
|
|
15
|
-
// import {getArrowType, getArrowVector} from './arrow-type-utils';
|
|
16
|
-
// import {makeMeshAttributeMetadata} from './deduce-mesh-schema';
|
|
17
|
-
// import {getTableLength, getTableNumCols} from './table-accessors';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* * Convert a loaders.gl Mesh to an Apache Arrow Table
|
|
21
|
-
* @param mesh
|
|
22
|
-
* @param metadata
|
|
23
|
-
* @param batchSize
|
|
24
|
-
* @returns
|
|
25
|
-
*
|
|
26
|
-
export function convertTableToArrow(table: Table, options?: {batchSize?: number}): ArrowTable {
|
|
27
|
-
const vectors: AbstractVector[] = [];
|
|
28
|
-
const fields: Field[] = [];
|
|
29
|
-
|
|
30
|
-
const length = getTableLength(table);
|
|
31
|
-
const batchSize = options?.batchSize || length;
|
|
32
|
-
|
|
33
|
-
const recordBatches: RecordBatch[] = [];
|
|
34
|
-
for (let i = 0; i < length; i += batchSize) {
|
|
35
|
-
for (let columnIndex = 0; columnIndex < getTableNumCols(table); ++columnIndex) {
|
|
36
|
-
const field_ = table.schema.fields[columnIndex];
|
|
37
|
-
const column = getTableColumnAt(table, columnIndex, i, batchSize);
|
|
38
|
-
const type = getArrowType(column);
|
|
39
|
-
const vector = getArrowVector(column);
|
|
40
|
-
const listType = new FixedSizeList(size, new Field('value', type));
|
|
41
|
-
const field = new Field(field_.name, listType, false, makeMeshAttributeMetadata(attribute));
|
|
42
|
-
const data = new Data(listType, 0, value.length / size, 0, undefined, [vector]);
|
|
43
|
-
const listVector = new FixedSizeListVector(data);
|
|
44
|
-
vectors.push(listVector);
|
|
45
|
-
fields.push(field);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
for (const attributeKey in table.columns) {
|
|
49
|
-
const attribute = mesh.attributes[attributeKey];
|
|
50
|
-
const {value, size = 1} = attribute;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const schema = new ApacheArrowSchema(fields, table?.schema?.metadata || new Map<string, string>());
|
|
54
|
-
const recordBatch = new RecordBatch(schema, vectors[0].length, vectors);
|
|
55
|
-
const apacheArrowTable = new ApacheArrowTable(schema, recordBatch);
|
|
56
|
-
|
|
57
|
-
return apacheArrowTable;
|
|
58
|
-
}
|
|
59
|
-
*/
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|