@loaders.gl/schema 4.0.0-alpha.4 → 4.0.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/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +2 -2
- package/dist/dist.min.js +13589 -0
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/index.js +406 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/lib/mesh/convert-mesh.js +34 -0
- package/dist/es5/lib/mesh/convert-mesh.js.map +1 -0
- package/dist/es5/lib/mesh/deduce-mesh-schema.js +56 -0
- package/dist/es5/lib/mesh/deduce-mesh-schema.js.map +1 -0
- package/dist/es5/lib/mesh/mesh-to-arrow-table.js +2 -0
- package/dist/es5/lib/mesh/mesh-to-arrow-table.js.map +1 -0
- package/dist/es5/lib/mesh/mesh-utils.js +40 -0
- package/dist/es5/lib/mesh/mesh-utils.js.map +1 -0
- package/dist/es5/lib/table/arrow/arrow-type-utils.js +30 -0
- package/dist/es5/lib/table/arrow/arrow-type-utils.js.map +1 -0
- package/dist/es5/lib/table/arrow/convert-schema-arrow.js +179 -0
- package/dist/es5/lib/table/arrow/convert-schema-arrow.js.map +1 -0
- package/dist/es5/lib/table/arrow/convert-table-to-arrow.js +2 -0
- package/dist/es5/lib/table/arrow/convert-table-to-arrow.js.map +1 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-field.js +49 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-field.js.map +1 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-schema.js +118 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-schema.js.map +1 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-table.js +80 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-table.js.map +1 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-type.js +740 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-type.js.map +1 -0
- package/dist/es5/lib/table/arrow-api/enum.js +55 -0
- package/dist/es5/lib/table/arrow-api/enum.js.map +1 -0
- package/dist/es5/lib/table/arrow-api/get-type-info.js +27 -0
- package/dist/es5/lib/table/arrow-api/get-type-info.js.map +1 -0
- package/dist/es5/lib/table/arrow-api/index.js +44 -0
- package/dist/es5/lib/table/arrow-api/index.js.map +1 -0
- package/dist/es5/lib/table/batches/base-table-batch-aggregator.js +78 -0
- package/dist/es5/lib/table/batches/base-table-batch-aggregator.js.map +1 -0
- package/dist/es5/lib/table/batches/columnar-table-batch-aggregator.js +106 -0
- package/dist/es5/lib/table/batches/columnar-table-batch-aggregator.js.map +1 -0
- package/dist/es5/lib/table/batches/row-table-batch-aggregator.js +96 -0
- package/dist/es5/lib/table/batches/row-table-batch-aggregator.js.map +1 -0
- package/dist/es5/lib/table/batches/table-batch-aggregator.js +2 -0
- package/dist/es5/lib/table/batches/table-batch-aggregator.js.map +1 -0
- package/dist/es5/lib/table/batches/table-batch-builder.js +173 -0
- package/dist/es5/lib/table/batches/table-batch-builder.js.map +1 -0
- package/dist/es5/lib/table/simple-table/convert-table.js +82 -0
- package/dist/es5/lib/table/simple-table/convert-table.js.map +1 -0
- package/dist/es5/lib/table/simple-table/data-type.js +94 -0
- package/dist/es5/lib/table/simple-table/data-type.js.map +1 -0
- package/dist/es5/lib/table/simple-table/make-table.js +60 -0
- package/dist/es5/lib/table/simple-table/make-table.js.map +1 -0
- package/dist/es5/lib/table/simple-table/row-utils.js +34 -0
- package/dist/es5/lib/table/simple-table/row-utils.js.map +1 -0
- package/dist/es5/lib/table/simple-table/table-accessors.js +343 -0
- package/dist/es5/lib/table/simple-table/table-accessors.js.map +1 -0
- package/dist/es5/lib/table/simple-table/table-column.js +12 -0
- package/dist/es5/lib/table/simple-table/table-column.js.map +1 -0
- package/dist/es5/lib/table/simple-table/table-schema.js +85 -0
- package/dist/es5/lib/table/simple-table/table-schema.js.map +1 -0
- package/dist/es5/lib/utils/assert.js +12 -0
- package/dist/es5/lib/utils/assert.js.map +1 -0
- package/dist/es5/lib/utils/async-queue.js +169 -0
- package/dist/es5/lib/utils/async-queue.js.map +1 -0
- package/dist/es5/types/category-gis.js +2 -0
- package/dist/es5/types/category-gis.js.map +1 -0
- package/dist/es5/types/category-image.js +2 -0
- package/dist/es5/types/category-image.js.map +1 -0
- package/dist/es5/types/category-mesh.js +2 -0
- package/dist/es5/types/category-mesh.js.map +1 -0
- package/dist/es5/types/category-table.js +2 -0
- package/dist/es5/types/category-table.js.map +1 -0
- package/dist/es5/types/category-texture.js +2 -0
- package/dist/es5/types/category-texture.js.map +1 -0
- package/dist/es5/types/schema.js +2 -0
- package/dist/es5/types/schema.js.map +1 -0
- package/dist/es5/types/types.js +2 -0
- package/dist/es5/types/types.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/index.js +16 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/{category → esm/lib}/mesh/convert-mesh.js +0 -11
- package/dist/esm/lib/mesh/convert-mesh.js.map +1 -0
- package/dist/esm/lib/mesh/deduce-mesh-schema.js +48 -0
- package/dist/esm/lib/mesh/deduce-mesh-schema.js.map +1 -0
- package/dist/esm/lib/mesh/mesh-to-arrow-table.js +2 -0
- package/dist/esm/lib/mesh/mesh-to-arrow-table.js.map +1 -0
- package/dist/{category → esm/lib}/mesh/mesh-utils.js +0 -5
- package/dist/esm/lib/mesh/mesh-utils.js.map +1 -0
- package/dist/{lib/arrow/arrow-like-type-utils.js → esm/lib/table/arrow/arrow-type-utils.js} +3 -11
- package/dist/esm/lib/table/arrow/arrow-type-utils.js.map +1 -0
- package/dist/esm/lib/table/arrow/convert-schema-arrow.js +158 -0
- package/dist/esm/lib/table/arrow/convert-schema-arrow.js.map +1 -0
- package/dist/esm/lib/table/arrow/convert-table-to-arrow.js +2 -0
- package/dist/esm/lib/table/arrow/convert-table-to-arrow.js.map +1 -0
- package/dist/{lib/schema/impl/field.js → esm/lib/table/arrow-api/arrow-like-field.js} +6 -13
- package/dist/esm/lib/table/arrow-api/arrow-like-field.js.map +1 -0
- package/dist/{lib/schema/impl/schema.js → esm/lib/table/arrow-api/arrow-like-schema.js} +22 -47
- package/dist/esm/lib/table/arrow-api/arrow-like-schema.js.map +1 -0
- package/dist/esm/lib/table/arrow-api/arrow-like-table.js +51 -0
- package/dist/esm/lib/table/arrow-api/arrow-like-table.js.map +1 -0
- package/dist/{lib/schema/impl/type.js → esm/lib/table/arrow-api/arrow-like-type.js} +11 -116
- package/dist/esm/lib/table/arrow-api/arrow-like-type.js.map +1 -0
- package/dist/{lib/schema/impl → esm/lib/table/arrow-api}/enum.js +3 -4
- package/dist/esm/lib/table/arrow-api/enum.js.map +1 -0
- package/dist/{lib/arrow → esm/lib/table/arrow-api}/get-type-info.js +1 -4
- package/dist/esm/lib/table/arrow-api/get-type-info.js.map +1 -0
- package/dist/esm/lib/table/arrow-api/index.js +5 -0
- package/dist/esm/lib/table/arrow-api/index.js.map +1 -0
- package/dist/{lib → esm/lib/table}/batches/base-table-batch-aggregator.js +1 -18
- package/dist/esm/lib/table/batches/base-table-batch-aggregator.js.map +1 -0
- package/dist/{lib → esm/lib/table}/batches/columnar-table-batch-aggregator.js +1 -24
- package/dist/esm/lib/table/batches/columnar-table-batch-aggregator.js.map +1 -0
- package/dist/{lib → esm/lib/table}/batches/row-table-batch-aggregator.js +2 -22
- package/dist/esm/lib/table/batches/row-table-batch-aggregator.js.map +1 -0
- package/dist/esm/lib/table/batches/table-batch-aggregator.js.map +1 -0
- package/dist/{lib → esm/lib/table}/batches/table-batch-builder.js +6 -49
- package/dist/esm/lib/table/batches/table-batch-builder.js.map +1 -0
- package/dist/esm/lib/table/simple-table/convert-table.js +59 -0
- package/dist/esm/lib/table/simple-table/convert-table.js.map +1 -0
- package/dist/esm/lib/table/simple-table/data-type.js +85 -0
- package/dist/esm/lib/table/simple-table/data-type.js.map +1 -0
- package/dist/esm/lib/table/simple-table/make-table.js +50 -0
- package/dist/esm/lib/table/simple-table/make-table.js.map +1 -0
- package/dist/{lib/utils → esm/lib/table/simple-table}/row-utils.js +0 -8
- package/dist/esm/lib/table/simple-table/row-utils.js.map +1 -0
- package/dist/esm/lib/table/simple-table/table-accessors.js +262 -0
- package/dist/esm/lib/table/simple-table/table-accessors.js.map +1 -0
- package/dist/esm/lib/table/simple-table/table-column.js +6 -0
- package/dist/esm/lib/table/simple-table/table-column.js.map +1 -0
- package/dist/esm/lib/table/simple-table/table-schema.js +70 -0
- package/dist/esm/lib/table/simple-table/table-schema.js.map +1 -0
- package/dist/esm/lib/utils/assert.js +6 -0
- package/dist/esm/lib/utils/assert.js.map +1 -0
- package/dist/esm/lib/utils/async-queue.js +94 -0
- package/dist/esm/lib/utils/async-queue.js.map +1 -0
- package/dist/esm/types/category-gis.js +2 -0
- package/dist/esm/types/category-gis.js.map +1 -0
- package/dist/esm/types/category-image.js +2 -0
- package/dist/esm/types/category-image.js.map +1 -0
- package/dist/esm/types/category-mesh.js +2 -0
- package/dist/esm/types/category-mesh.js.map +1 -0
- package/dist/esm/types/category-table.js +2 -0
- package/dist/esm/types/category-table.js.map +1 -0
- package/dist/esm/types/category-texture.js +2 -0
- package/dist/esm/types/category-texture.js.map +1 -0
- package/dist/esm/types/schema.js +2 -0
- package/dist/esm/types/schema.js.map +1 -0
- package/dist/esm/types/types.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +92 -13
- package/dist/lib/mesh/convert-mesh.d.ts +15 -0
- package/dist/lib/mesh/convert-mesh.d.ts.map +1 -0
- package/dist/lib/mesh/convert-mesh.js +40 -0
- package/dist/lib/mesh/deduce-mesh-schema.d.ts +24 -0
- package/dist/lib/mesh/deduce-mesh-schema.d.ts.map +1 -0
- package/dist/lib/mesh/deduce-mesh-schema.js +66 -0
- package/dist/lib/mesh/mesh-to-arrow-table.d.ts +1 -0
- package/dist/lib/mesh/mesh-to-arrow-table.d.ts.map +1 -0
- package/dist/lib/mesh/mesh-to-arrow-table.js +44 -0
- package/dist/lib/mesh/mesh-utils.d.ts +23 -0
- package/dist/lib/mesh/mesh-utils.d.ts.map +1 -0
- package/dist/lib/mesh/mesh-utils.js +51 -0
- package/dist/lib/table/arrow/arrow-type-utils.d.ts +4 -0
- package/dist/lib/table/arrow/arrow-type-utils.d.ts.map +1 -0
- package/dist/lib/table/arrow/arrow-type-utils.js +53 -0
- package/dist/lib/table/arrow/convert-schema-arrow.d.ts +13 -0
- package/dist/lib/table/arrow/convert-schema-arrow.d.ts.map +1 -0
- package/dist/lib/table/arrow/convert-schema-arrow.js +187 -0
- package/dist/lib/table/arrow/convert-table-to-arrow.d.ts +42 -0
- package/dist/lib/table/arrow/convert-table-to-arrow.d.ts.map +1 -0
- package/dist/lib/table/arrow/convert-table-to-arrow.js +57 -0
- package/dist/lib/table/arrow-api/arrow-like-field.d.ts +19 -0
- package/dist/lib/table/arrow-api/arrow-like-field.d.ts.map +1 -0
- package/dist/lib/table/arrow-api/arrow-like-field.js +34 -0
- package/dist/lib/table/arrow-api/arrow-like-schema.d.ts +12 -0
- package/dist/lib/table/arrow-api/arrow-like-schema.d.ts.map +1 -0
- package/dist/lib/table/arrow-api/arrow-like-schema.js +81 -0
- package/dist/lib/table/arrow-api/arrow-like-table.d.ts +28 -0
- package/dist/lib/table/arrow-api/arrow-like-table.d.ts.map +1 -0
- package/dist/lib/table/arrow-api/arrow-like-table.js +53 -0
- package/dist/lib/table/arrow-api/arrow-like-type.d.ts +177 -0
- package/dist/lib/table/arrow-api/arrow-like-type.d.ts.map +1 -0
- package/dist/lib/table/arrow-api/arrow-like-type.js +463 -0
- package/dist/lib/table/arrow-api/enum.d.ts +92 -0
- package/dist/lib/table/arrow-api/enum.d.ts.map +1 -0
- package/dist/lib/table/arrow-api/enum.js +97 -0
- package/dist/lib/table/arrow-api/get-type-info.d.ts +13 -0
- package/dist/lib/table/arrow-api/get-type-info.d.ts.map +1 -0
- package/dist/lib/table/arrow-api/get-type-info.js +29 -0
- package/dist/lib/table/arrow-api/index.d.ts +5 -0
- package/dist/lib/table/arrow-api/index.d.ts.map +1 -0
- package/dist/lib/table/arrow-api/index.js +25 -0
- package/dist/lib/table/batches/base-table-batch-aggregator.d.ts +19 -0
- package/dist/lib/table/batches/base-table-batch-aggregator.d.ts.map +1 -0
- package/dist/lib/table/batches/base-table-batch-aggregator.js +60 -0
- package/dist/lib/table/batches/columnar-table-batch-aggregator.d.ts +23 -0
- package/dist/lib/table/batches/columnar-table-batch-aggregator.d.ts.map +1 -0
- package/dist/lib/table/batches/columnar-table-batch-aggregator.js +92 -0
- package/dist/lib/table/batches/row-table-batch-aggregator.d.ts +22 -0
- package/dist/lib/table/batches/row-table-batch-aggregator.d.ts.map +1 -0
- package/dist/lib/table/batches/row-table-batch-aggregator.js +81 -0
- package/dist/lib/table/batches/table-batch-aggregator.d.ts +25 -0
- package/dist/lib/table/batches/table-batch-aggregator.d.ts.map +1 -0
- package/dist/lib/table/batches/table-batch-aggregator.js +3 -0
- package/dist/lib/table/batches/table-batch-builder.d.ts +53 -0
- package/dist/lib/table/batches/table-batch-builder.d.ts.map +1 -0
- package/dist/lib/table/batches/table-batch-builder.js +152 -0
- package/dist/lib/table/simple-table/convert-table.d.ts +8 -0
- package/dist/lib/table/simple-table/convert-table.d.ts.map +1 -0
- package/dist/lib/table/simple-table/convert-table.js +65 -0
- package/dist/lib/table/simple-table/data-type.d.ts +17 -0
- package/dist/lib/table/simple-table/data-type.d.ts.map +1 -0
- package/dist/lib/table/simple-table/data-type.js +93 -0
- package/dist/lib/table/simple-table/make-table.d.ts +65 -0
- package/dist/lib/table/simple-table/make-table.d.ts.map +1 -0
- package/dist/lib/table/simple-table/make-table.js +95 -0
- package/dist/lib/table/simple-table/row-utils.d.ts +9 -0
- package/dist/lib/table/simple-table/row-utils.d.ts.map +1 -0
- package/dist/lib/table/simple-table/row-utils.js +33 -0
- package/dist/lib/table/simple-table/table-accessors.d.ts +67 -0
- package/dist/lib/table/simple-table/table-accessors.d.ts.map +1 -0
- package/dist/lib/table/simple-table/table-accessors.js +319 -0
- package/dist/lib/table/simple-table/table-column.d.ts +7 -0
- package/dist/lib/table/simple-table/table-column.d.ts.map +1 -0
- package/dist/lib/table/simple-table/table-column.js +41 -0
- package/dist/lib/table/simple-table/table-schema.d.ts +15 -0
- package/dist/lib/table/simple-table/table-schema.d.ts.map +1 -0
- package/dist/lib/table/simple-table/table-schema.js +85 -0
- package/dist/lib/utils/assert.d.ts +2 -0
- package/dist/lib/utils/assert.d.ts.map +1 -0
- package/dist/lib/utils/assert.js +11 -5
- package/dist/lib/utils/async-queue.d.ts +18 -0
- package/dist/lib/utils/async-queue.d.ts.map +1 -0
- package/dist/lib/utils/async-queue.js +82 -109
- package/dist/types/category-gis.d.ts +99 -0
- package/dist/types/category-gis.d.ts.map +1 -0
- package/dist/types/category-gis.js +2 -0
- package/dist/types/category-image.d.ts +18 -0
- package/dist/types/category-image.d.ts.map +1 -0
- package/dist/types/category-image.js +2 -0
- package/dist/types/category-mesh.d.ts +48 -0
- package/dist/types/category-mesh.d.ts.map +1 -0
- package/dist/types/category-mesh.js +3 -0
- package/dist/types/category-table.d.ts +86 -0
- package/dist/types/category-table.d.ts.map +1 -0
- package/dist/types/category-table.js +3 -0
- package/dist/types/category-texture.d.ts +18 -0
- package/dist/types/category-texture.d.ts.map +1 -0
- package/dist/types/category-texture.js +3 -0
- package/dist/types/schema.d.ts +77 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/schema.js +3 -0
- package/dist/types/types.d.ts +15 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +2 -0
- package/package.json +7 -8
- package/src/index.ts +82 -29
- package/src/{category → lib}/mesh/convert-mesh.ts +10 -8
- package/src/{category → lib}/mesh/deduce-mesh-schema.ts +20 -19
- package/src/{category → lib}/mesh/mesh-to-arrow-table.ts +5 -3
- package/src/{category → lib}/mesh/mesh-utils.ts +2 -2
- package/src/lib/{arrow → table/arrow}/arrow-type-utils.ts +16 -12
- package/src/lib/table/arrow/convert-schema-arrow.ts +232 -0
- package/src/lib/table/arrow/convert-table-to-arrow.ts +59 -0
- package/src/lib/{schema/impl/field.ts → table/arrow-api/arrow-like-field.ts} +6 -4
- package/src/lib/table/arrow-api/arrow-like-schema.ts +99 -0
- package/src/lib/table/arrow-api/arrow-like-table.ts +83 -0
- package/src/lib/{schema/impl/type.ts → table/arrow-api/arrow-like-type.ts} +2 -1
- package/src/lib/{arrow → table/arrow-api}/get-type-info.ts +4 -3
- package/src/lib/table/arrow-api/index.ts +6 -0
- package/src/lib/{batches → table/batches}/base-table-batch-aggregator.ts +5 -3
- package/src/lib/{batches → table/batches}/columnar-table-batch-aggregator.ts +5 -3
- package/src/lib/{batches → table/batches}/row-table-batch-aggregator.ts +6 -4
- package/src/lib/{batches → table/batches}/table-batch-aggregator.ts +4 -2
- package/src/lib/{batches → table/batches}/table-batch-builder.ts +8 -6
- package/src/lib/table/simple-table/convert-table.ts +72 -0
- package/src/lib/table/simple-table/data-type.ts +102 -0
- package/src/lib/table/simple-table/make-table.ts +108 -0
- package/src/lib/table/simple-table/table-accessors.ts +360 -0
- package/src/lib/table/simple-table/table-column.ts +47 -0
- package/src/lib/table/simple-table/table-schema.ts +97 -0
- package/src/types/category-gis.ts +136 -0
- package/src/types/category-image.ts +19 -0
- package/src/{category/mesh/mesh-types.ts → types/category-mesh.ts} +6 -4
- package/src/types/category-table.ts +104 -0
- package/src/types/category-texture.ts +30 -0
- package/src/types/schema.ts +97 -0
- package/src/types/types.ts +43 -0
- package/dist/bundle.js.map +0 -1
- package/dist/category/common.js +0 -2
- package/dist/category/common.js.map +0 -1
- package/dist/category/gis.js +0 -2
- package/dist/category/gis.js.map +0 -1
- package/dist/category/mesh/convert-mesh.js.map +0 -1
- package/dist/category/mesh/deduce-mesh-schema.js +0 -42
- package/dist/category/mesh/deduce-mesh-schema.js.map +0 -1
- package/dist/category/mesh/mesh-to-arrow-table.js +0 -31
- package/dist/category/mesh/mesh-to-arrow-table.js.map +0 -1
- package/dist/category/mesh/mesh-types.js +0 -2
- package/dist/category/mesh/mesh-types.js.map +0 -1
- package/dist/category/mesh/mesh-utils.js.map +0 -1
- package/dist/category/table/deduce-table-schema.js +0 -51
- package/dist/category/table/deduce-table-schema.js.map +0 -1
- package/dist/category/table/table-types.js +0 -2
- package/dist/category/table/table-types.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/arrow/arrow-like-type-utils.js.map +0 -1
- package/dist/lib/arrow/arrow-type-utils.js +0 -62
- package/dist/lib/arrow/arrow-type-utils.js.map +0 -1
- package/dist/lib/arrow/get-type-info.js.map +0 -1
- package/dist/lib/batches/base-table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/columnar-table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/row-table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/table-batch-builder.js.map +0 -1
- package/dist/lib/schema/impl/enum.js.map +0 -1
- package/dist/lib/schema/impl/field.js.map +0 -1
- package/dist/lib/schema/impl/schema.js.map +0 -1
- package/dist/lib/schema/impl/type.js.map +0 -1
- package/dist/lib/schema/index.js +0 -5
- package/dist/lib/schema/index.js.map +0 -1
- package/dist/lib/schema-utils/deduce-column-type.js +0 -23
- package/dist/lib/schema-utils/deduce-column-type.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/lib/utils/row-utils.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/src/category/common.ts +0 -30
- package/src/category/gis.ts +0 -61
- package/src/category/table/deduce-table-schema.ts +0 -123
- package/src/category/table/table-types.ts +0 -81
- package/src/lib/arrow/arrow-like-type-utils.ts +0 -25
- package/src/lib/schema/impl/schema.ts +0 -99
- package/src/lib/schema/index.ts +0 -82
- package/src/lib/schema-utils/deduce-column-type.ts +0 -92
- package/src/types.ts +0 -19
- /package/dist/{lib → esm/lib/table}/batches/table-batch-aggregator.js +0 -0
- /package/dist/{types.js → esm/types/types.js} +0 -0
- /package/src/lib/{schema/impl → table/arrow-api}/enum.ts +0 -0
- /package/src/lib/{utils → table/simple-table}/row-utils.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/schema",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.6",
|
|
4
4
|
"description": "Table format APIs for JSON, CSV, etc...",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"point cloud",
|
|
19
19
|
"PLY"
|
|
20
20
|
],
|
|
21
|
-
"types": "
|
|
22
|
-
"main": "dist/index.js",
|
|
23
|
-
"module": "dist/index.js",
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
|
+
"main": "dist/es5/index.js",
|
|
23
|
+
"module": "dist/esm/index.js",
|
|
24
24
|
"sideEffects": false,
|
|
25
25
|
"files": [
|
|
26
26
|
"src",
|
|
@@ -29,11 +29,10 @@
|
|
|
29
29
|
],
|
|
30
30
|
"scripts": {
|
|
31
31
|
"pre-build": "npm run build-bundle",
|
|
32
|
-
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/
|
|
32
|
+
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@types/geojson": "^7946.0.7"
|
|
36
|
-
"apache-arrow": "^4.0.0"
|
|
35
|
+
"@types/geojson": "^7946.0.7"
|
|
37
36
|
},
|
|
38
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "acc1985050dfaa0f1f0c066f8da5bce7454a046c"
|
|
39
38
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,32 +1,60 @@
|
|
|
1
1
|
// COMMON CATEGORY
|
|
2
|
-
export type {
|
|
2
|
+
export type {
|
|
3
|
+
TypedArray,
|
|
4
|
+
TypedArrayConstructor,
|
|
5
|
+
NumberArray,
|
|
6
|
+
ArrayType,
|
|
7
|
+
AnyArray
|
|
8
|
+
} from './types/types';
|
|
3
9
|
|
|
4
|
-
export type {Batch} from './
|
|
10
|
+
export type {Schema, Field, DataType, Batch, SchemaMetadata, FieldMetadata} from './types/schema';
|
|
5
11
|
|
|
6
12
|
// TABLE CATEGORY TYPES
|
|
7
|
-
|
|
8
13
|
export type {
|
|
9
14
|
Table,
|
|
15
|
+
RowTable,
|
|
10
16
|
ArrayRowTable,
|
|
11
17
|
ObjectRowTable,
|
|
18
|
+
GeoJSONRowTable,
|
|
12
19
|
ColumnarTable,
|
|
13
|
-
ArrowTable
|
|
14
|
-
|
|
20
|
+
ArrowTable,
|
|
21
|
+
Tables
|
|
22
|
+
} from './types/category-table';
|
|
15
23
|
export type {
|
|
16
24
|
TableBatch,
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
ArrayRowTableBatch,
|
|
26
|
+
ObjectRowTableBatch,
|
|
27
|
+
GeoJSONRowTableBatch,
|
|
19
28
|
ColumnarTableBatch,
|
|
20
29
|
ArrowTableBatch
|
|
21
|
-
} from './category
|
|
30
|
+
} from './types/category-table';
|
|
22
31
|
|
|
23
32
|
// TABLE CATEGORY UTILS
|
|
24
|
-
export {
|
|
25
|
-
export type {TableBatchAggregator} from './lib/batches/table-batch-aggregator';
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
33
|
+
export {TableBatchBuilder} from './lib/table/batches/table-batch-builder';
|
|
34
|
+
export type {TableBatchAggregator} from './lib/table/batches/table-batch-aggregator';
|
|
35
|
+
export {RowTableBatchAggregator} from './lib/table/batches/row-table-batch-aggregator';
|
|
36
|
+
export {ColumnarTableBatchAggregator} from './lib/table/batches/columnar-table-batch-aggregator';
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
getTableLength,
|
|
40
|
+
getTableNumCols,
|
|
41
|
+
getTableCell,
|
|
42
|
+
getTableRowShape,
|
|
43
|
+
getTableColumnIndex,
|
|
44
|
+
getTableColumnName,
|
|
45
|
+
getTableRowAsObject,
|
|
46
|
+
getTableRowAsArray,
|
|
47
|
+
makeRowIterator,
|
|
48
|
+
makeArrayRowIterator,
|
|
49
|
+
makeObjectRowIterator
|
|
50
|
+
} from './lib/table/simple-table/table-accessors';
|
|
51
|
+
|
|
52
|
+
export {ArrowLikeTable} from './lib/table/arrow-api/arrow-like-table';
|
|
28
53
|
|
|
29
|
-
export {
|
|
54
|
+
export {makeTableFromData} from './lib/table/simple-table/make-table';
|
|
55
|
+
export {deduceTableSchema} from './lib/table/simple-table/table-schema';
|
|
56
|
+
export {convertToObjectRow, convertToArrayRow} from './lib/table/simple-table/row-utils';
|
|
57
|
+
export {getDataTypeFromArray} from './lib/table/simple-table/data-type';
|
|
30
58
|
|
|
31
59
|
// MESH CATEGORY
|
|
32
60
|
export type {
|
|
@@ -36,27 +64,53 @@ export type {
|
|
|
36
64
|
MeshGeometry,
|
|
37
65
|
MeshAttribute,
|
|
38
66
|
MeshAttributes
|
|
39
|
-
} from './category
|
|
67
|
+
} from './types/category-mesh';
|
|
40
68
|
|
|
41
|
-
export {getMeshSize, getMeshBoundingBox} from './
|
|
42
|
-
|
|
69
|
+
export {getMeshSize, getMeshBoundingBox} from './lib/mesh/mesh-utils';
|
|
70
|
+
// Commented out due to https://github.com/visgl/deck.gl/issues/6906 and https://github.com/visgl/loaders.gl/issues/2177
|
|
71
|
+
// export {convertMesh} from './category/mesh/convert-mesh';
|
|
43
72
|
export {
|
|
44
73
|
deduceMeshSchema,
|
|
45
74
|
deduceMeshField,
|
|
46
75
|
makeMeshAttributeMetadata
|
|
47
|
-
} from './
|
|
76
|
+
} from './lib/mesh/deduce-mesh-schema';
|
|
77
|
+
|
|
78
|
+
// TEXTURES
|
|
79
|
+
export type {TextureLevel, GPUTextureFormat} from './types/category-texture';
|
|
80
|
+
|
|
81
|
+
// IMAGES
|
|
82
|
+
export type {ImageDataType, ImageType, ImageTypeEnum} from './types/category-image';
|
|
48
83
|
|
|
49
84
|
// TYPES
|
|
50
85
|
// GIS CATEGORY - GEOJSON
|
|
51
|
-
export type {GeoJSON, Feature, Geometry, Position, GeoJsonProperties} from './category/gis';
|
|
52
86
|
export type {
|
|
87
|
+
GeoJSON,
|
|
88
|
+
Feature,
|
|
89
|
+
FeatureCollection,
|
|
90
|
+
Geometry,
|
|
91
|
+
Position,
|
|
92
|
+
GeoJsonProperties,
|
|
53
93
|
Point,
|
|
54
94
|
MultiPoint,
|
|
55
95
|
LineString,
|
|
56
96
|
MultiLineString,
|
|
57
97
|
Polygon,
|
|
58
|
-
MultiPolygon
|
|
59
|
-
|
|
98
|
+
MultiPolygon,
|
|
99
|
+
GeometryCollection
|
|
100
|
+
} from './types/category-gis';
|
|
101
|
+
|
|
102
|
+
export type {GeojsonGeometryInfo} from './types/category-gis';
|
|
103
|
+
|
|
104
|
+
// GIS CATEGORY - FLAT GEOJSON
|
|
105
|
+
export type {
|
|
106
|
+
FlatFeature,
|
|
107
|
+
FlatIndexedGeometry,
|
|
108
|
+
FlatGeometry,
|
|
109
|
+
FlatGeometryType,
|
|
110
|
+
FlatPoint,
|
|
111
|
+
FlatLineString,
|
|
112
|
+
FlatPolygon
|
|
113
|
+
} from './types/category-gis';
|
|
60
114
|
|
|
61
115
|
// GIS CATEGORY - BINARY
|
|
62
116
|
export type {
|
|
@@ -66,19 +120,19 @@ export type {
|
|
|
66
120
|
BinaryLineGeometry,
|
|
67
121
|
BinaryPolygonGeometry,
|
|
68
122
|
BinaryAttribute
|
|
69
|
-
} from './category
|
|
123
|
+
} from './types/category-gis';
|
|
70
124
|
export type {
|
|
71
125
|
BinaryFeatures,
|
|
72
126
|
BinaryPointFeatures,
|
|
73
127
|
BinaryLineFeatures,
|
|
74
128
|
BinaryPolygonFeatures
|
|
75
|
-
} from './category
|
|
129
|
+
} from './types/category-gis';
|
|
76
130
|
|
|
77
131
|
// SCHEMA
|
|
78
132
|
export {
|
|
79
|
-
Schema,
|
|
80
|
-
Field,
|
|
81
|
-
DataType,
|
|
133
|
+
Schema as ArrowLikeSchema,
|
|
134
|
+
Field as ArrowLikeField,
|
|
135
|
+
DataType as ArrowLikeDataType,
|
|
82
136
|
Null,
|
|
83
137
|
Binary,
|
|
84
138
|
Bool,
|
|
@@ -112,13 +166,12 @@ export {
|
|
|
112
166
|
IntervalYearMonth,
|
|
113
167
|
FixedSizeList,
|
|
114
168
|
Struct
|
|
115
|
-
} from './lib/
|
|
169
|
+
} from './lib/table/arrow-api';
|
|
116
170
|
|
|
117
171
|
// EXPERIMENTAL APIs
|
|
118
172
|
|
|
119
173
|
// SCHEMA UTILS
|
|
120
|
-
export {
|
|
121
|
-
export {
|
|
122
|
-
export {getArrowTypeFromTypedArray} from './lib/arrow/arrow-like-type-utils';
|
|
174
|
+
export {getTypeInfo} from './lib/table/arrow-api/get-type-info';
|
|
175
|
+
export {getArrowType} from './lib/table/arrow/arrow-type-utils';
|
|
123
176
|
|
|
124
177
|
export {default as AsyncQueue} from './lib/utils/async-queue';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
// loaders.gl, MIT license
|
|
2
|
+
|
|
3
|
+
import type {Mesh} from '../../types/category-mesh';
|
|
4
|
+
import type {ColumnarTable, ArrowTable} from '../../types/category-table';
|
|
5
|
+
// import {convertMeshToArrowTable} from './mesh-to-arrow-table';
|
|
4
6
|
|
|
5
7
|
type TargetShape = 'mesh' | 'columnar-table' | 'arrow-table';
|
|
6
8
|
|
|
@@ -17,11 +19,11 @@ export function convertMesh(
|
|
|
17
19
|
return mesh;
|
|
18
20
|
case 'columnar-table':
|
|
19
21
|
return convertMeshToColumnarTable(mesh);
|
|
20
|
-
case 'arrow-table':
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
// case 'arrow-table':
|
|
23
|
+
// return {
|
|
24
|
+
// shape: 'arrow-table',
|
|
25
|
+
// data: convertMeshToArrowTable(mesh)
|
|
26
|
+
// };
|
|
25
27
|
default:
|
|
26
28
|
throw new Error(`Unsupported shape ${options?.shape}`);
|
|
27
29
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
// loaders.gl, MIT license
|
|
2
|
+
|
|
3
|
+
import {MeshAttribute, MeshAttributes} from '../../types/category-mesh';
|
|
4
|
+
import {Schema, Field} from '../../types/schema';
|
|
5
|
+
import {getDataTypeFromTypedArray} from '../table/simple-table/data-type';
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Create a schema for mesh attributes data
|
|
@@ -10,10 +12,10 @@ import {getArrowTypeFromTypedArray} from '../../lib/arrow/arrow-like-type-utils'
|
|
|
10
12
|
*/
|
|
11
13
|
export function deduceMeshSchema(
|
|
12
14
|
attributes: MeshAttributes,
|
|
13
|
-
metadata
|
|
15
|
+
metadata: Record<string, string> = {}
|
|
14
16
|
): Schema {
|
|
15
17
|
const fields = deduceMeshFields(attributes);
|
|
16
|
-
return
|
|
18
|
+
return {fields, metadata};
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -24,19 +26,18 @@ export function deduceMeshSchema(
|
|
|
24
26
|
* @returns
|
|
25
27
|
*/
|
|
26
28
|
export function deduceMeshField(
|
|
27
|
-
|
|
29
|
+
name: string,
|
|
28
30
|
attribute: MeshAttribute,
|
|
29
|
-
optionalMetadata?:
|
|
31
|
+
optionalMetadata?: Record<string, string>
|
|
30
32
|
): Field {
|
|
31
|
-
const type =
|
|
33
|
+
const type = getDataTypeFromTypedArray(attribute.value);
|
|
32
34
|
const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
false,
|
|
35
|
+
return {
|
|
36
|
+
name,
|
|
37
|
+
type: {type: 'fixed-size-list', listSize: attribute.size, children: [{name: 'value', type}]},
|
|
38
|
+
nullable: false,
|
|
37
39
|
metadata
|
|
38
|
-
|
|
39
|
-
return field;
|
|
40
|
+
};
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
/**
|
|
@@ -58,16 +59,16 @@ function deduceMeshFields(attributes: MeshAttributes): Field[] {
|
|
|
58
59
|
* @param attribute
|
|
59
60
|
* @returns
|
|
60
61
|
*/
|
|
61
|
-
export function makeMeshAttributeMetadata(attribute: MeshAttribute):
|
|
62
|
-
const result =
|
|
62
|
+
export function makeMeshAttributeMetadata(attribute: MeshAttribute): Record<string, string> {
|
|
63
|
+
const result: Record<string, string> = {};
|
|
63
64
|
if ('byteOffset' in attribute) {
|
|
64
|
-
result.
|
|
65
|
+
result.byteOffset = attribute.byteOffset!.toString(10);
|
|
65
66
|
}
|
|
66
67
|
if ('byteStride' in attribute) {
|
|
67
|
-
result.
|
|
68
|
+
result.byteStride = attribute.byteStride!.toString(10);
|
|
68
69
|
}
|
|
69
70
|
if ('normalized' in attribute) {
|
|
70
|
-
result.
|
|
71
|
+
result.normalized = attribute.normalized!.toString();
|
|
71
72
|
}
|
|
72
73
|
return result;
|
|
73
74
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* Problem with arrow dependency...
|
|
1
2
|
import {
|
|
2
3
|
Table,
|
|
3
4
|
Schema,
|
|
@@ -6,9 +7,9 @@ import {
|
|
|
6
7
|
Field,
|
|
7
8
|
Data,
|
|
8
9
|
FixedSizeListVector
|
|
9
|
-
} from 'apache-arrow
|
|
10
|
+
} from 'apache-arrow';
|
|
10
11
|
import {AbstractVector} from 'apache-arrow/vector';
|
|
11
|
-
import {getArrowType, getArrowVector} from '
|
|
12
|
+
import {getArrowType, getArrowVector} from '../table/arrow/arrow-type-utils';
|
|
12
13
|
import type {Mesh} from './mesh-types';
|
|
13
14
|
import {makeMeshAttributeMetadata} from './deduce-mesh-schema';
|
|
14
15
|
|
|
@@ -18,7 +19,7 @@ import {makeMeshAttributeMetadata} from './deduce-mesh-schema';
|
|
|
18
19
|
* @param metadata
|
|
19
20
|
* @param batchSize
|
|
20
21
|
* @returns
|
|
21
|
-
|
|
22
|
+
*
|
|
22
23
|
export function convertMeshToArrowTable(mesh: Mesh, batchSize?: number): Table {
|
|
23
24
|
const vectors: AbstractVector[] = [];
|
|
24
25
|
const fields: Field[] = [];
|
|
@@ -39,3 +40,4 @@ export function convertMeshToArrowTable(mesh: Mesh, batchSize?: number): Table {
|
|
|
39
40
|
const table = new Table(schema, recordBatch);
|
|
40
41
|
return table;
|
|
41
42
|
}
|
|
43
|
+
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Mesh category utilities
|
|
2
2
|
// TODO - move to mesh category module, or to math.gl/geometry module
|
|
3
|
-
import {TypedArray} from '../../types';
|
|
4
|
-
import {MeshAttributes} from '
|
|
3
|
+
import {TypedArray} from '../../types/types';
|
|
4
|
+
import {MeshAttributes} from '../../types/category-mesh';
|
|
5
5
|
|
|
6
6
|
type TypedArrays = {[key: string]: TypedArray};
|
|
7
7
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// loaders.gl, MIT license
|
|
2
|
+
|
|
3
|
+
import type {TypedArray} from '../../../types/types';
|
|
2
4
|
import {
|
|
3
5
|
DataType,
|
|
4
6
|
Float32,
|
|
@@ -8,17 +10,17 @@ import {
|
|
|
8
10
|
Int8,
|
|
9
11
|
Uint16,
|
|
10
12
|
Uint32,
|
|
11
|
-
Uint8
|
|
12
|
-
Int8Vector,
|
|
13
|
-
Uint8Vector,
|
|
14
|
-
Int16Vector,
|
|
15
|
-
Uint16Vector,
|
|
16
|
-
Int32Vector,
|
|
17
|
-
Uint32Vector,
|
|
18
|
-
Float32Vector,
|
|
19
|
-
Float64Vector
|
|
20
|
-
} from 'apache-arrow
|
|
21
|
-
import {AbstractVector} from 'apache-arrow/vector';
|
|
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';
|
|
22
24
|
|
|
23
25
|
export function getArrowType(array: TypedArray): DataType {
|
|
24
26
|
switch (array.constructor) {
|
|
@@ -43,6 +45,7 @@ export function getArrowType(array: TypedArray): DataType {
|
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
/*
|
|
46
49
|
export function getArrowVector(array: TypedArray): AbstractVector {
|
|
47
50
|
switch (array.constructor) {
|
|
48
51
|
case Int8Array:
|
|
@@ -65,3 +68,4 @@ export function getArrowVector(array: TypedArray): AbstractVector {
|
|
|
65
68
|
throw new Error('array type not supported');
|
|
66
69
|
}
|
|
67
70
|
}
|
|
71
|
+
*/
|
|
@@ -0,0 +1,232 @@
|
|
|
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
|
+
}
|