@loaders.gl/schema 4.0.0-alpha.5 → 4.0.0-alpha.7
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.js +2 -2
- package/dist/dist.min.js +11362 -13932
- 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 +27 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +92 -13
- package/dist/{category → lib}/mesh/convert-mesh.d.ts +3 -3
- package/dist/lib/mesh/convert-mesh.d.ts.map +1 -0
- package/dist/lib/mesh/convert-mesh.js +40 -0
- package/dist/{category → lib}/mesh/deduce-mesh-schema.d.ts +5 -5
- 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/{category → lib}/mesh/mesh-utils.d.ts +4 -4
- 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/{schema/impl/field.d.ts → table/arrow-api/arrow-like-field.d.ts} +4 -4
- 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/{schema/impl/type.d.ts → table/arrow-api/arrow-like-type.d.ts} +7 -6
- 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.map +1 -0
- package/dist/lib/table/arrow-api/enum.js +97 -0
- package/dist/lib/{arrow → table/arrow-api}/get-type-info.d.ts +2 -3
- 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/{batches → table/batches}/base-table-batch-aggregator.d.ts +3 -3
- 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/{batches → table/batches}/columnar-table-batch-aggregator.d.ts +4 -4
- 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/{batches → table/batches}/row-table-batch-aggregator.d.ts +3 -3
- 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/{batches → table/batches}/table-batch-aggregator.d.ts +2 -2
- 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/{batches → table/batches}/table-batch-builder.d.ts +5 -5
- 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.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.js +11 -5
- package/dist/lib/utils/async-queue.js +82 -109
- package/dist/{category/gis.d.ts → types/category-gis.d.ts} +26 -26
- package/dist/types/category-gis.d.ts.map +1 -0
- package/dist/types/category-gis.js +2 -0
- package/dist/{category/image/image.d.ts → types/category-image.d.ts} +4 -4
- package/dist/types/category-image.d.ts.map +1 -0
- package/dist/types/category-image.js +2 -0
- package/dist/{category/mesh/mesh-types.d.ts → types/category-mesh.d.ts} +8 -10
- package/dist/types/category-mesh.d.ts.map +1 -0
- package/dist/types/category-mesh.js +3 -0
- package/dist/{category/table/table-types.d.ts → types/category-table.d.ts} +44 -34
- 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 +5 -6
- package/src/index.ts +65 -31
- 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/{category/gis.ts → types/category-gis.ts} +9 -2
- package/src/{category/mesh/mesh-types.ts → types/category-mesh.ts} +6 -4
- package/src/types/category-table.ts +104 -0
- package/src/{category/texture/texture.ts → types/category-texture.ts} +3 -1
- 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.d.ts +0 -19
- package/dist/category/common.d.ts.map +0 -1
- package/dist/category/common.js +0 -2
- package/dist/category/common.js.map +0 -1
- package/dist/category/gis.d.ts.map +0 -1
- package/dist/category/gis.js +0 -2
- package/dist/category/gis.js.map +0 -1
- package/dist/category/image/image.d.ts.map +0 -1
- package/dist/category/image/image.js +0 -2
- package/dist/category/image/image.js.map +0 -1
- package/dist/category/mesh/convert-mesh.d.ts.map +0 -1
- package/dist/category/mesh/convert-mesh.js.map +0 -1
- package/dist/category/mesh/deduce-mesh-schema.d.ts.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.d.ts +0 -11
- package/dist/category/mesh/mesh-to-arrow-table.d.ts.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.d.ts.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.d.ts.map +0 -1
- package/dist/category/mesh/mesh-utils.js.map +0 -1
- package/dist/category/table/deduce-table-schema.d.ts +0 -9
- package/dist/category/table/deduce-table-schema.d.ts.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.d.ts.map +0 -1
- package/dist/category/table/table-types.js +0 -2
- package/dist/category/table/table-types.js.map +0 -1
- package/dist/category/texture/texture.d.ts +0 -18
- package/dist/category/texture/texture.d.ts.map +0 -1
- package/dist/category/texture/texture.js +0 -2
- package/dist/category/texture/texture.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/arrow/arrow-like-type-utils.d.ts +0 -4
- package/dist/lib/arrow/arrow-like-type-utils.d.ts.map +0 -1
- package/dist/lib/arrow/arrow-like-type-utils.js.map +0 -1
- package/dist/lib/arrow/arrow-type-utils.d.ts +0 -6
- package/dist/lib/arrow/arrow-type-utils.d.ts.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.d.ts.map +0 -1
- package/dist/lib/arrow/get-type-info.js.map +0 -1
- package/dist/lib/batches/base-table-batch-aggregator.d.ts.map +0 -1
- package/dist/lib/batches/base-table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/columnar-table-batch-aggregator.d.ts.map +0 -1
- package/dist/lib/batches/columnar-table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/row-table-batch-aggregator.d.ts.map +0 -1
- package/dist/lib/batches/row-table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/table-batch-aggregator.d.ts.map +0 -1
- package/dist/lib/batches/table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/table-batch-builder.d.ts.map +0 -1
- package/dist/lib/batches/table-batch-builder.js.map +0 -1
- package/dist/lib/schema/impl/enum.d.ts.map +0 -1
- package/dist/lib/schema/impl/enum.js.map +0 -1
- package/dist/lib/schema/impl/field.d.ts.map +0 -1
- package/dist/lib/schema/impl/field.js.map +0 -1
- package/dist/lib/schema/impl/schema.d.ts +0 -16
- package/dist/lib/schema/impl/schema.d.ts.map +0 -1
- package/dist/lib/schema/impl/schema.js.map +0 -1
- package/dist/lib/schema/impl/type.d.ts.map +0 -1
- package/dist/lib/schema/impl/type.js.map +0 -1
- package/dist/lib/schema/schema.d.ts +0 -5
- package/dist/lib/schema/schema.d.ts.map +0 -1
- package/dist/lib/schema/schema.js +0 -5
- package/dist/lib/schema/schema.js.map +0 -1
- package/dist/lib/schema-utils/deduce-column-type.d.ts +0 -3
- package/dist/lib/schema-utils/deduce-column-type.d.ts.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.d.ts.map +0 -1
- package/dist/lib/utils/row-utils.js.map +0 -1
- package/dist/types.d.ts +0 -8
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/src/category/common.ts +0 -30
- 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 -35
- package/src/lib/schema/impl/schema.ts +0 -99
- package/src/lib/schema/schema.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/dist/lib/{schema/impl → table/arrow-api}/enum.d.ts +0 -0
- /package/dist/lib/{utils → table/simple-table}/row-utils.d.ts +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/src/{category/image/image.ts → types/category-image.ts} +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// loaders.gl, MIT license
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.BaseTableBatchAggregator = void 0;
|
|
5
|
+
const DEFAULT_ROW_COUNT = 100;
|
|
6
|
+
class BaseTableBatchAggregator {
|
|
7
|
+
constructor(schema, options) {
|
|
8
|
+
this.length = 0;
|
|
9
|
+
this.rows = null;
|
|
10
|
+
this.cursor = 0;
|
|
11
|
+
this._headers = [];
|
|
12
|
+
this.options = options;
|
|
13
|
+
this.schema = schema;
|
|
14
|
+
// schema is an array if there're no headers
|
|
15
|
+
// object if there are headers
|
|
16
|
+
if (!Array.isArray(schema)) {
|
|
17
|
+
this._headers = [];
|
|
18
|
+
for (const key in schema) {
|
|
19
|
+
this._headers[schema[key].index] = schema[key].name;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
rowCount() {
|
|
24
|
+
return this.length;
|
|
25
|
+
}
|
|
26
|
+
addArrayRow(row, cursor) {
|
|
27
|
+
if (Number.isFinite(cursor)) {
|
|
28
|
+
this.cursor = cursor;
|
|
29
|
+
}
|
|
30
|
+
this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
|
|
31
|
+
this.rows[this.length] = row;
|
|
32
|
+
this.length++;
|
|
33
|
+
}
|
|
34
|
+
addObjectRow(row, cursor) {
|
|
35
|
+
if (Number.isFinite(cursor)) {
|
|
36
|
+
this.cursor = cursor;
|
|
37
|
+
}
|
|
38
|
+
this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
|
|
39
|
+
this.rows[this.length] = row;
|
|
40
|
+
this.length++;
|
|
41
|
+
}
|
|
42
|
+
getBatch() {
|
|
43
|
+
let rows = this.rows;
|
|
44
|
+
if (!rows) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
rows = rows.slice(0, this.length);
|
|
48
|
+
this.rows = null;
|
|
49
|
+
const batch = {
|
|
50
|
+
shape: this.options.shape,
|
|
51
|
+
batchType: 'data',
|
|
52
|
+
data: rows,
|
|
53
|
+
length: this.length,
|
|
54
|
+
schema: this.schema,
|
|
55
|
+
cursor: this.cursor
|
|
56
|
+
};
|
|
57
|
+
return batch;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.BaseTableBatchAggregator = BaseTableBatchAggregator;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Schema } from '
|
|
2
|
-
import type { ColumnarTableBatch, ArrowTableBatch } from '
|
|
1
|
+
import type { Schema } from '../../../types/schema';
|
|
2
|
+
import type { ColumnarTableBatch, ArrowTableBatch } from '../../../types/category-table';
|
|
3
3
|
import { TableBatchAggregator } from './table-batch-aggregator';
|
|
4
|
-
|
|
5
|
-
export
|
|
4
|
+
type ColumnarTableBatchOptions = {};
|
|
5
|
+
export declare class ColumnarTableBatchAggregator implements TableBatchAggregator {
|
|
6
6
|
schema: Schema;
|
|
7
7
|
length: number;
|
|
8
8
|
allocated: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"columnar-table-batch-aggregator.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/batches/columnar-table-batch-aggregator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAC,kBAAkB,EAAE,eAAe,EAAC,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAC,oBAAoB,EAAC,MAAM,0BAA0B,CAAC;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"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// loaders.gl, MIT license
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ColumnarTableBatchAggregator = void 0;
|
|
5
|
+
const DEFAULT_ROW_COUNT = 100;
|
|
6
|
+
class ColumnarTableBatchAggregator {
|
|
7
|
+
constructor(schema, options) {
|
|
8
|
+
this.length = 0;
|
|
9
|
+
this.allocated = 0;
|
|
10
|
+
this.columns = {};
|
|
11
|
+
this.schema = schema;
|
|
12
|
+
this._reallocateColumns();
|
|
13
|
+
}
|
|
14
|
+
rowCount() {
|
|
15
|
+
return this.length;
|
|
16
|
+
}
|
|
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++;
|
|
26
|
+
}
|
|
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++;
|
|
34
|
+
}
|
|
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;
|
|
56
|
+
}
|
|
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
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.ColumnarTableBatchAggregator = ColumnarTableBatchAggregator;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema } from '
|
|
2
|
-
import type { TableBatch } from '
|
|
1
|
+
import type { Schema } from '../../../types/schema';
|
|
2
|
+
import type { TableBatch } from '../../../types/category-table';
|
|
3
3
|
import { TableBatchAggregator, TableBatchOptions } from './table-batch-aggregator';
|
|
4
|
-
export
|
|
4
|
+
export declare class RowTableBatchAggregator implements TableBatchAggregator {
|
|
5
5
|
schema: Schema;
|
|
6
6
|
options: TableBatchOptions;
|
|
7
7
|
length: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-table-batch-aggregator.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/batches/row-table-batch-aggregator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,+BAA+B,CAAC;AAG9D,OAAO,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAIjF,qBAAa,uBAAwB,YAAW,oBAAoB;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,iBAAiB,CAAC;IAE3B,MAAM,EAAE,MAAM,CAAK;IACnB,UAAU,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,GAAG,IAAI,CAAQ;IACtD,SAAS,EAAE,GAAG,EAAE,GAAG,IAAI,CAAQ;IAC/B,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;IAmB9C,YAAY,CAAC,GAAG,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAmBrE,QAAQ,IAAI,UAAU,GAAG,IAAI;CAmB9B"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// loaders.gl, MIT license
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.RowTableBatchAggregator = void 0;
|
|
5
|
+
// import type {ArrayRowTableBatch, ObjectRowTableBatch} from '../../category/table.js';
|
|
6
|
+
const row_utils_1 = require("../simple-table/row-utils");
|
|
7
|
+
const DEFAULT_ROW_COUNT = 100;
|
|
8
|
+
class RowTableBatchAggregator {
|
|
9
|
+
constructor(schema, options) {
|
|
10
|
+
this.length = 0;
|
|
11
|
+
this.objectRows = null;
|
|
12
|
+
this.arrayRows = null;
|
|
13
|
+
this.cursor = 0;
|
|
14
|
+
this._headers = [];
|
|
15
|
+
this.options = options;
|
|
16
|
+
this.schema = schema;
|
|
17
|
+
// schema is an array if there're no headers
|
|
18
|
+
// object if there are headers
|
|
19
|
+
if (!Array.isArray(schema)) {
|
|
20
|
+
this._headers = [];
|
|
21
|
+
for (const key in schema) {
|
|
22
|
+
this._headers[schema[key].index] = schema[key].name;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
rowCount() {
|
|
27
|
+
return this.length;
|
|
28
|
+
}
|
|
29
|
+
addArrayRow(row, cursor) {
|
|
30
|
+
if (Number.isFinite(cursor)) {
|
|
31
|
+
this.cursor = cursor;
|
|
32
|
+
}
|
|
33
|
+
// eslint-disable-next-line default-case
|
|
34
|
+
switch (this.options.shape) {
|
|
35
|
+
case 'object-row-table':
|
|
36
|
+
const rowObject = (0, row_utils_1.convertToObjectRow)(row, this._headers);
|
|
37
|
+
this.addObjectRow(rowObject, cursor);
|
|
38
|
+
break;
|
|
39
|
+
case 'array-row-table':
|
|
40
|
+
this.arrayRows = this.arrayRows || new Array(DEFAULT_ROW_COUNT);
|
|
41
|
+
this.arrayRows[this.length] = row;
|
|
42
|
+
this.length++;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
addObjectRow(row, cursor) {
|
|
47
|
+
if (Number.isFinite(cursor)) {
|
|
48
|
+
this.cursor = cursor;
|
|
49
|
+
}
|
|
50
|
+
// eslint-disable-next-line default-case
|
|
51
|
+
switch (this.options.shape) {
|
|
52
|
+
case 'array-row-table':
|
|
53
|
+
const rowArray = (0, row_utils_1.convertToArrayRow)(row, this._headers);
|
|
54
|
+
this.addArrayRow(rowArray, cursor);
|
|
55
|
+
break;
|
|
56
|
+
case 'object-row-table':
|
|
57
|
+
this.objectRows = this.objectRows || new Array(DEFAULT_ROW_COUNT);
|
|
58
|
+
this.objectRows[this.length] = row;
|
|
59
|
+
this.length++;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
getBatch() {
|
|
64
|
+
let rows = this.arrayRows || this.objectRows;
|
|
65
|
+
if (!rows) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
rows = rows.slice(0, this.length);
|
|
69
|
+
this.arrayRows = null;
|
|
70
|
+
this.objectRows = null;
|
|
71
|
+
return {
|
|
72
|
+
shape: this.options.shape,
|
|
73
|
+
batchType: 'data',
|
|
74
|
+
data: rows,
|
|
75
|
+
length: this.length,
|
|
76
|
+
schema: this.schema,
|
|
77
|
+
cursor: this.cursor
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.RowTableBatchAggregator = RowTableBatchAggregator;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Schema } from '
|
|
2
|
-
import type { TableBatch } from '
|
|
1
|
+
import type { Schema } from '../../../types/schema';
|
|
2
|
+
import type { TableBatch } from '../../../types/category-table';
|
|
3
3
|
export interface TableBatchOptions {
|
|
4
4
|
batchSize: number | string;
|
|
5
5
|
[key: string]: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-batch-aggregator.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/batches/table-batch-aggregator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,+BAA+B,CAAC;AAE9D,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,oBAAoB,CAAC;CACxE;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,qBAAqB;IACrB,QAAQ,IAAI,MAAM,CAAC;IACnB,kBAAkB;IAClB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC9B,kBAAkB;IAClB,YAAY,CAAC,GAAG,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,GAAG,IAAI,CAAC;IACrD,4BAA4B;IAC5B,QAAQ,IAAI,UAAU,GAAG,IAAI,CAAC;CAC/B"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type { Schema } from '
|
|
2
|
-
import type { TableBatch } from '
|
|
1
|
+
import type { Schema } from '../../../types/schema';
|
|
2
|
+
import type { TableBatch } from '../../../types/category-table';
|
|
3
3
|
import type { TableBatchConstructor } from './table-batch-aggregator';
|
|
4
|
-
|
|
4
|
+
type TableBatchBuilderOptions = {
|
|
5
5
|
shape: 'row-table' | 'array-row-table' | 'object-row-table' | 'columnar-table' | 'arrow-table';
|
|
6
6
|
batchSize?: number | 'auto';
|
|
7
7
|
batchDebounceMs?: number;
|
|
8
8
|
limit: number;
|
|
9
9
|
_limitMB: number;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
type GetBatchOptions = {
|
|
12
12
|
bytesUsed?: number;
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
};
|
|
15
15
|
/** Incrementally builds batches from a stream of rows */
|
|
16
|
-
export
|
|
16
|
+
export declare class TableBatchBuilder {
|
|
17
17
|
schema: Schema;
|
|
18
18
|
options: Required<TableBatchBuilderOptions>;
|
|
19
19
|
private aggregator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-batch-builder.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/batches/table-batch-builder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,EAAuB,qBAAqB,EAAC,MAAM,0BAA0B,CAAC;AAM1F,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,WAAW,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,aAAa,CAAC;IAC/F,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAYF,yDAAyD;AACzD,qBAAa,iBAAiB;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,QAAQ,CAAC,wBAAwB,CAAC,CAAC;IAE5C,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,kBAAkB,CAAsB;IAChD,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAa;IAE7B,MAAM,CAAC,UAAU,CAAC,EAAE,qBAAqB,CAAC;gBAE9B,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB;IAK9D,YAAY,IAAI,OAAO;IAUvB,kDAAkD;IAClD,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,GAAG,IAAI;IActD,+BAA+B;IAC/B,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;IAQhC,+BAA+B;IAC/B,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,GAAG,IAAI;IAQ9D,sDAAsD;IACtD,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI;IAUhD,YAAY,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,UAAU,GAAG,IAAI;IAI1D,aAAa,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,UAAU,GAAG,IAAI;IAM3D,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,MAAM,GAAG,MAAM;IAI3C,OAAO,CAAC,OAAO;IA2Bf;;OAEG;IACH,OAAO,CAAC,SAAS;IAmBjB,OAAO,CAAC,kBAAkB;CAkB3B"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// loaders.gl, MIT license
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TableBatchBuilder = void 0;
|
|
5
|
+
const base_table_batch_aggregator_1 = require("./base-table-batch-aggregator");
|
|
6
|
+
const row_table_batch_aggregator_1 = require("./row-table-batch-aggregator");
|
|
7
|
+
const columnar_table_batch_aggregator_1 = require("./columnar-table-batch-aggregator");
|
|
8
|
+
const DEFAULT_OPTIONS = {
|
|
9
|
+
shape: 'array-row-table',
|
|
10
|
+
batchSize: 'auto',
|
|
11
|
+
batchDebounceMs: 0,
|
|
12
|
+
limit: 0,
|
|
13
|
+
_limitMB: 0
|
|
14
|
+
};
|
|
15
|
+
const ERR_MESSAGE = 'TableBatchBuilder';
|
|
16
|
+
/** Incrementally builds batches from a stream of rows */
|
|
17
|
+
class TableBatchBuilder {
|
|
18
|
+
constructor(schema, options) {
|
|
19
|
+
this.aggregator = null;
|
|
20
|
+
this.batchCount = 0;
|
|
21
|
+
this.bytesUsed = 0;
|
|
22
|
+
this.isChunkComplete = false;
|
|
23
|
+
this.lastBatchEmittedMs = Date.now();
|
|
24
|
+
this.totalLength = 0;
|
|
25
|
+
this.totalBytes = 0;
|
|
26
|
+
this.rowBytes = 0;
|
|
27
|
+
this.schema = schema;
|
|
28
|
+
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
29
|
+
}
|
|
30
|
+
limitReached() {
|
|
31
|
+
if (Boolean(this.options?.limit) && this.totalLength >= this.options.limit) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
if (Boolean(this.options?._limitMB) && this.totalBytes / 1e6 >= this.options._limitMB) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
/** @deprecated Use addArrayRow or addObjectRow */
|
|
40
|
+
addRow(row) {
|
|
41
|
+
if (this.limitReached()) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.totalLength++;
|
|
45
|
+
this.rowBytes = this.rowBytes || this._estimateRowMB(row);
|
|
46
|
+
this.totalBytes += this.rowBytes;
|
|
47
|
+
if (Array.isArray(row)) {
|
|
48
|
+
this.addArrayRow(row);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.addObjectRow(row);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** Add one row to the batch */
|
|
55
|
+
addArrayRow(row) {
|
|
56
|
+
if (!this.aggregator) {
|
|
57
|
+
const TableBatchType = this._getTableBatchType();
|
|
58
|
+
this.aggregator = new TableBatchType(this.schema, this.options);
|
|
59
|
+
}
|
|
60
|
+
this.aggregator.addArrayRow(row);
|
|
61
|
+
}
|
|
62
|
+
/** Add one row to the batch */
|
|
63
|
+
addObjectRow(row) {
|
|
64
|
+
if (!this.aggregator) {
|
|
65
|
+
const TableBatchType = this._getTableBatchType();
|
|
66
|
+
this.aggregator = new TableBatchType(this.schema, this.options);
|
|
67
|
+
}
|
|
68
|
+
this.aggregator.addObjectRow(row);
|
|
69
|
+
}
|
|
70
|
+
/** Mark an incoming raw memory chunk has completed */
|
|
71
|
+
chunkComplete(chunk) {
|
|
72
|
+
if (chunk instanceof ArrayBuffer) {
|
|
73
|
+
this.bytesUsed += chunk.byteLength;
|
|
74
|
+
}
|
|
75
|
+
if (typeof chunk === 'string') {
|
|
76
|
+
this.bytesUsed += chunk.length;
|
|
77
|
+
}
|
|
78
|
+
this.isChunkComplete = true;
|
|
79
|
+
}
|
|
80
|
+
getFullBatch(options) {
|
|
81
|
+
return this._isFull() ? this._getBatch(options) : null;
|
|
82
|
+
}
|
|
83
|
+
getFinalBatch(options) {
|
|
84
|
+
return this._getBatch(options);
|
|
85
|
+
}
|
|
86
|
+
// INTERNAL
|
|
87
|
+
_estimateRowMB(row) {
|
|
88
|
+
return Array.isArray(row) ? row.length * 8 : Object.keys(row).length * 8;
|
|
89
|
+
}
|
|
90
|
+
_isFull() {
|
|
91
|
+
// No batch, not ready
|
|
92
|
+
if (!this.aggregator || this.aggregator.rowCount() === 0) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
// if batchSize === 'auto' we wait for chunk to complete
|
|
96
|
+
// if batchSize === number, ensure we have enough rows
|
|
97
|
+
if (this.options.batchSize === 'auto') {
|
|
98
|
+
if (!this.isChunkComplete) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else if (this.options.batchSize > this.aggregator.rowCount()) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
// Debounce batches
|
|
106
|
+
if (this.options.batchDebounceMs > Date.now() - this.lastBatchEmittedMs) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
// Emit batch
|
|
110
|
+
this.isChunkComplete = false;
|
|
111
|
+
this.lastBatchEmittedMs = Date.now();
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* bytesUsed can be set via chunkComplete or via getBatch*
|
|
116
|
+
*/
|
|
117
|
+
_getBatch(options) {
|
|
118
|
+
if (!this.aggregator) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
// TODO - this can overly increment bytes used?
|
|
122
|
+
if (options?.bytesUsed) {
|
|
123
|
+
this.bytesUsed = options.bytesUsed;
|
|
124
|
+
}
|
|
125
|
+
const normalizedBatch = this.aggregator.getBatch();
|
|
126
|
+
normalizedBatch.count = this.batchCount;
|
|
127
|
+
normalizedBatch.bytesUsed = this.bytesUsed;
|
|
128
|
+
Object.assign(normalizedBatch, options);
|
|
129
|
+
this.batchCount++;
|
|
130
|
+
this.aggregator = null;
|
|
131
|
+
return normalizedBatch;
|
|
132
|
+
}
|
|
133
|
+
_getTableBatchType() {
|
|
134
|
+
switch (this.options.shape) {
|
|
135
|
+
case 'row-table':
|
|
136
|
+
return base_table_batch_aggregator_1.BaseTableBatchAggregator;
|
|
137
|
+
case 'array-row-table':
|
|
138
|
+
case 'object-row-table':
|
|
139
|
+
return row_table_batch_aggregator_1.RowTableBatchAggregator;
|
|
140
|
+
case 'columnar-table':
|
|
141
|
+
return columnar_table_batch_aggregator_1.ColumnarTableBatchAggregator;
|
|
142
|
+
case 'arrow-table':
|
|
143
|
+
if (!TableBatchBuilder.ArrowBatch) {
|
|
144
|
+
throw new Error(ERR_MESSAGE);
|
|
145
|
+
}
|
|
146
|
+
return TableBatchBuilder.ArrowBatch;
|
|
147
|
+
default:
|
|
148
|
+
throw new Error(ERR_MESSAGE);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
exports.TableBatchBuilder = TableBatchBuilder;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Table, ArrayRowTable, ObjectRowTable, ColumnarTable } from '../../../types/category-table';
|
|
2
|
+
/** Convert any simple table into columnar format */
|
|
3
|
+
export declare function makeColumnarTable(table: Table): ColumnarTable;
|
|
4
|
+
/** Convert any table into array row format */
|
|
5
|
+
export declare function makeArrayRowTable(table: Table): ArrayRowTable;
|
|
6
|
+
/** Convert any table into object row format */
|
|
7
|
+
export declare function makeObjectRowTable(table: Table): ObjectRowTable;
|
|
8
|
+
//# sourceMappingURL=convert-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-table.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/simple-table/convert-table.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAC,MAAM,+BAA+B,CAAC;AAIlG,oDAAoD;AACpD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,CAyB7D;AAED,8CAA8C;AAC9C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,CAc7D;AAED,+CAA+C;AAC/C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,CAc/D"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeObjectRowTable = exports.makeArrayRowTable = exports.makeColumnarTable = void 0;
|
|
4
|
+
// loaders.gl, MIT license
|
|
5
|
+
const table_accessors_1 = require("./table-accessors");
|
|
6
|
+
const table_schema_1 = require("./table-schema");
|
|
7
|
+
const table_column_1 = require("./table-column");
|
|
8
|
+
/** Convert any simple table into columnar format */
|
|
9
|
+
function makeColumnarTable(table) {
|
|
10
|
+
// TODO - should schema really be optional?
|
|
11
|
+
const schema = table.schema || (0, table_schema_1.deduceTableSchema)(table);
|
|
12
|
+
const fields = table.schema?.fields || [];
|
|
13
|
+
if (table.shape === 'columnar-table') {
|
|
14
|
+
return { ...table, schema };
|
|
15
|
+
}
|
|
16
|
+
const length = (0, table_accessors_1.getTableLength)(table);
|
|
17
|
+
const columns = {};
|
|
18
|
+
for (const field of fields) {
|
|
19
|
+
const column = (0, table_column_1.makeColumnFromField)(field, length);
|
|
20
|
+
columns[field.name] = column;
|
|
21
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
22
|
+
column[rowIndex] = (0, table_accessors_1.getTableCell)(table, rowIndex, field.name);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
shape: 'columnar-table',
|
|
27
|
+
schema,
|
|
28
|
+
data: columns
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.makeColumnarTable = makeColumnarTable;
|
|
32
|
+
/** Convert any table into array row format */
|
|
33
|
+
function makeArrayRowTable(table) {
|
|
34
|
+
if (table.shape === 'array-row-table') {
|
|
35
|
+
return table;
|
|
36
|
+
}
|
|
37
|
+
const length = (0, table_accessors_1.getTableLength)(table);
|
|
38
|
+
const data = new Array(length);
|
|
39
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
40
|
+
data[rowIndex] = (0, table_accessors_1.getTableRowAsArray)(table, rowIndex);
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
shape: 'array-row-table',
|
|
44
|
+
schema: table.schema,
|
|
45
|
+
data
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
exports.makeArrayRowTable = makeArrayRowTable;
|
|
49
|
+
/** Convert any table into object row format */
|
|
50
|
+
function makeObjectRowTable(table) {
|
|
51
|
+
if (table.shape === 'object-row-table') {
|
|
52
|
+
return table;
|
|
53
|
+
}
|
|
54
|
+
const length = (0, table_accessors_1.getTableLength)(table);
|
|
55
|
+
const data = new Array(length);
|
|
56
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
57
|
+
data[rowIndex] = (0, table_accessors_1.getTableRowAsObject)(table, rowIndex);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
shape: 'object-row-table',
|
|
61
|
+
schema: table.schema,
|
|
62
|
+
data
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
exports.makeObjectRowTable = makeObjectRowTable;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DataType } from '../../../types/schema';
|
|
2
|
+
import { TypedArray, TypedArrayConstructor, ArrayType } from '../../../types/types';
|
|
3
|
+
/** Deduce column types from values */
|
|
4
|
+
export declare function getDataTypeFromValue(value: unknown, defaultNumberType?: 'float32'): DataType;
|
|
5
|
+
/**
|
|
6
|
+
* Deduces a simple data type "descriptor from a typed array instance
|
|
7
|
+
*/
|
|
8
|
+
export declare function getDataTypeFromArray(array: ArrayType): {
|
|
9
|
+
type: DataType;
|
|
10
|
+
nullable: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Deduces a simple data type "descriptor from a typed array instance
|
|
14
|
+
*/
|
|
15
|
+
export declare function getDataTypeFromTypedArray(array: TypedArray): DataType;
|
|
16
|
+
export declare function getArrayTypeFromDataType(type: DataType, nullable: boolean | undefined): TypedArrayConstructor | ArrayConstructor;
|
|
17
|
+
//# sourceMappingURL=data-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-type.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/simple-table/data-type.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAC,UAAU,EAAE,qBAAqB,EAAE,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAElF,sCAAsC;AACtC,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,EACd,iBAAiB,GAAE,SAAqB,GACvC,QAAQ,CAcV;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,GAAG;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAC,CAW1F;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAsBrE;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,OAAO,GAAG,SAAS,GAC5B,qBAAqB,GAAG,gBAAgB,CA8B1C"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// loaders.gl, MIT license
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getArrayTypeFromDataType = exports.getDataTypeFromTypedArray = exports.getDataTypeFromArray = exports.getDataTypeFromValue = void 0;
|
|
5
|
+
/** Deduce column types from values */
|
|
6
|
+
function getDataTypeFromValue(value, defaultNumberType = 'float32') {
|
|
7
|
+
if (value instanceof Date) {
|
|
8
|
+
return 'date-millisecond';
|
|
9
|
+
}
|
|
10
|
+
if (value instanceof Number) {
|
|
11
|
+
return defaultNumberType;
|
|
12
|
+
}
|
|
13
|
+
if (typeof value === 'string') {
|
|
14
|
+
return 'utf8';
|
|
15
|
+
}
|
|
16
|
+
if (value === null || value === 'undefined') {
|
|
17
|
+
return 'null';
|
|
18
|
+
}
|
|
19
|
+
return 'null';
|
|
20
|
+
}
|
|
21
|
+
exports.getDataTypeFromValue = getDataTypeFromValue;
|
|
22
|
+
/**
|
|
23
|
+
* Deduces a simple data type "descriptor from a typed array instance
|
|
24
|
+
*/
|
|
25
|
+
function getDataTypeFromArray(array) {
|
|
26
|
+
let type = getDataTypeFromTypedArray(array);
|
|
27
|
+
if (type !== 'null') {
|
|
28
|
+
return { type, nullable: false };
|
|
29
|
+
}
|
|
30
|
+
if (array.length > 0) {
|
|
31
|
+
type = getDataTypeFromValue(array[0]);
|
|
32
|
+
return { type, nullable: true };
|
|
33
|
+
}
|
|
34
|
+
return { type: 'null', nullable: true };
|
|
35
|
+
}
|
|
36
|
+
exports.getDataTypeFromArray = getDataTypeFromArray;
|
|
37
|
+
/**
|
|
38
|
+
* Deduces a simple data type "descriptor from a typed array instance
|
|
39
|
+
*/
|
|
40
|
+
function getDataTypeFromTypedArray(array) {
|
|
41
|
+
switch (array.constructor) {
|
|
42
|
+
case Int8Array:
|
|
43
|
+
return 'int8';
|
|
44
|
+
case Uint8Array:
|
|
45
|
+
case Uint8ClampedArray:
|
|
46
|
+
return 'uint8';
|
|
47
|
+
case Int16Array:
|
|
48
|
+
return 'int16';
|
|
49
|
+
case Uint16Array:
|
|
50
|
+
return 'uint16';
|
|
51
|
+
case Int32Array:
|
|
52
|
+
return 'int32';
|
|
53
|
+
case Uint32Array:
|
|
54
|
+
return 'uint32';
|
|
55
|
+
case Float32Array:
|
|
56
|
+
return 'float32';
|
|
57
|
+
case Float64Array:
|
|
58
|
+
return 'float64';
|
|
59
|
+
default:
|
|
60
|
+
return 'null';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.getDataTypeFromTypedArray = getDataTypeFromTypedArray;
|
|
64
|
+
function getArrayTypeFromDataType(type, nullable) {
|
|
65
|
+
if (!nullable) {
|
|
66
|
+
switch (type) {
|
|
67
|
+
case 'int8':
|
|
68
|
+
return Int8Array;
|
|
69
|
+
case 'uint8':
|
|
70
|
+
return Uint8Array;
|
|
71
|
+
case 'int16':
|
|
72
|
+
return Int16Array;
|
|
73
|
+
case 'uint16':
|
|
74
|
+
return Uint16Array;
|
|
75
|
+
case 'int32':
|
|
76
|
+
return Int32Array;
|
|
77
|
+
case 'uint32':
|
|
78
|
+
return Uint32Array;
|
|
79
|
+
case 'float32':
|
|
80
|
+
return Float32Array;
|
|
81
|
+
case 'float64':
|
|
82
|
+
return Float64Array;
|
|
83
|
+
default:
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// if (typeof BigInt64Array !== 'undefined') {
|
|
88
|
+
// TYPED_ARRAY_TO_TYPE.BigInt64Array = new Int64();
|
|
89
|
+
// TYPED_ARRAY_TO_TYPE.BigUint64Array = new Uint64();
|
|
90
|
+
// }
|
|
91
|
+
return Array;
|
|
92
|
+
}
|
|
93
|
+
exports.getArrayTypeFromDataType = getArrayTypeFromDataType;
|