@loaders.gl/core 5.0.0-beta.1 → 5.0.0-beta.11
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/GEOARROW-README.md +1 -1
- package/README.md +4 -2
- package/SCAN-README.md +3 -3
- package/SCHEMA-UTILS-README.md +1 -1
- package/dist/arrow-geometry/binary-geometry-to-wkb.cjs +2 -2
- package/dist/arrow-geometry/binary-geometry-to-wkb.cjs.map +2 -2
- package/dist/arrow-geometry/binary-geometry-to-wkb.js +1 -1
- package/dist/arrow-geometry/binary-geometry-to-wkb.js.map +1 -1
- package/dist/arrow-geometry/feature-collection-to-arrow.cjs.map +2 -2
- package/dist/arrow-geometry/feature-collection-to-arrow.d.ts +4 -3
- package/dist/arrow-geometry/feature-collection-to-arrow.d.ts.map +1 -1
- package/dist/arrow-geometry/feature-collection-to-arrow.js +1 -1
- package/dist/arrow-geometry/feature-collection-to-arrow.js.map +1 -1
- package/dist/arrow-geometry/feature-table.cjs +2 -6
- package/dist/arrow-geometry/feature-table.cjs.map +2 -2
- package/dist/arrow-geometry/feature-table.d.ts +6 -5
- package/dist/arrow-geometry/feature-table.d.ts.map +1 -1
- package/dist/arrow-geometry/feature-table.js +5 -9
- package/dist/arrow-geometry/feature-table.js.map +1 -1
- package/dist/arrow-geometry/geojson-table.cjs +295 -18
- package/dist/arrow-geometry/geojson-table.cjs.map +3 -3
- package/dist/arrow-geometry/geojson-table.d.ts +10 -3
- package/dist/arrow-geometry/geojson-table.d.ts.map +1 -1
- package/dist/arrow-geometry/geojson-table.js +23 -13
- package/dist/arrow-geometry/geojson-table.js.map +1 -1
- package/dist/arrow-geometry/geometry-codecs.cjs +6 -6
- package/dist/arrow-geometry/geometry-codecs.cjs.map +2 -2
- package/dist/arrow-geometry/geometry-codecs.js +1 -1
- package/dist/arrow-geometry/geometry-codecs.js.map +1 -1
- package/dist/arrow-geometry/geometry-to-wkt.cjs +2 -2
- package/dist/arrow-geometry/geometry-to-wkt.cjs.map +2 -2
- package/dist/arrow-geometry/geometry-to-wkt.js +1 -1
- package/dist/arrow-geometry/geometry-to-wkt.js.map +1 -1
- package/dist/arrow-geometry/index.cjs +0 -11
- package/dist/arrow-geometry/index.cjs.map +2 -2
- package/dist/arrow-geometry/index.d.ts +0 -1
- package/dist/arrow-geometry/index.d.ts.map +1 -1
- package/dist/arrow-geometry/index.js +0 -1
- package/dist/arrow-geometry/index.js.map +1 -1
- package/dist/arrow-geometry/wkb-arrow-utils.cjs +1 -5
- package/dist/arrow-geometry/wkb-arrow-utils.cjs.map +2 -2
- package/dist/arrow-geometry/wkb-arrow-utils.d.ts +7 -7
- package/dist/arrow-geometry/wkb-arrow-utils.d.ts.map +1 -1
- package/dist/arrow-geometry/wkb-arrow-utils.js +4 -8
- package/dist/arrow-geometry/wkb-arrow-utils.js.map +1 -1
- package/dist/arrow-geometry/wkb-builder.cjs +3 -3
- package/dist/arrow-geometry/wkb-builder.cjs.map +2 -2
- package/dist/arrow-geometry/wkb-builder.d.ts +1 -1
- package/dist/arrow-geometry/wkb-builder.d.ts.map +1 -1
- package/dist/arrow-geometry/wkb-builder.js +1 -1
- package/dist/arrow-geometry/wkb-builder.js.map +1 -1
- package/dist/arrow-geometry/wkb-statistics.cjs +2 -2
- package/dist/arrow-geometry/wkb-statistics.cjs.map +2 -2
- package/dist/arrow-geometry/wkb-statistics.js +1 -1
- package/dist/arrow-geometry/wkb-statistics.js.map +1 -1
- package/dist/arrow-worker-transport.cjs +105 -0
- package/dist/arrow-worker-transport.cjs.map +6 -0
- package/dist/arrow-worker-transport.d.ts +11 -0
- package/dist/arrow-worker-transport.d.ts.map +1 -0
- package/dist/arrow-worker-transport.js +77 -0
- package/dist/arrow-worker-transport.js.map +1 -0
- package/dist/cluster-source.cjs +6874 -0
- package/dist/cluster-source.cjs.map +6 -0
- package/dist/cluster-source.d.ts +2 -0
- package/dist/cluster-source.d.ts.map +1 -0
- package/dist/cluster-source.js +2 -0
- package/dist/cluster-source.js.map +1 -0
- package/dist/dist.dev.js +3040 -817
- package/dist/dist.min.js +3 -3
- package/dist/federated-table-scan-source.cjs +2409 -0
- package/dist/federated-table-scan-source.cjs.map +6 -0
- package/dist/federated-table-scan-source.d.ts +2 -0
- package/dist/federated-table-scan-source.d.ts.map +1 -0
- package/dist/federated-table-scan-source.js +2 -0
- package/dist/federated-table-scan-source.js.map +1 -0
- package/dist/geoarrow/binary-polygon-to-geoarrow.cjs +2 -2
- package/dist/geoarrow/binary-polygon-to-geoarrow.cjs.map +2 -2
- package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts +1 -1
- package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts.map +1 -1
- package/dist/geoarrow/binary-polygon-to-geoarrow.js +1 -1
- package/dist/geoarrow/binary-polygon-to-geoarrow.js.map +1 -1
- package/dist/geoarrow/clustering/cluster-source.cjs +16 -19
- package/dist/geoarrow/clustering/cluster-source.cjs.map +2 -2
- package/dist/geoarrow/clustering/cluster-source.d.ts +3 -2
- package/dist/geoarrow/clustering/cluster-source.d.ts.map +1 -1
- package/dist/geoarrow/clustering/cluster-source.js +13 -18
- package/dist/geoarrow/clustering/cluster-source.js.map +1 -1
- package/dist/geoarrow/convert-table-to-geoarrow.cjs +5 -12
- package/dist/geoarrow/convert-table-to-geoarrow.cjs.map +2 -2
- package/dist/geoarrow/convert-table-to-geoarrow.d.ts +6 -6
- package/dist/geoarrow/convert-table-to-geoarrow.d.ts.map +1 -1
- package/dist/geoarrow/convert-table-to-geoarrow.js +8 -14
- package/dist/geoarrow/convert-table-to-geoarrow.js.map +1 -1
- package/dist/geoarrow/geoarrow-bounds.cjs +7 -7
- package/dist/geoarrow/geoarrow-bounds.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-bounds.js +3 -3
- package/dist/geoarrow/geoarrow-bounds.js.map +1 -1
- package/dist/geoarrow/geoarrow-capabilities.cjs +2 -2
- package/dist/geoarrow/geoarrow-capabilities.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-capabilities.js +1 -1
- package/dist/geoarrow/geoarrow-capabilities.js.map +1 -1
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs +8 -8
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js +2 -2
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js.map +1 -1
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.cjs +6 -4
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.d.ts +3 -3
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.d.ts.map +1 -1
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.js +9 -4
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.js.map +1 -1
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.cjs +5 -4
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts +3 -3
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts.map +1 -1
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.js +5 -4
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.js.map +1 -1
- package/dist/geoarrow/geoarrow-inspection.cjs +2 -2
- package/dist/geoarrow/geoarrow-inspection.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-inspection.js +1 -1
- package/dist/geoarrow/geoarrow-inspection.js.map +1 -1
- package/dist/geoarrow/geoarrow-stream.cjs +11 -12
- package/dist/geoarrow/geoarrow-stream.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-stream.d.ts +2 -2
- package/dist/geoarrow/geoarrow-stream.d.ts.map +1 -1
- package/dist/geoarrow/geoarrow-stream.js +10 -13
- package/dist/geoarrow/geoarrow-stream.js.map +1 -1
- package/dist/geoarrow/get-geoarrow-vertex-count.cjs +2 -2
- package/dist/geoarrow/get-geoarrow-vertex-count.cjs.map +2 -2
- package/dist/geoarrow/get-geoarrow-vertex-count.js +1 -1
- package/dist/geoarrow/get-geoarrow-vertex-count.js.map +1 -1
- package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.cjs.map +1 -1
- package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.js +3 -3
- package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.js.map +1 -1
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.cjs +4 -8
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.cjs.map +2 -2
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.d.ts.map +1 -1
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.js +4 -8
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.js.map +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs +4 -4
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs.map +2 -2
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js.map +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs +3 -3
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs.map +2 -2
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js.map +1 -1
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs +3 -3
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs.map +2 -2
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js +1 -1
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js.map +1 -1
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.cjs +0 -6
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.cjs.map +2 -2
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.d.ts +5 -3
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.d.ts.map +1 -1
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.js +0 -6
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.js.map +1 -1
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.cjs +3 -2
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.cjs.map +2 -2
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.d.ts.map +1 -1
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.js +3 -2
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.js.map +1 -1
- package/dist/geoarrow/metadata/geoarrow-metadata.cjs +44 -2
- package/dist/geoarrow/metadata/geoarrow-metadata.cjs.map +4 -4
- package/dist/geoarrow/metadata/geoarrow-metadata.d.ts.map +1 -1
- package/dist/geoarrow/metadata/geoarrow-metadata.js +3 -4
- package/dist/geoarrow/metadata/geoarrow-metadata.js.map +1 -1
- package/dist/index.cjs +746 -1365
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -5
- package/dist/index.js.map +1 -1
- package/dist/lib/api/create-data-source.d.ts +20 -9
- package/dist/lib/api/create-data-source.d.ts.map +1 -1
- package/dist/lib/api/create-data-source.js +55 -45
- package/dist/lib/api/create-data-source.js.map +1 -1
- package/dist/lib/api/encode.d.ts +1 -1
- package/dist/lib/api/encode.d.ts.map +1 -1
- package/dist/lib/api/encode.js +11 -2
- package/dist/lib/api/encode.js.map +1 -1
- package/dist/lib/api/load-in-batches.d.ts +3 -2
- package/dist/lib/api/load-in-batches.d.ts.map +1 -1
- package/dist/lib/api/load-in-batches.js.map +1 -1
- package/dist/lib/api/load-loader.d.ts +3 -3
- package/dist/lib/api/load-loader.d.ts.map +1 -1
- package/dist/lib/api/load-loader.js +15 -19
- package/dist/lib/api/load-loader.js.map +1 -1
- package/dist/lib/api/load.d.ts +7 -3
- package/dist/lib/api/load.d.ts.map +1 -1
- package/dist/lib/api/load.js +15 -67
- package/dist/lib/api/load.js.map +1 -1
- package/dist/lib/api/loader-options.d.ts +6 -0
- package/dist/lib/api/loader-options.d.ts.map +1 -1
- package/dist/lib/api/loader-options.js +48 -0
- package/dist/lib/api/loader-options.js.map +1 -1
- package/dist/lib/api/parse-file.d.ts +5 -3
- package/dist/lib/api/parse-file.d.ts.map +1 -1
- package/dist/lib/api/parse-file.js +8 -6
- package/dist/lib/api/parse-file.js.map +1 -1
- package/dist/lib/api/parse-in-batches.d.ts +5 -3
- package/dist/lib/api/parse-in-batches.d.ts.map +1 -1
- package/dist/lib/api/parse-in-batches.js +60 -9
- package/dist/lib/api/parse-in-batches.js.map +1 -1
- package/dist/lib/api/parse-sync.d.ts +5 -3
- package/dist/lib/api/parse-sync.d.ts.map +1 -1
- package/dist/lib/api/parse-sync.js +3 -4
- package/dist/lib/api/parse-sync.js.map +1 -1
- package/dist/lib/api/parse.d.ts +5 -3
- package/dist/lib/api/parse.d.ts.map +1 -1
- package/dist/lib/api/parse.js +22 -14
- package/dist/lib/api/parse.js.map +1 -1
- package/dist/lib/api/select-loader.d.ts +4 -2
- package/dist/lib/api/select-loader.d.ts.map +1 -1
- package/dist/lib/api/select-loader.js +47 -53
- package/dist/lib/api/select-loader.js.map +1 -1
- package/dist/lib/api/select-source.d.ts.map +1 -1
- package/dist/lib/api/select-source.js +1 -1
- package/dist/lib/api/select-source.js.map +1 -1
- package/dist/lib/init.js +1 -1
- package/dist/lib/init.js.map +1 -1
- package/dist/lib/loader-utils/get-fetch-function.js +2 -2
- package/dist/lib/loader-utils/get-fetch-function.js.map +1 -1
- package/dist/lib/loader-utils/loggers.d.ts +2 -37
- package/dist/lib/loader-utils/loggers.d.ts.map +1 -1
- package/dist/lib/loader-utils/loggers.js +2 -63
- package/dist/lib/loader-utils/loggers.js.map +1 -1
- package/dist/lib/loader-utils/native-arrow.d.ts +13 -0
- package/dist/lib/loader-utils/native-arrow.d.ts.map +1 -0
- package/dist/lib/loader-utils/native-arrow.js +66 -0
- package/dist/lib/loader-utils/native-arrow.js.map +1 -0
- package/dist/lib/loader-utils/option-defaults.d.ts +3 -2
- package/dist/lib/loader-utils/option-defaults.d.ts.map +1 -1
- package/dist/lib/loader-utils/option-defaults.js +9 -10
- package/dist/lib/loader-utils/option-defaults.js.map +1 -1
- package/dist/lib/loader-utils/option-utils.d.ts +0 -6
- package/dist/lib/loader-utils/option-utils.d.ts.map +1 -1
- package/dist/lib/loader-utils/option-utils.js +31 -114
- package/dist/lib/loader-utils/option-utils.js.map +1 -1
- package/dist/loader-utils/format-types.d.ts +3 -0
- package/dist/loader-utils/format-types.d.ts.map +1 -1
- package/dist/loader-utils/index.cjs +854 -1295
- package/dist/loader-utils/index.cjs.map +3 -3
- package/dist/loader-utils/index.d.ts +17 -8
- package/dist/loader-utils/index.d.ts.map +1 -1
- package/dist/loader-utils/index.js +9 -5
- package/dist/loader-utils/index.js.map +1 -1
- package/dist/loader-utils/json-loader.js +1 -1
- package/dist/loader-utils/json-loader.js.map +1 -1
- package/dist/loader-utils/lib/files/http-file-transport.d.ts +4 -0
- package/dist/loader-utils/lib/files/http-file-transport.d.ts.map +1 -1
- package/dist/loader-utils/lib/files/http-file-transport.js +45 -1
- package/dist/loader-utils/lib/files/http-file-transport.js.map +1 -1
- package/dist/loader-utils/lib/files/http-file-types.d.ts +2 -0
- package/dist/loader-utils/lib/files/http-file-types.d.ts.map +1 -1
- package/dist/loader-utils/lib/files/read-range-response.d.ts +3 -0
- package/dist/loader-utils/lib/files/read-range-response.d.ts.map +1 -0
- package/dist/loader-utils/lib/files/read-range-response.js +62 -0
- package/dist/loader-utils/lib/files/read-range-response.js.map +1 -0
- package/dist/loader-utils/lib/log-utils/log.d.ts +23 -1
- package/dist/loader-utils/lib/log-utils/log.d.ts.map +1 -1
- package/dist/loader-utils/lib/log-utils/log.js +32 -1
- package/dist/loader-utils/lib/log-utils/log.js.map +1 -1
- package/dist/loader-utils/lib/pace-batch-iterator.d.ts +14 -0
- package/dist/loader-utils/lib/pace-batch-iterator.d.ts.map +1 -0
- package/dist/loader-utils/lib/pace-batch-iterator.js +51 -0
- package/dist/loader-utils/lib/pace-batch-iterator.js.map +1 -0
- package/dist/loader-utils/lib/request-utils/request-credentials.js +1 -1
- package/dist/loader-utils/lib/request-utils/request-credentials.js.map +1 -1
- package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts +43 -0
- package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts.map +1 -0
- package/dist/loader-utils/lib/scan-utils/logical-table-query.js +104 -0
- package/dist/loader-utils/lib/scan-utils/logical-table-query.js.map +1 -0
- package/dist/loader-utils/lib/scan-utils/{experimental-scan-options.d.ts → query-options.d.ts} +5 -8
- package/dist/loader-utils/lib/scan-utils/query-options.d.ts.map +1 -0
- package/dist/{schema-utils/lib/table/batch-builder/table-batch-aggregator.js → loader-utils/lib/scan-utils/query-options.js} +1 -1
- package/dist/loader-utils/lib/scan-utils/query-options.js.map +1 -0
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts +58 -18
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts.map +1 -1
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js +17 -6
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-query.d.ts +54 -3
- package/dist/loader-utils/lib/scan-utils/table-query.d.ts.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-query.js +6 -0
- package/dist/loader-utils/lib/scan-utils/table-query.js.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts +18 -12
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.js +58 -29
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.js.map +1 -1
- package/dist/loader-utils/lib/sources/data-source.d.ts +4 -0
- package/dist/loader-utils/lib/sources/data-source.d.ts.map +1 -1
- package/dist/loader-utils/lib/sources/data-source.js +53 -14
- package/dist/loader-utils/lib/sources/data-source.js.map +1 -1
- package/dist/loader-utils/lib/sources/image-source.d.ts +1 -1
- package/dist/loader-utils/lib/sources/table-source-collection.d.ts +31 -0
- package/dist/loader-utils/lib/sources/table-source-collection.d.ts.map +1 -0
- package/dist/loader-utils/lib/{scan-utils/experimental-scan-options.js → sources/table-source-collection.js} +1 -1
- package/dist/loader-utils/lib/sources/table-source-collection.js.map +1 -0
- package/dist/loader-utils/lib/sources/utils/utils.js +1 -1
- package/dist/loader-utils/lib/sources/utils/utils.js.map +1 -1
- package/dist/loader-utils/lib/sources/vector-source.d.ts +4 -3
- package/dist/loader-utils/lib/sources/vector-source.d.ts.map +1 -1
- package/dist/loader-utils/lib/sources/vector-tile-source.d.ts +4 -3
- package/dist/loader-utils/lib/sources/vector-tile-source.d.ts.map +1 -1
- package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.d.ts.map +1 -1
- package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js +2 -5
- package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js.map +1 -1
- package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.d.ts.map +1 -1
- package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.js +40 -21
- package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.js.map +1 -1
- package/dist/loader-utils/loader-types.d.ts +118 -91
- package/dist/loader-utils/loader-types.d.ts.map +1 -1
- package/dist/loader-utils/loader-types.js.map +1 -1
- package/dist/loader-utils/source-types.d.ts +7 -5
- package/dist/loader-utils/source-types.d.ts.map +1 -1
- package/dist/loader-utils/source-types.js +9 -1
- package/dist/loader-utils/source-types.js.map +1 -1
- package/dist/null-loader.d.ts +0 -18
- package/dist/null-loader.d.ts.map +1 -1
- package/dist/null-loader.js +1 -19
- package/dist/null-loader.js.map +1 -1
- package/dist/null-worker-node.js +771 -82
- package/dist/null-worker.js +742 -81
- package/dist/polyfills/images/encode-image-node.d.ts +18 -15
- package/dist/polyfills/images/encode-image-node.d.ts.map +1 -1
- package/dist/polyfills/images/encode-image-node.js +19 -33
- package/dist/polyfills/images/encode-image-node.js.map +1 -1
- package/dist/polyfills/images/image-codecs-node.d.ts +2 -6
- package/dist/polyfills/images/image-codecs-node.d.ts.map +1 -1
- package/dist/polyfills/images/image-codecs-node.js +2 -24
- package/dist/polyfills/images/image-codecs-node.js.map +1 -1
- package/dist/polyfills/images/load-sharp.d.ts +3 -0
- package/dist/polyfills/images/load-sharp.d.ts.map +1 -0
- package/dist/polyfills/images/load-sharp.js +11 -0
- package/dist/polyfills/images/load-sharp.js.map +1 -0
- package/dist/polyfills/images/node-image-bitmap.d.ts +1 -1
- package/dist/polyfills/images/node-image-bitmap.js +1 -1
- package/dist/polyfills/images/node-image-formats.d.ts +1 -1
- package/dist/polyfills/images/node-image-formats.d.ts.map +1 -1
- package/dist/polyfills/images/node-image-formats.js +10 -4
- package/dist/polyfills/images/node-image-formats.js.map +1 -1
- package/dist/polyfills/images/parse-image-node.d.ts +10 -2
- package/dist/polyfills/images/parse-image-node.d.ts.map +1 -1
- package/dist/polyfills/images/parse-image-node.js +20 -32
- package/dist/polyfills/images/parse-image-node.js.map +1 -1
- package/dist/polyfills/index.cjs +76 -151
- package/dist/polyfills/index.d.ts.map +1 -1
- package/dist/polyfills/index.js +2 -2
- package/dist/polyfills/index.js.map +1 -1
- package/dist/scan/arrow-execution/expressions.cjs +134 -0
- package/dist/scan/arrow-execution/expressions.cjs.map +7 -0
- package/dist/scan/arrow-execution/expressions.d.ts +11 -0
- package/dist/scan/arrow-execution/expressions.d.ts.map +1 -0
- package/dist/scan/arrow-execution/expressions.js +86 -0
- package/dist/scan/arrow-execution/expressions.js.map +1 -0
- package/dist/scan/arrow-execution/filter-arrow-table.cjs +255 -0
- package/dist/scan/arrow-execution/filter-arrow-table.cjs.map +7 -0
- package/dist/scan/arrow-execution/filter-arrow-table.d.ts +18 -0
- package/dist/scan/arrow-execution/filter-arrow-table.d.ts.map +1 -0
- package/dist/scan/arrow-execution/filter-arrow-table.js +224 -0
- package/dist/scan/arrow-execution/filter-arrow-table.js.map +1 -0
- package/dist/scan/arrow-execution/project-arrow-table.cjs +70 -0
- package/dist/scan/arrow-execution/project-arrow-table.cjs.map +7 -0
- package/dist/scan/arrow-execution/project-arrow-table.d.ts +8 -0
- package/dist/scan/arrow-execution/project-arrow-table.d.ts.map +1 -0
- package/dist/scan/arrow-execution/project-arrow-table.js +39 -0
- package/dist/scan/arrow-execution/project-arrow-table.js.map +1 -0
- package/dist/scan/arrow-execution.cjs +34 -0
- package/dist/scan/arrow-execution.cjs.map +7 -0
- package/dist/scan/arrow-execution.d.ts +4 -0
- package/dist/scan/arrow-execution.d.ts.map +1 -0
- package/dist/scan/arrow-execution.js +6 -0
- package/dist/scan/arrow-execution.js.map +1 -0
- package/dist/scan/arrow-query-worker-entry.cjs +121 -0
- package/dist/scan/arrow-query-worker-entry.cjs.map +7 -0
- package/dist/scan/arrow-query-worker-entry.d.ts +2 -0
- package/dist/scan/arrow-query-worker-entry.d.ts.map +1 -0
- package/dist/scan/arrow-query-worker-entry.js +7 -0
- package/dist/scan/arrow-query-worker-entry.js.map +1 -0
- package/dist/scan/arrow-query-worker.cjs +197 -0
- package/dist/scan/arrow-query-worker.cjs.map +7 -0
- package/dist/scan/arrow-query-worker.d.ts +47 -0
- package/dist/scan/arrow-query-worker.d.ts.map +1 -0
- package/dist/scan/arrow-query-worker.js +101 -0
- package/dist/scan/arrow-query-worker.js.map +1 -0
- package/dist/scan/arrow-query.cjs.map +1 -1
- package/dist/scan/arrow-query.d.ts +1 -1
- package/dist/scan/arrow-query.d.ts.map +1 -1
- package/dist/scan/catalog-query-source.cjs +122 -0
- package/dist/scan/catalog-query-source.cjs.map +7 -0
- package/dist/scan/catalog-query-source.d.ts +6 -0
- package/dist/scan/catalog-query-source.d.ts.map +1 -0
- package/dist/scan/catalog-query-source.js +115 -0
- package/dist/scan/catalog-query-source.js.map +1 -0
- package/dist/scan/federated-table-scan-source.cjs +42 -43
- package/dist/scan/federated-table-scan-source.cjs.map +2 -2
- package/dist/scan/federated-table-scan-source.d.ts +6 -10
- package/dist/scan/federated-table-scan-source.d.ts.map +1 -1
- package/dist/scan/federated-table-scan-source.js +39 -40
- package/dist/scan/federated-table-scan-source.js.map +1 -1
- package/dist/scan/index.cjs +213 -6
- package/dist/scan/index.cjs.map +4 -4
- package/dist/scan/index.d.ts +15 -4
- package/dist/scan/index.d.ts.map +1 -1
- package/dist/scan/index.js +8 -2
- package/dist/scan/index.js.map +1 -1
- package/dist/scan/parse-sql-predicate.cjs +3 -294
- package/dist/scan/parse-sql-predicate.cjs.map +3 -3
- package/dist/scan/parse-sql-predicate.d.ts +6 -9
- package/dist/scan/parse-sql-predicate.d.ts.map +1 -1
- package/dist/scan/parse-sql-predicate.js +5 -314
- package/dist/scan/parse-sql-predicate.js.map +1 -1
- package/dist/scan/query-arrow-table-in-batches.cjs +75 -0
- package/dist/scan/query-arrow-table-in-batches.cjs.map +7 -0
- package/dist/scan/query-arrow-table-in-batches.d.ts +8 -0
- package/dist/scan/query-arrow-table-in-batches.d.ts.map +1 -0
- package/dist/scan/query-arrow-table-in-batches.js +54 -0
- package/dist/scan/query-arrow-table-in-batches.js.map +1 -0
- package/dist/scan/query-arrow-table.cjs +65 -202
- package/dist/scan/query-arrow-table.cjs.map +3 -3
- package/dist/scan/query-arrow-table.d.ts +7 -40
- package/dist/scan/query-arrow-table.d.ts.map +1 -1
- package/dist/scan/query-arrow-table.js +51 -211
- package/dist/scan/query-arrow-table.js.map +1 -1
- package/dist/scan/query-open-source.cjs +52 -0
- package/dist/scan/query-open-source.cjs.map +7 -0
- package/dist/scan/query-open-source.d.ts +4 -0
- package/dist/scan/query-open-source.d.ts.map +1 -0
- package/dist/scan/query-open-source.js +26 -0
- package/dist/scan/query-open-source.js.map +1 -0
- package/dist/scan/query-progressive.cjs +190 -0
- package/dist/scan/query-progressive.cjs.map +7 -0
- package/dist/scan/query-progressive.d.ts +39 -0
- package/dist/scan/query-progressive.d.ts.map +1 -0
- package/dist/scan/query-progressive.js +173 -0
- package/dist/scan/query-progressive.js.map +1 -0
- package/dist/scan/query-pushdown.cjs +140 -0
- package/dist/scan/query-pushdown.cjs.map +7 -0
- package/dist/scan/query-pushdown.d.ts +14 -0
- package/dist/scan/query-pushdown.d.ts.map +1 -0
- package/dist/scan/query-pushdown.js +133 -0
- package/dist/scan/query-pushdown.js.map +1 -0
- package/dist/scan/query-scales.cjs +140 -0
- package/dist/scan/query-scales.cjs.map +7 -0
- package/dist/scan/query-scales.d.ts +35 -0
- package/dist/scan/query-scales.d.ts.map +1 -0
- package/dist/scan/query-scales.js +120 -0
- package/dist/scan/query-scales.js.map +1 -0
- package/dist/scan/query.cjs +385 -0
- package/dist/scan/query.cjs.map +7 -0
- package/dist/scan/query.d.ts +67 -0
- package/dist/scan/query.d.ts.map +1 -0
- package/dist/scan/query.js +402 -0
- package/dist/scan/query.js.map +1 -0
- package/dist/scan/resolve-query-source.cjs +59 -0
- package/dist/scan/resolve-query-source.cjs.map +7 -0
- package/dist/scan/resolve-query-source.d.ts +6 -0
- package/dist/scan/resolve-query-source.d.ts.map +1 -0
- package/dist/scan/resolve-query-source.js +37 -0
- package/dist/scan/resolve-query-source.js.map +1 -0
- package/dist/scan/rows-to-arrow.cjs +1 -28
- package/dist/scan/rows-to-arrow.cjs.map +2 -2
- package/dist/scan/rows-to-arrow.d.ts +3 -3
- package/dist/scan/rows-to-arrow.d.ts.map +1 -1
- package/dist/scan/rows-to-arrow.js +2 -32
- package/dist/scan/rows-to-arrow.js.map +1 -1
- package/dist/scan/scan-engine.cjs.map +2 -2
- package/dist/scan/scan-engine.d.ts +5 -5
- package/dist/scan/scan-engine.d.ts.map +1 -1
- package/dist/scan/scan-engine.js.map +1 -1
- package/dist/scan/sql-catalog.cjs +110 -0
- package/dist/scan/sql-catalog.cjs.map +7 -0
- package/dist/scan/sql-catalog.d.ts +47 -0
- package/dist/scan/sql-catalog.d.ts.map +1 -0
- package/dist/scan/sql-catalog.js +97 -0
- package/dist/scan/sql-catalog.js.map +1 -0
- package/dist/scan/table-query.cjs.map +2 -2
- package/dist/scan/table-query.d.ts +4 -1
- package/dist/scan/table-query.d.ts.map +1 -1
- package/dist/scan/table-query.js.map +1 -1
- package/dist/scan/vector-table-scan-source.cjs +24 -17
- package/dist/scan/vector-table-scan-source.cjs.map +4 -4
- package/dist/scan/vector-table-scan-source.d.ts +8 -8
- package/dist/scan/vector-table-scan-source.d.ts.map +1 -1
- package/dist/scan/vector-table-scan-source.js +19 -17
- package/dist/scan/vector-table-scan-source.js.map +1 -1
- package/dist/schema/categories/category-mesh.d.ts +3 -10
- package/dist/schema/categories/category-mesh.d.ts.map +1 -1
- package/dist/schema/categories/category-mesh.js.map +1 -1
- package/dist/schema/categories/category-table.d.ts +2 -19
- package/dist/schema/categories/category-table.d.ts.map +1 -1
- package/dist/schema/geometry/arrow-binary-features.d.ts +1 -1
- package/dist/schema/geometry/arrow-binary-features.d.ts.map +1 -1
- package/dist/schema/geometry/geoarrow.d.ts +3 -6
- package/dist/schema/geometry/geoarrow.d.ts.map +1 -1
- package/dist/schema/index.cjs +11 -7
- package/dist/schema/index.cjs.map +2 -2
- package/dist/schema/index.d.ts +4 -4
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +2 -2
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/types/batch.d.ts +0 -4
- package/dist/schema/types/batch.d.ts.map +1 -1
- package/dist/schema-utils/index.cjs +404 -620
- package/dist/schema-utils/index.cjs.map +3 -3
- package/dist/schema-utils/index.d.ts +6 -6
- package/dist/schema-utils/index.d.ts.map +1 -1
- package/dist/schema-utils/index.js +6 -5
- package/dist/schema-utils/index.js.map +1 -1
- package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts +16 -0
- package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts.map +1 -0
- package/dist/schema-utils/lib/arrow/arrow-metadata.js +109 -0
- package/dist/schema-utils/lib/arrow/arrow-metadata.js.map +1 -0
- package/dist/schema-utils/lib/converters/convert.js +9 -2
- package/dist/schema-utils/lib/converters/convert.js.map +1 -1
- package/dist/schema-utils/lib/converters/types.d.ts +2 -0
- package/dist/schema-utils/lib/converters/types.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts +8 -12
- package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js +8 -21
- package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js.map +1 -1
- package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts +5 -4
- package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js +18 -13
- package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js.map +1 -1
- package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.d.ts +14 -0
- package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.d.ts.map +1 -0
- package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.js +39 -0
- package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.js.map +1 -0
- package/dist/schema-utils/lib/mesh/mesh-utils.d.ts +2 -14
- package/dist/schema-utils/lib/mesh/mesh-utils.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/mesh-utils.js +1 -35
- package/dist/schema-utils/lib/mesh/mesh-utils.js.map +1 -1
- package/dist/schema-utils/lib/mesh/point-cloud-tiler.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/point-cloud-tiler.js +6 -5
- package/dist/schema-utils/lib/mesh/point-cloud-tiler.js.map +1 -1
- package/dist/schema-utils/lib/schema/deduce-table-schema.d.ts +2 -1
- package/dist/schema-utils/lib/schema/deduce-table-schema.d.ts.map +1 -1
- package/dist/schema-utils/lib/schema/deduce-table-schema.js +7 -3
- package/dist/schema-utils/lib/schema/deduce-table-schema.js.map +1 -1
- package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.d.ts +6 -5
- package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.js +6 -5
- package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.js.map +1 -1
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.d.ts +9 -9
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.js +13 -46
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.js.map +1 -1
- package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.d.ts +9 -20
- package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.js +61 -73
- package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.js.map +1 -1
- package/dist/schema-utils/lib/table/batches/convert-batches.d.ts +4 -3
- package/dist/schema-utils/lib/table/batches/convert-batches.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batches/convert-batches.js +27 -9
- package/dist/schema-utils/lib/table/batches/convert-batches.js.map +1 -1
- package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts +6 -9
- package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js +22 -15
- package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js.map +1 -1
- package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts +4 -1
- package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batches/make-table-from-batches.js +13 -9
- package/dist/schema-utils/lib/table/batches/make-table-from-batches.js.map +1 -1
- package/dist/schema-utils/lib/table/query-arrow-table.d.ts +3 -3
- package/dist/schema-utils/lib/table/query-arrow-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/query-arrow-table.js +9 -23
- package/dist/schema-utils/lib/table/query-arrow-table.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts +9 -10
- package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/convert-arrow-table.js +13 -75
- package/dist/schema-utils/lib/table/tables/convert-arrow-table.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/convert-table.d.ts +6 -36
- package/dist/schema-utils/lib/table/tables/convert-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/convert-table.js +5 -42
- package/dist/schema-utils/lib/table/tables/convert-table.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/make-table.d.ts +3 -55
- package/dist/schema-utils/lib/table/tables/make-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/make-table.js +3 -59
- package/dist/schema-utils/lib/table/tables/make-table.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/row-utils.js +2 -2
- package/dist/schema-utils/lib/table/tables/row-utils.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-accessors.d.ts +18 -16
- package/dist/schema-utils/lib/table/tables/table-accessors.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-accessors.js +36 -39
- package/dist/schema-utils/lib/table/tables/table-accessors.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.d.ts +6 -5
- package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.js +2 -2
- package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts +1 -1
- package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js +8 -5
- package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-types.d.ts +1 -3
- package/dist/schema-utils/lib/table/tables/table-types.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-types.js +0 -4
- package/dist/schema-utils/lib/table/tables/table-types.js.map +1 -1
- package/dist/vector-table-scan-source.cjs +1766 -0
- package/dist/vector-table-scan-source.cjs.map +6 -0
- package/dist/vector-table-scan-source.d.ts +2 -0
- package/dist/vector-table-scan-source.d.ts.map +1 -0
- package/dist/vector-table-scan-source.js +2 -0
- package/dist/vector-table-scan-source.js.map +1 -0
- package/dist/worker-utils/index.cjs +407 -1184
- package/dist/worker-utils/index.cjs.map +3 -3
- package/dist/worker-utils/index.d.ts +2 -8
- package/dist/worker-utils/index.d.ts.map +1 -1
- package/dist/worker-utils/index.js +1 -10
- package/dist/worker-utils/index.js.map +1 -1
- package/dist/worker-utils/lib/env-utils/version.js +1 -1
- package/dist/worker-utils/lib/env-utils/version.js.map +1 -1
- package/dist/worker-utils/lib/library-utils/library-utils.d.ts.map +1 -1
- package/dist/worker-utils/lib/library-utils/library-utils.js +3 -2
- package/dist/worker-utils/lib/library-utils/library-utils.js.map +1 -1
- package/dist/worker-utils/lib/process-utils/child-process-proxy.d.ts.map +1 -1
- package/dist/worker-utils/lib/process-utils/child-process-proxy.js +8 -7
- package/dist/worker-utils/lib/process-utils/child-process-proxy.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/create-worker.d.ts +5 -7
- package/dist/worker-utils/lib/worker-api/create-worker.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-api/create-worker.js +76 -146
- package/dist/worker-utils/lib/worker-api/create-worker.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/get-worker-url.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-api/get-worker-url.js +5 -2
- package/dist/worker-utils/lib/worker-api/get-worker-url.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts +17 -45
- package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-api/process-on-worker.js +214 -312
- package/dist/worker-utils/lib/worker-api/process-on-worker.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/task-runtime.d.ts +36 -0
- package/dist/worker-utils/lib/worker-api/task-runtime.d.ts.map +1 -0
- package/dist/worker-utils/lib/worker-api/task-runtime.js +23 -0
- package/dist/worker-utils/lib/worker-api/task-runtime.js.map +1 -0
- package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.js +1 -6
- package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.js.map +1 -1
- package/dist/worker-utils/lib/worker-utils/get-transfer-list.d.ts +1 -0
- package/dist/worker-utils/lib/worker-utils/get-transfer-list.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-utils/get-transfer-list.js +3 -1
- package/dist/worker-utils/lib/worker-utils/get-transfer-list.js.map +1 -1
- package/dist/worker-utils/null-worker-node.js +836 -147
- package/dist/worker-utils/null-worker-node.js.map +4 -4
- package/dist/worker-utils/null-worker.js +804 -143
- package/dist/worker-utils/null-worker.js.map +4 -4
- package/dist/worker-utils/types.d.ts +55 -72
- package/dist/worker-utils/types.d.ts.map +1 -1
- package/package.json +141 -35
- package/src/arrow-geometry/binary-geometry-to-wkb.ts +1 -1
- package/src/arrow-geometry/feature-collection-to-arrow.ts +4 -3
- package/src/arrow-geometry/feature-table.ts +8 -17
- package/src/arrow-geometry/geojson-table.ts +32 -21
- package/src/arrow-geometry/geometry-codecs.ts +2 -2
- package/src/arrow-geometry/geometry-to-wkt.ts +2 -2
- package/src/arrow-geometry/index.ts +0 -9
- package/src/arrow-geometry/wkb-arrow-utils.ts +8 -12
- package/src/arrow-geometry/wkb-builder.ts +2 -2
- package/src/arrow-geometry/wkb-statistics.ts +2 -2
- package/src/arrow-worker-transport.ts +126 -0
- package/src/cluster-source.ts +1 -0
- package/src/federated-table-scan-source.ts +1 -0
- package/src/geoarrow/binary-polygon-to-geoarrow.ts +2 -2
- package/src/geoarrow/clustering/cluster-source.ts +20 -30
- package/src/geoarrow/convert-table-to-geoarrow.ts +14 -24
- package/src/geoarrow/geoarrow-bounds.ts +3 -3
- package/src/geoarrow/geoarrow-capabilities.ts +1 -1
- package/src/geoarrow/geoarrow-converter/convert-geoarrow-geometry.ts +3 -3
- package/src/geoarrow/geoarrow-converter/convert-geoarrow.ts +14 -9
- package/src/geoarrow/geoarrow-converter/geoarrow-converter.ts +7 -6
- package/src/geoarrow/geoarrow-inspection.ts +2 -2
- package/src/geoarrow/geoarrow-stream.ts +16 -16
- package/src/geoarrow/get-geoarrow-vertex-count.ts +1 -1
- package/src/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.ts +3 -3
- package/src/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.ts +4 -11
- package/src/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.ts +1 -1
- package/src/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.ts +2 -2
- package/src/geoarrow/lib/kernels/encode-geoarrow-box.ts +1 -1
- package/src/geoarrow/lib/table-converters/convert-geoarrow-table.ts +11 -11
- package/src/geoarrow/mesharrow/arrow-fixed-size-list-utils.ts +3 -2
- package/src/geoarrow/metadata/geoarrow-metadata.ts +3 -4
- package/src/index.ts +2 -6
- package/src/lib/api/create-data-source.ts +148 -58
- package/src/lib/api/encode.ts +14 -3
- package/src/lib/api/load-in-batches.ts +15 -7
- package/src/lib/api/load-loader.ts +22 -21
- package/src/lib/api/load.ts +51 -127
- package/src/lib/api/loader-options.ts +69 -0
- package/src/lib/api/parse-file.ts +32 -22
- package/src/lib/api/parse-in-batches.ts +121 -20
- package/src/lib/api/parse-sync.ts +30 -16
- package/src/lib/api/parse.ts +46 -29
- package/src/lib/api/select-loader.ts +54 -69
- package/src/lib/api/select-source.ts +7 -1
- package/src/lib/loader-utils/get-fetch-function.ts +2 -2
- package/src/lib/loader-utils/loggers.ts +2 -70
- package/src/lib/loader-utils/native-arrow.ts +83 -0
- package/src/lib/loader-utils/option-defaults.ts +9 -10
- package/src/lib/loader-utils/option-utils.ts +33 -122
- package/src/loader-utils/format-types.ts +4 -0
- package/src/loader-utils/index.ts +50 -10
- package/src/loader-utils/lib/files/http-file-transport.ts +65 -1
- package/src/loader-utils/lib/files/http-file-types.ts +2 -0
- package/src/loader-utils/lib/files/read-range-response.ts +66 -0
- package/src/loader-utils/lib/log-utils/log.ts +36 -1
- package/src/loader-utils/lib/pace-batch-iterator.ts +66 -0
- package/src/loader-utils/lib/request-utils/request-credentials.ts +1 -1
- package/src/loader-utils/lib/scan-utils/logical-table-query.ts +174 -0
- package/src/loader-utils/lib/scan-utils/query-options.ts +44 -0
- package/src/loader-utils/lib/scan-utils/scan-query-metadata.ts +81 -28
- package/src/loader-utils/lib/scan-utils/table-query.ts +76 -8
- package/src/loader-utils/lib/scan-utils/table-scan-batch.ts +101 -53
- package/src/loader-utils/lib/sources/data-source.ts +57 -16
- package/src/loader-utils/lib/sources/image-source.ts +1 -1
- package/src/loader-utils/lib/sources/table-source-collection.ts +39 -0
- package/src/loader-utils/lib/sources/utils/utils.ts +1 -1
- package/src/loader-utils/lib/sources/vector-source.ts +3 -3
- package/src/loader-utils/lib/sources/vector-tile-source.ts +4 -9
- package/src/loader-utils/lib/worker-loader-utils/encode-with-worker.ts +5 -6
- package/src/loader-utils/lib/worker-loader-utils/parse-with-worker.ts +41 -24
- package/src/loader-utils/loader-types.ts +190 -111
- package/src/loader-utils/source-types.ts +17 -6
- package/src/null-loader.ts +1 -20
- package/src/polyfills/README.md +2 -2
- package/src/polyfills/images/encode-image-node.ts +44 -37
- package/src/polyfills/images/image-codecs-node.ts +2 -37
- package/src/polyfills/images/load-sharp.ts +13 -0
- package/src/polyfills/images/node-image-bitmap.ts +1 -1
- package/src/polyfills/images/node-image-formats.ts +10 -4
- package/src/polyfills/images/parse-image-node.ts +31 -40
- package/src/polyfills/index.ts +3 -3
- package/src/scan/arrow-execution/expressions.ts +116 -0
- package/src/scan/arrow-execution/filter-arrow-table.ts +298 -0
- package/src/scan/arrow-execution/project-arrow-table.ts +53 -0
- package/src/scan/arrow-execution.ts +7 -0
- package/src/scan/arrow-query-worker-entry.ts +8 -0
- package/src/scan/arrow-query-worker.ts +158 -0
- package/src/scan/arrow-query.ts +3 -0
- package/src/scan/catalog-query-source.ts +132 -0
- package/src/scan/federated-table-scan-source.ts +67 -78
- package/src/scan/index.ts +64 -6
- package/src/scan/parse-sql-predicate.ts +14 -367
- package/src/scan/query-arrow-table-in-batches.ts +55 -0
- package/src/scan/query-arrow-table.ts +81 -271
- package/src/scan/query-open-source.ts +39 -0
- package/src/scan/query-progressive.ts +229 -0
- package/src/scan/query-pushdown.ts +184 -0
- package/src/scan/query-scales.ts +199 -0
- package/src/scan/query.ts +594 -0
- package/src/scan/resolve-query-source.ts +47 -0
- package/src/scan/rows-to-arrow.ts +3 -39
- package/src/scan/scan-engine.ts +6 -6
- package/src/scan/sql-catalog.ts +167 -0
- package/src/scan/table-query.ts +6 -1
- package/src/scan/vector-table-scan-source.ts +25 -26
- package/src/schema/categories/category-mesh.ts +3 -11
- package/src/schema/categories/category-table.ts +2 -28
- package/src/schema/geometry/arrow-binary-features.ts +1 -1
- package/src/schema/geometry/geoarrow.ts +8 -19
- package/src/schema/index.ts +4 -5
- package/src/schema/types/batch.ts +0 -5
- package/src/schema-utils/index.ts +19 -10
- package/src/schema-utils/lib/arrow/arrow-metadata.ts +139 -0
- package/src/schema-utils/lib/converters/convert.ts +7 -2
- package/src/schema-utils/lib/converters/types.ts +2 -0
- package/src/schema-utils/lib/mesh/convert-mesh-to-table.ts +15 -43
- package/src/schema-utils/lib/mesh/convert-table-to-mesh.ts +19 -16
- package/src/schema-utils/lib/mesh/get-mesh-bounding-box.ts +52 -0
- package/src/schema-utils/lib/mesh/mesh-utils.ts +3 -49
- package/src/schema-utils/lib/mesh/point-cloud-tiler.ts +6 -5
- package/src/schema-utils/lib/schema/deduce-table-schema.ts +8 -4
- package/src/schema-utils/lib/table/arrow-api/arrow-like-table.ts +10 -9
- package/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts +21 -51
- package/src/schema-utils/lib/table/batch-builder/table-batch-builder.ts +68 -83
- package/src/schema-utils/lib/table/batches/convert-batches.ts +38 -21
- package/src/schema-utils/lib/table/batches/make-arrow-batch-iterator.ts +29 -19
- package/src/schema-utils/lib/table/batches/make-table-from-batches.ts +26 -7
- package/src/schema-utils/lib/table/query-arrow-table.ts +14 -32
- package/src/schema-utils/lib/table/tables/convert-arrow-table.ts +27 -95
- package/src/schema-utils/lib/table/tables/convert-table.ts +11 -57
- package/src/schema-utils/lib/table/tables/make-table.ts +6 -70
- package/src/schema-utils/lib/table/tables/row-utils.ts +2 -2
- package/src/schema-utils/lib/table/tables/table-accessors.ts +60 -63
- package/src/schema-utils/lib/table/tables/table-converter/convert-tables.ts +12 -14
- package/src/schema-utils/lib/table/tables/table-converter/table-converter.ts +12 -9
- package/src/schema-utils/lib/table/tables/table-types.ts +1 -7
- package/src/vector-table-scan-source.ts +1 -0
- package/src/worker-utils/index.ts +2 -18
- package/src/worker-utils/lib/library-utils/library-utils.ts +3 -2
- package/src/worker-utils/lib/process-utils/child-process-proxy.ts +8 -7
- package/src/worker-utils/lib/worker-api/create-worker.ts +89 -188
- package/src/worker-utils/lib/worker-api/get-worker-url.ts +4 -3
- package/src/worker-utils/lib/worker-api/process-on-worker.ts +246 -402
- package/src/worker-utils/lib/worker-api/task-runtime.ts +66 -0
- package/src/worker-utils/lib/worker-utils/get-loadable-worker-url.ts +1 -6
- package/src/worker-utils/lib/worker-utils/get-transfer-list.ts +2 -0
- package/src/worker-utils/types.ts +74 -109
- package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs +0 -477
- package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs.map +0 -7
- package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts +0 -29
- package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts.map +0 -1
- package/dist/arrow-geometry/arrow-geoarrow-adapter.js +0 -434
- package/dist/arrow-geometry/arrow-geoarrow-adapter.js.map +0 -1
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs +0 -39
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs.map +0 -7
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts +0 -2
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts.map +0 -1
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.js +0 -5
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.js.map +0 -1
- package/dist/loader-utils/lib/file-provider/data-view-file.d.ts +0 -40
- package/dist/loader-utils/lib/file-provider/data-view-file.d.ts.map +0 -1
- package/dist/loader-utils/lib/file-provider/data-view-file.js +0 -68
- package/dist/loader-utils/lib/file-provider/data-view-file.js.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-handle-file.d.ts +0 -54
- package/dist/loader-utils/lib/file-provider/file-handle-file.d.ts.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-handle-file.js +0 -102
- package/dist/loader-utils/lib/file-provider/file-handle-file.js.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-provider-interface.d.ts +0 -45
- package/dist/loader-utils/lib/file-provider/file-provider-interface.d.ts.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-provider-interface.js +0 -13
- package/dist/loader-utils/lib/file-provider/file-provider-interface.js.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-provider.d.ts +0 -57
- package/dist/loader-utils/lib/file-provider/file-provider.d.ts.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-provider.js +0 -114
- package/dist/loader-utils/lib/file-provider/file-provider.js.map +0 -1
- package/dist/loader-utils/lib/scan-utils/experimental-scan-options.d.ts.map +0 -1
- package/dist/loader-utils/lib/scan-utils/experimental-scan-options.js.map +0 -1
- package/dist/schema/deprecated/mesh-utils.d.ts +0 -12
- package/dist/schema/deprecated/mesh-utils.d.ts.map +0 -1
- package/dist/schema/deprecated/mesh-utils.js +0 -37
- package/dist/schema/deprecated/mesh-utils.js.map +0 -1
- package/dist/schema-utils/arrow-transport.cjs +0 -691
- package/dist/schema-utils/arrow-transport.cjs.map +0 -6
- package/dist/schema-utils/arrow-transport.d.ts +0 -4
- package/dist/schema-utils/arrow-transport.d.ts.map +0 -1
- package/dist/schema-utils/arrow-transport.js +0 -7
- package/dist/schema-utils/arrow-transport.js.map +0 -1
- package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts +0 -76
- package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts.map +0 -1
- package/dist/schema-utils/lib/arrow/arrow-table-transport.js +0 -182
- package/dist/schema-utils/lib/arrow/arrow-table-transport.js.map +0 -1
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts +0 -33
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts.map +0 -1
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.js +0 -134
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.d.ts +0 -10
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.js +0 -71
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.d.ts +0 -19
- package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.js +0 -64
- package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.d.ts +0 -20
- package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.js +0 -83
- package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.d.ts +0 -21
- package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.js +0 -86
- package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.d.ts +0 -24
- package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.js.map +0 -1
- package/dist/worker-utils/lib/async-queue/async-queue.d.ts +0 -32
- package/dist/worker-utils/lib/async-queue/async-queue.d.ts.map +0 -1
- package/dist/worker-utils/lib/async-queue/async-queue.js +0 -91
- package/dist/worker-utils/lib/async-queue/async-queue.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-body.d.ts +0 -20
- package/dist/worker-utils/lib/worker-farm/worker-body.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-body.js +0 -131
- package/dist/worker-utils/lib/worker-farm/worker-body.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-farm.d.ts +0 -58
- package/dist/worker-utils/lib/worker-farm/worker-farm.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-farm.js +0 -116
- package/dist/worker-utils/lib/worker-farm/worker-farm.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-job.d.ts +0 -34
- package/dist/worker-utils/lib/worker-farm/worker-job.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-job.js +0 -74
- package/dist/worker-utils/lib/worker-farm/worker-job.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-pool.d.ts +0 -94
- package/dist/worker-utils/lib/worker-farm/worker-pool.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-pool.js +0 -246
- package/dist/worker-utils/lib/worker-farm/worker-pool.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-thread.d.ts +0 -67
- package/dist/worker-utils/lib/worker-farm/worker-thread.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-thread.js +0 -175
- package/dist/worker-utils/lib/worker-farm/worker-thread.js.map +0 -1
- package/src/arrow-geometry/arrow-geoarrow-adapter.ts +0 -568
- package/src/geoarrow/lib/arrow-geoarrow-adapter.ts +0 -12
- package/src/loader-utils/lib/file-provider/data-view-file.ts +0 -83
- package/src/loader-utils/lib/file-provider/file-handle-file.ts +0 -114
- package/src/loader-utils/lib/file-provider/file-provider-interface.ts +0 -60
- package/src/loader-utils/lib/file-provider/file-provider.ts +0 -130
- package/src/loader-utils/lib/scan-utils/experimental-scan-options.ts +0 -46
- package/src/polyfills/images/encode-image.node.ts.disabled +0 -41
- package/src/polyfills/images/parse-image.node.ts.disabled +0 -55
- package/src/schema/deprecated/mesh-utils.ts +0 -46
- package/src/schema-utils/arrow-transport.ts +0 -7
- package/src/schema-utils/lib/arrow/arrow-table-transport.ts +0 -282
- package/src/schema-utils/lib/arrow/split-arrow-buffers.ts +0 -247
- package/src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator-builders.ts.disabled +0 -190
- package/src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.ts +0 -85
- package/src/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.ts +0 -82
- package/src/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.ts +0 -103
- package/src/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.ts +0 -108
- package/src/schema-utils/lib/table/batch-builder/table-batch-aggregator.ts +0 -28
- package/src/worker-utils/lib/async-queue/async-queue.ts +0 -100
- package/src/worker-utils/lib/worker-farm/worker-body.ts +0 -145
- package/src/worker-utils/lib/worker-farm/worker-farm.ts +0 -144
- package/src/worker-utils/lib/worker-farm/worker-job.ts +0 -85
- package/src/worker-utils/lib/worker-farm/worker-pool.ts +0 -316
- package/src/worker-utils/lib/worker-farm/worker-thread.ts +0 -206
|
@@ -36,9 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
ArrowLikeTable: () => ArrowLikeTable,
|
|
37
37
|
ArrowTableBuilder: () => ArrowTableBuilder,
|
|
38
38
|
AsyncQueue: () => AsyncQueue,
|
|
39
|
-
ColumnarTableBatchAggregator: () => ColumnarTableBatchAggregator,
|
|
40
39
|
PointCloudTiler: () => PointCloudTiler,
|
|
41
|
-
RowTableBatchAggregator: () => RowTableBatchAggregator,
|
|
42
40
|
TABLE_CONVERTERS: () => TABLE_CONVERTERS,
|
|
43
41
|
TableBatchBuilder: () => TableBatchBuilder,
|
|
44
42
|
TableConverter: () => TableConverter,
|
|
@@ -47,6 +45,7 @@ __export(index_exports, {
|
|
|
47
45
|
convertArrowToTable: () => convertArrowToTable2,
|
|
48
46
|
convertBatch: () => convertBatch,
|
|
49
47
|
convertBatches: () => convertBatches,
|
|
48
|
+
convertMeshToArrowTable: () => convertMeshToArrowTable,
|
|
50
49
|
convertMeshToTable: () => convertMeshToTable,
|
|
51
50
|
convertSchemaToArrow: () => convertSchemaToArrow,
|
|
52
51
|
convertTable: () => convertTable2,
|
|
@@ -77,14 +76,16 @@ __export(index_exports, {
|
|
|
77
76
|
getTableRowShape: () => getTableRowShape,
|
|
78
77
|
getTypeInfo: () => getTypeInfo,
|
|
79
78
|
isArrayRowTable: () => isArrayRowTable,
|
|
79
|
+
isArrowRecordBatch: () => isArrowRecordBatch,
|
|
80
80
|
isArrowTable: () => isArrowTable,
|
|
81
81
|
isColumnarTable: () => isColumnarTable,
|
|
82
82
|
isGeoJSONTable: () => isGeoJSONTable,
|
|
83
83
|
isObjectRowTable: () => isObjectRowTable,
|
|
84
84
|
isTable: () => isTable,
|
|
85
85
|
makeArrayRowIterator: () => makeArrayRowIterator,
|
|
86
|
+
makeArrowMetadataBatch: () => makeArrowMetadataBatch,
|
|
86
87
|
makeArrowRecordBatchIterator: () => makeArrowRecordBatchIterator,
|
|
87
|
-
|
|
88
|
+
makeArrowTableFromBatches: () => makeArrowTableFromBatches,
|
|
88
89
|
makeBatchFromTable: () => makeBatchFromTable,
|
|
89
90
|
makeMeshArrowTable: () => makeMeshArrowTable,
|
|
90
91
|
makeMeshAttributeMetadata: () => makeMeshAttributeMetadata,
|
|
@@ -93,12 +94,17 @@ __export(index_exports, {
|
|
|
93
94
|
makeTableBatchIterator: () => makeTableBatchIterator,
|
|
94
95
|
makeTableFromBatches: () => makeTableFromBatches,
|
|
95
96
|
makeTableFromData: () => makeTableFromData,
|
|
97
|
+
mergeArrowSchemas: () => mergeArrowSchemas,
|
|
96
98
|
queryArrowTable: () => queryArrowTable,
|
|
99
|
+
refineArrowTableBatches: () => refineArrowTableBatches,
|
|
97
100
|
selectArrowTableRows: () => selectArrowTableRows,
|
|
98
101
|
serializeArrowField: () => serializeArrowField,
|
|
99
102
|
serializeArrowMetadata: () => serializeArrowMetadata,
|
|
100
103
|
serializeArrowSchema: () => serializeArrowSchema,
|
|
101
|
-
serializeArrowType: () => serializeArrowType
|
|
104
|
+
serializeArrowType: () => serializeArrowType,
|
|
105
|
+
snapshotArrowSchema: () => snapshotArrowSchema,
|
|
106
|
+
updateArrowTableSchema: () => updateArrowTableSchema,
|
|
107
|
+
updateNativeArrowTableMetadata: () => updateNativeArrowTableMetadata
|
|
102
108
|
});
|
|
103
109
|
module.exports = __toCommonJS(index_exports);
|
|
104
110
|
|
|
@@ -228,11 +234,16 @@ function detectSourceShape(input, converters) {
|
|
|
228
234
|
if (fallbackShape !== null) {
|
|
229
235
|
detectedShapes.add(fallbackShape);
|
|
230
236
|
}
|
|
237
|
+
let detectionPriority = 0;
|
|
231
238
|
for (const converter of converters) {
|
|
232
239
|
const detectedShape = converter.detectInputShape?.(input);
|
|
233
|
-
if (detectedShape)
|
|
234
|
-
|
|
240
|
+
if (!detectedShape) continue;
|
|
241
|
+
const priority = converter.inputShapePriority ?? 0;
|
|
242
|
+
if (priority > detectionPriority) {
|
|
243
|
+
detectedShapes.clear();
|
|
244
|
+
detectionPriority = priority;
|
|
235
245
|
}
|
|
246
|
+
if (priority === detectionPriority) detectedShapes.add(detectedShape);
|
|
236
247
|
}
|
|
237
248
|
if (detectedShapes.size === 0) {
|
|
238
249
|
throw new Error("Could not detect source shape for conversion input");
|
|
@@ -720,6 +731,7 @@ function deserializeArrowDictionaryKeyType(keyType) {
|
|
|
720
731
|
|
|
721
732
|
// src/schema-utils/lib/schema/deduce-table-schema.ts
|
|
722
733
|
function deduceTableSchema(table) {
|
|
734
|
+
if (!("shape" in table)) return convertArrowToSchema(table.schema);
|
|
723
735
|
switch (table.shape) {
|
|
724
736
|
case "array-row-table":
|
|
725
737
|
case "object-row-table":
|
|
@@ -728,7 +740,6 @@ function deduceTableSchema(table) {
|
|
|
728
740
|
return deduceSchemaFromGeoJSON(table.features);
|
|
729
741
|
case "columnar-table":
|
|
730
742
|
return deduceSchemaFromColumns(table.data);
|
|
731
|
-
case "arrow-table":
|
|
732
743
|
default:
|
|
733
744
|
throw new Error("Deduce schema");
|
|
734
745
|
}
|
|
@@ -748,7 +759,8 @@ function deduceSchemaFromRows(rowTable) {
|
|
|
748
759
|
const fields = [];
|
|
749
760
|
const row0 = rowTable[0];
|
|
750
761
|
for (const [columnName, value] of Object.entries(row0)) {
|
|
751
|
-
|
|
762
|
+
const name = Array.isArray(row0) ? `column${Number(columnName) + 1}` : columnName;
|
|
763
|
+
fields.push(deduceFieldFromValue(value, name));
|
|
752
764
|
}
|
|
753
765
|
return { fields, metadata: {} };
|
|
754
766
|
}
|
|
@@ -795,9 +807,21 @@ function deduceFieldFromValue(value, name) {
|
|
|
795
807
|
};
|
|
796
808
|
}
|
|
797
809
|
|
|
810
|
+
// src/lib/loader-utils/native-arrow.ts
|
|
811
|
+
function isArrowTable(value) {
|
|
812
|
+
return Boolean(
|
|
813
|
+
value && typeof value === "object" && "schema" in value && "batches" in value && Array.isArray(value.batches) && "numRows" in value && typeof value.numRows === "number" && "getChildAt" in value && typeof value.getChildAt === "function"
|
|
814
|
+
);
|
|
815
|
+
}
|
|
816
|
+
function isArrowRecordBatch(value) {
|
|
817
|
+
return Boolean(
|
|
818
|
+
value && typeof value === "object" && value[/* @__PURE__ */ Symbol.for("apache-arrow/RecordBatch")] === true
|
|
819
|
+
);
|
|
820
|
+
}
|
|
821
|
+
|
|
798
822
|
// src/schema-utils/lib/table/tables/make-table.ts
|
|
799
|
-
var arrow2 = __toESM(require("apache-arrow"), 1);
|
|
800
823
|
function makeTableFromData(data) {
|
|
824
|
+
if (isArrowTable(data)) return data;
|
|
801
825
|
let table;
|
|
802
826
|
switch (getTableShapeFromData(data)) {
|
|
803
827
|
case "array-row-table":
|
|
@@ -809,9 +833,6 @@ function makeTableFromData(data) {
|
|
|
809
833
|
case "columnar-table":
|
|
810
834
|
table = { shape: "columnar-table", data };
|
|
811
835
|
break;
|
|
812
|
-
case "arrow-table":
|
|
813
|
-
table = { shape: "arrow-table", data };
|
|
814
|
-
break;
|
|
815
836
|
default:
|
|
816
837
|
throw new Error("table");
|
|
817
838
|
}
|
|
@@ -819,9 +840,6 @@ function makeTableFromData(data) {
|
|
|
819
840
|
return { ...table, schema };
|
|
820
841
|
}
|
|
821
842
|
function getTableShapeFromData(data) {
|
|
822
|
-
if (data instanceof arrow2.Table) {
|
|
823
|
-
return "arrow-table";
|
|
824
|
-
}
|
|
825
843
|
if (Array.isArray(data)) {
|
|
826
844
|
if (data.length === 0) {
|
|
827
845
|
throw new Error("cannot deduce type of empty table");
|
|
@@ -840,8 +858,109 @@ function getTableShapeFromData(data) {
|
|
|
840
858
|
throw new Error("invalid table");
|
|
841
859
|
}
|
|
842
860
|
|
|
861
|
+
// src/schema-utils/lib/arrow/arrow-metadata.ts
|
|
862
|
+
var arrow2 = __toESM(require("apache-arrow"), 1);
|
|
863
|
+
function snapshotArrowSchema(schema) {
|
|
864
|
+
return deserializeArrowSchema(serializeArrowSchema(schema));
|
|
865
|
+
}
|
|
866
|
+
function mergeArrowSchemas(previous, next) {
|
|
867
|
+
if (!previous) return snapshotArrowSchema(next);
|
|
868
|
+
new arrow2.Table(previous, [new arrow2.RecordBatch(next, void 0)]);
|
|
869
|
+
const earlier = serializeArrowSchema(previous);
|
|
870
|
+
const later = serializeArrowSchema(next);
|
|
871
|
+
return deserializeArrowSchema({
|
|
872
|
+
...later,
|
|
873
|
+
fields: later.fields.map((field, index) => mergeFieldMetadata(earlier.fields[index], field)),
|
|
874
|
+
metadata: { ...earlier.metadata, ...later.metadata }
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
function mergeFieldMetadata(previous, next) {
|
|
878
|
+
return {
|
|
879
|
+
...next,
|
|
880
|
+
type: mergeTypeMetadata(previous.type, next.type),
|
|
881
|
+
metadata: { ...previous.metadata, ...next.metadata }
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
function mergeTypeMetadata(previous, next) {
|
|
885
|
+
if (typeof previous !== "object" || typeof next !== "object") return next;
|
|
886
|
+
if ("children" in previous && "children" in next) {
|
|
887
|
+
const previousChildren = previous.children;
|
|
888
|
+
return {
|
|
889
|
+
...next,
|
|
890
|
+
children: next.children.map(
|
|
891
|
+
(field, index) => mergeFieldMetadata(previousChildren[index], field)
|
|
892
|
+
)
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
if (previous.type === "dictionary" && next.type === "dictionary") {
|
|
896
|
+
return { ...next, dictionary: mergeTypeMetadata(previous.dictionary, next.dictionary) };
|
|
897
|
+
}
|
|
898
|
+
return next;
|
|
899
|
+
}
|
|
900
|
+
function snapshotArrowBatch(batch, schema) {
|
|
901
|
+
const snapshot = new arrow2.RecordBatch(
|
|
902
|
+
snapshotArrowSchema(schema),
|
|
903
|
+
batch.data,
|
|
904
|
+
new Map(batch.metadata)
|
|
905
|
+
);
|
|
906
|
+
if (snapshot.numRows !== batch.numRows) {
|
|
907
|
+
Object.defineProperty(snapshot, "data", { value: batch.data });
|
|
908
|
+
}
|
|
909
|
+
return snapshot;
|
|
910
|
+
}
|
|
911
|
+
function updateArrowTableSchema(table, schema) {
|
|
912
|
+
const snapshot = snapshotArrowSchema(schema);
|
|
913
|
+
const batches = table.batches.map((batch) => snapshotArrowBatch(batch, snapshot));
|
|
914
|
+
return new arrow2.Table(
|
|
915
|
+
snapshot,
|
|
916
|
+
batches.length ? batches : [new arrow2.RecordBatch(snapshotArrowSchema(snapshot), void 0)]
|
|
917
|
+
);
|
|
918
|
+
}
|
|
919
|
+
function updateNativeArrowTableMetadata(table, metadata) {
|
|
920
|
+
const schema = new arrow2.Schema(
|
|
921
|
+
table.schema.fields,
|
|
922
|
+
new Map([...table.schema.metadata, ...Object.entries(metadata)])
|
|
923
|
+
);
|
|
924
|
+
return updateArrowTableSchema(table, schema);
|
|
925
|
+
}
|
|
926
|
+
function makeArrowMetadataBatch(schema) {
|
|
927
|
+
return new arrow2.RecordBatch(snapshotArrowSchema(schema), void 0);
|
|
928
|
+
}
|
|
929
|
+
async function makeArrowTableFromBatches(batches) {
|
|
930
|
+
let schema;
|
|
931
|
+
const collected = [];
|
|
932
|
+
for await (const batch of batches) {
|
|
933
|
+
schema = mergeArrowSchemas(schema, batch.schema);
|
|
934
|
+
collected.push(snapshotArrowBatch(batch, batch.schema));
|
|
935
|
+
}
|
|
936
|
+
return schema ? new arrow2.Table(schema, collected) : null;
|
|
937
|
+
}
|
|
938
|
+
async function* refineArrowTableBatches(batches) {
|
|
939
|
+
let schema;
|
|
940
|
+
let bounds;
|
|
941
|
+
for await (const table of batches) {
|
|
942
|
+
const localBounds = table.schema.metadata.get("boundingBox");
|
|
943
|
+
const nextSchema = snapshotArrowSchema(table.schema);
|
|
944
|
+
if (localBounds) {
|
|
945
|
+
const nextBounds = JSON.parse(localBounds);
|
|
946
|
+
bounds = bounds ? [
|
|
947
|
+
nextBounds[0].map((value, index) => Math.min(bounds[0][index], value)),
|
|
948
|
+
nextBounds[1].map((value, index) => Math.max(bounds[1][index], value))
|
|
949
|
+
] : nextBounds;
|
|
950
|
+
nextSchema.metadata.set("boundingBox", JSON.stringify(bounds));
|
|
951
|
+
}
|
|
952
|
+
schema = mergeArrowSchemas(schema, nextSchema);
|
|
953
|
+
const data = updateArrowTableSchema(table, schema);
|
|
954
|
+
if (localBounds) {
|
|
955
|
+
for (const recordBatch of data.batches) recordBatch.metadata.set("boundingBox", localBounds);
|
|
956
|
+
}
|
|
957
|
+
yield data;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
|
|
843
961
|
// src/schema-utils/lib/table/tables/table-accessors.ts
|
|
844
962
|
function isTable(table) {
|
|
963
|
+
if (isArrowTable(table)) return true;
|
|
845
964
|
const shape = typeof table === "object" && table?.shape;
|
|
846
965
|
switch (shape) {
|
|
847
966
|
case "array-row-table":
|
|
@@ -851,22 +970,18 @@ function isTable(table) {
|
|
|
851
970
|
return Array.isArray(table.features);
|
|
852
971
|
case "columnar-table":
|
|
853
972
|
return Boolean(table.data && typeof table.data === "object");
|
|
854
|
-
case "arrow-table":
|
|
855
|
-
return Boolean(table?.data?.numRows !== void 0);
|
|
856
973
|
default:
|
|
857
974
|
return false;
|
|
858
975
|
}
|
|
859
976
|
}
|
|
860
977
|
function getTableLength(table) {
|
|
978
|
+
if (!("shape" in table)) return table.numRows;
|
|
861
979
|
switch (table.shape) {
|
|
862
980
|
case "array-row-table":
|
|
863
981
|
case "object-row-table":
|
|
864
982
|
return table.data.length;
|
|
865
983
|
case "geojson-table":
|
|
866
984
|
return table.features.length;
|
|
867
|
-
case "arrow-table":
|
|
868
|
-
const arrowTable = table.data;
|
|
869
|
-
return arrowTable.numRows;
|
|
870
985
|
case "columnar-table":
|
|
871
986
|
for (const column of Object.values(table.data)) {
|
|
872
987
|
return column.length || 0;
|
|
@@ -877,6 +992,7 @@ function getTableLength(table) {
|
|
|
877
992
|
}
|
|
878
993
|
}
|
|
879
994
|
function getTableNumCols(table) {
|
|
995
|
+
if (!("shape" in table)) return table.numCols;
|
|
880
996
|
if (table.schema) {
|
|
881
997
|
return table.schema.fields.length;
|
|
882
998
|
}
|
|
@@ -892,14 +1008,12 @@ function getTableNumCols(table) {
|
|
|
892
1008
|
return Object.keys(table.features[0]).length;
|
|
893
1009
|
case "columnar-table":
|
|
894
1010
|
return Object.keys(table.data).length;
|
|
895
|
-
case "arrow-table":
|
|
896
|
-
const arrowTable = table.data;
|
|
897
|
-
return arrowTable.numCols;
|
|
898
1011
|
default:
|
|
899
1012
|
throw new Error("table");
|
|
900
1013
|
}
|
|
901
1014
|
}
|
|
902
1015
|
function getTableCell(table, rowIndex, columnName) {
|
|
1016
|
+
if (!("shape" in table)) return table.getChild(columnName)?.get(rowIndex);
|
|
903
1017
|
switch (table.shape) {
|
|
904
1018
|
case "array-row-table":
|
|
905
1019
|
const columnIndex = getTableColumnIndex(table, columnName);
|
|
@@ -911,17 +1025,12 @@ function getTableCell(table, rowIndex, columnName) {
|
|
|
911
1025
|
case "columnar-table":
|
|
912
1026
|
const column = table.data[columnName];
|
|
913
1027
|
return column[rowIndex];
|
|
914
|
-
case "arrow-table":
|
|
915
|
-
const arrowTable = table.data;
|
|
916
|
-
const arrowColumnIndex = arrowTable.schema.fields.findIndex(
|
|
917
|
-
(field) => field.name === columnName
|
|
918
|
-
);
|
|
919
|
-
return arrowTable.getChildAt(arrowColumnIndex)?.get(rowIndex);
|
|
920
1028
|
default:
|
|
921
1029
|
throw new Error("todo");
|
|
922
1030
|
}
|
|
923
1031
|
}
|
|
924
1032
|
function getTableCellAt(table, rowIndex, columnIndex) {
|
|
1033
|
+
if (!("shape" in table)) return table.getChildAt(columnIndex)?.get(rowIndex);
|
|
925
1034
|
switch (table.shape) {
|
|
926
1035
|
case "array-row-table":
|
|
927
1036
|
return table.data[rowIndex][columnIndex];
|
|
@@ -935,14 +1044,12 @@ function getTableCellAt(table, rowIndex, columnIndex) {
|
|
|
935
1044
|
const columnName3 = getTableColumnName(table, columnIndex);
|
|
936
1045
|
const column = table.data[columnName3];
|
|
937
1046
|
return column[rowIndex];
|
|
938
|
-
case "arrow-table":
|
|
939
|
-
const arrowTable = table.data;
|
|
940
|
-
return arrowTable.getChildAt(columnIndex)?.get(rowIndex);
|
|
941
1047
|
default:
|
|
942
1048
|
throw new Error("todo");
|
|
943
1049
|
}
|
|
944
1050
|
}
|
|
945
1051
|
function getTableRowShape(table) {
|
|
1052
|
+
if (!("shape" in table)) throw new Error("Not a row table");
|
|
946
1053
|
switch (table.shape) {
|
|
947
1054
|
case "array-row-table":
|
|
948
1055
|
case "object-row-table":
|
|
@@ -969,101 +1076,97 @@ function getTableColumnName(table, columnIndex) {
|
|
|
969
1076
|
return columnName;
|
|
970
1077
|
}
|
|
971
1078
|
function getTableRowAsObject(table, rowIndex, target, copy) {
|
|
1079
|
+
if (!("shape" in table)) {
|
|
1080
|
+
const objectRow = target || {};
|
|
1081
|
+
const row = table.get(rowIndex);
|
|
1082
|
+
for (const field of table.schema.fields) objectRow[field.name] = row?.[field.name];
|
|
1083
|
+
return objectRow;
|
|
1084
|
+
}
|
|
972
1085
|
switch (table.shape) {
|
|
973
1086
|
case "object-row-table":
|
|
974
1087
|
return copy ? Object.fromEntries(Object.entries(table.data[rowIndex])) : table.data[rowIndex];
|
|
975
1088
|
case "array-row-table":
|
|
976
1089
|
if (table.schema) {
|
|
977
|
-
const
|
|
1090
|
+
const objectRow = target || {};
|
|
978
1091
|
for (let i = 0; i < table.schema.fields.length; i++) {
|
|
979
|
-
|
|
1092
|
+
objectRow[table.schema.fields[i].name] = table.data[rowIndex][i];
|
|
980
1093
|
}
|
|
981
|
-
return
|
|
1094
|
+
return objectRow;
|
|
982
1095
|
}
|
|
983
1096
|
throw new Error("no schema");
|
|
984
1097
|
case "geojson-table":
|
|
985
1098
|
if (table.schema) {
|
|
986
|
-
const
|
|
1099
|
+
const objectRow = target || {};
|
|
987
1100
|
for (let i = 0; i < table.schema.fields.length; i++) {
|
|
988
|
-
|
|
1101
|
+
objectRow[table.schema.fields[i].name] = table.features[rowIndex][table.schema.fields[i].name];
|
|
989
1102
|
}
|
|
990
|
-
return
|
|
1103
|
+
return objectRow;
|
|
991
1104
|
}
|
|
992
1105
|
throw new Error("no schema");
|
|
993
1106
|
case "columnar-table":
|
|
994
1107
|
if (table.schema) {
|
|
995
|
-
const
|
|
1108
|
+
const objectRow = target || {};
|
|
996
1109
|
for (let i = 0; i < table.schema.fields.length; i++) {
|
|
997
|
-
|
|
1110
|
+
objectRow[table.schema.fields[i].name] = table.data[table.schema.fields[i].name][rowIndex];
|
|
998
1111
|
}
|
|
999
|
-
return
|
|
1112
|
+
return objectRow;
|
|
1000
1113
|
} else {
|
|
1001
|
-
const
|
|
1114
|
+
const objectRow = target || {};
|
|
1002
1115
|
for (const [name, column] of Object.entries(table.data)) {
|
|
1003
|
-
|
|
1116
|
+
objectRow[name] = column[rowIndex];
|
|
1004
1117
|
}
|
|
1005
|
-
return
|
|
1006
|
-
}
|
|
1007
|
-
case "arrow-table":
|
|
1008
|
-
const arrowTable = table.data;
|
|
1009
|
-
const objectRow = target || {};
|
|
1010
|
-
const row = arrowTable.get(rowIndex);
|
|
1011
|
-
const schema = arrowTable.schema;
|
|
1012
|
-
for (let i = 0; i < schema.fields.length; i++) {
|
|
1013
|
-
objectRow[schema.fields[i].name] = row?.[schema.fields[i].name];
|
|
1118
|
+
return objectRow;
|
|
1014
1119
|
}
|
|
1015
|
-
return objectRow;
|
|
1016
1120
|
default:
|
|
1017
1121
|
throw new Error("shape");
|
|
1018
1122
|
}
|
|
1019
1123
|
}
|
|
1020
1124
|
function getTableRowAsArray(table, rowIndex, target, copy) {
|
|
1125
|
+
if (!("shape" in table)) {
|
|
1126
|
+
const arrayRow = target || [];
|
|
1127
|
+
const row = table.get(rowIndex);
|
|
1128
|
+
table.schema.fields.forEach((field, columnIndex) => {
|
|
1129
|
+
arrayRow[columnIndex] = row?.[field.name];
|
|
1130
|
+
});
|
|
1131
|
+
return arrayRow;
|
|
1132
|
+
}
|
|
1021
1133
|
switch (table.shape) {
|
|
1022
1134
|
case "array-row-table":
|
|
1023
1135
|
return copy ? Array.from(table.data[rowIndex]) : table.data[rowIndex];
|
|
1024
1136
|
case "object-row-table":
|
|
1025
1137
|
if (table.schema) {
|
|
1026
|
-
const
|
|
1138
|
+
const arrayRow = target || [];
|
|
1027
1139
|
for (let i = 0; i < table.schema.fields.length; i++) {
|
|
1028
|
-
|
|
1140
|
+
arrayRow[i] = table.data[rowIndex][table.schema.fields[i].name];
|
|
1029
1141
|
}
|
|
1030
|
-
return
|
|
1142
|
+
return arrayRow;
|
|
1031
1143
|
}
|
|
1032
1144
|
return Object.values(table.data[rowIndex]);
|
|
1033
1145
|
case "geojson-table":
|
|
1034
1146
|
if (table.schema) {
|
|
1035
|
-
const
|
|
1147
|
+
const arrayRow = target || [];
|
|
1036
1148
|
for (let i = 0; i < table.schema.fields.length; i++) {
|
|
1037
|
-
|
|
1149
|
+
arrayRow[i] = table.features[rowIndex][table.schema.fields[i].name];
|
|
1038
1150
|
}
|
|
1039
|
-
return
|
|
1151
|
+
return arrayRow;
|
|
1040
1152
|
}
|
|
1041
1153
|
return Object.values(table.features[rowIndex]);
|
|
1042
1154
|
case "columnar-table":
|
|
1043
1155
|
if (table.schema) {
|
|
1044
|
-
const
|
|
1156
|
+
const arrayRow = target || [];
|
|
1045
1157
|
for (let i = 0; i < table.schema.fields.length; i++) {
|
|
1046
|
-
|
|
1158
|
+
arrayRow[i] = table.data[table.schema.fields[i].name][rowIndex];
|
|
1047
1159
|
}
|
|
1048
|
-
return
|
|
1160
|
+
return arrayRow;
|
|
1049
1161
|
} else {
|
|
1050
|
-
const
|
|
1162
|
+
const arrayRow = target || [];
|
|
1051
1163
|
let i = 0;
|
|
1052
1164
|
for (const column of Object.values(table.data)) {
|
|
1053
|
-
|
|
1165
|
+
arrayRow[i] = column[rowIndex];
|
|
1054
1166
|
i++;
|
|
1055
1167
|
}
|
|
1056
|
-
return
|
|
1057
|
-
}
|
|
1058
|
-
case "arrow-table":
|
|
1059
|
-
const arrowTable = table.data;
|
|
1060
|
-
const arrayRow = target || [];
|
|
1061
|
-
const row = arrowTable.get(rowIndex);
|
|
1062
|
-
const schema = arrowTable.schema;
|
|
1063
|
-
for (let i = 0; i < schema.fields.length; i++) {
|
|
1064
|
-
arrayRow[i] = row?.[schema.fields[i].name];
|
|
1168
|
+
return arrayRow;
|
|
1065
1169
|
}
|
|
1066
|
-
return arrayRow;
|
|
1067
1170
|
default:
|
|
1068
1171
|
throw new Error("shape");
|
|
1069
1172
|
}
|
|
@@ -1100,8 +1203,15 @@ async function makeTableFromBatches(batchIterator) {
|
|
|
1100
1203
|
let features;
|
|
1101
1204
|
let shape = null;
|
|
1102
1205
|
let schema;
|
|
1206
|
+
const arrowBatches = [];
|
|
1103
1207
|
for await (const batch of batchIterator) {
|
|
1104
|
-
|
|
1208
|
+
const batchShape = isArrowRecordBatch(batch) ? "arrow" : batch.shape;
|
|
1209
|
+
shape ??= batchShape;
|
|
1210
|
+
if (shape !== batchShape) throw new Error("Batches must have the same shape");
|
|
1211
|
+
if (isArrowRecordBatch(batch)) {
|
|
1212
|
+
arrowBatches.push(batch);
|
|
1213
|
+
continue;
|
|
1214
|
+
}
|
|
1105
1215
|
schema = schema || batch.schema;
|
|
1106
1216
|
switch (batch.shape) {
|
|
1107
1217
|
case "array-row-table":
|
|
@@ -1126,7 +1236,6 @@ async function makeTableFromBatches(batchIterator) {
|
|
|
1126
1236
|
}
|
|
1127
1237
|
break;
|
|
1128
1238
|
case "columnar-table":
|
|
1129
|
-
case "arrow-table":
|
|
1130
1239
|
default:
|
|
1131
1240
|
throw new Error("shape");
|
|
1132
1241
|
}
|
|
@@ -1135,6 +1244,8 @@ async function makeTableFromBatches(batchIterator) {
|
|
|
1135
1244
|
return null;
|
|
1136
1245
|
}
|
|
1137
1246
|
switch (shape) {
|
|
1247
|
+
case "arrow":
|
|
1248
|
+
return makeArrowTableFromBatches(arrowBatches);
|
|
1138
1249
|
case "array-row-table":
|
|
1139
1250
|
return { shape: "array-row-table", data: arrayRows, schema };
|
|
1140
1251
|
case "object-row-table":
|
|
@@ -1157,20 +1268,28 @@ var arrow4 = __toESM(require("apache-arrow"), 1);
|
|
|
1157
1268
|
|
|
1158
1269
|
// src/schema-utils/lib/table/batches/make-arrow-batch-iterator.ts
|
|
1159
1270
|
var arrow3 = __toESM(require("apache-arrow"), 1);
|
|
1160
|
-
function*
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1271
|
+
function* sliceNativeArrowBatches(table, batchSize) {
|
|
1272
|
+
if (batchSize !== void 0 && (!Number.isSafeInteger(batchSize) || batchSize < 1)) {
|
|
1273
|
+
throw new RangeError("batchSize must be a positive integer");
|
|
1274
|
+
}
|
|
1275
|
+
for (const batch of table.batches) {
|
|
1276
|
+
if (batchSize === void 0 || batch.numRows <= batchSize) {
|
|
1277
|
+
yield batch;
|
|
1278
|
+
} else {
|
|
1279
|
+
for (let offset = 0; offset < batch.numRows; offset += batchSize) {
|
|
1280
|
+
yield batch.slice(offset, offset + batchSize);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1171
1283
|
}
|
|
1172
1284
|
}
|
|
1173
1285
|
function* makeArrowRecordBatchIterator(table, options) {
|
|
1286
|
+
if (!("shape" in table)) {
|
|
1287
|
+
yield* sliceNativeArrowBatches(table, options?.batchSize);
|
|
1288
|
+
return;
|
|
1289
|
+
}
|
|
1290
|
+
yield* makePortableTableRecordBatchIterator(table, options);
|
|
1291
|
+
}
|
|
1292
|
+
function* makePortableTableRecordBatchIterator(table, options) {
|
|
1174
1293
|
const arrowSchema = convertSchemaToArrow(table.schema);
|
|
1175
1294
|
const length = getTableLength(table);
|
|
1176
1295
|
const numColumns = getTableNumCols(table);
|
|
@@ -1208,22 +1327,16 @@ function* makeArrowRecordBatchIterator(table, options) {
|
|
|
1208
1327
|
|
|
1209
1328
|
// src/schema-utils/lib/table/tables/convert-arrow-table.ts
|
|
1210
1329
|
function convertTableToArrow(table, options) {
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
// return convertColumnarTableToArrow(table, options);
|
|
1217
|
-
// fall through
|
|
1218
|
-
default:
|
|
1219
|
-
const arrowBatchIterator = makeArrowRecordBatchIterator(table, options);
|
|
1220
|
-
return new arrow4.Table(arrowBatchIterator);
|
|
1221
|
-
}
|
|
1330
|
+
if (!("shape" in table)) return table;
|
|
1331
|
+
const schema = table.schema ?? deduceTableSchema(table);
|
|
1332
|
+
return new arrow4.Table(convertSchemaToArrow(schema), [
|
|
1333
|
+
...makePortableTableRecordBatchIterator({ ...table, schema }, options)
|
|
1334
|
+
]);
|
|
1222
1335
|
}
|
|
1223
1336
|
function convertArrowToTable(arrowTable, shape) {
|
|
1224
1337
|
switch (shape) {
|
|
1225
|
-
case "arrow
|
|
1226
|
-
return
|
|
1338
|
+
case "arrow":
|
|
1339
|
+
return arrowTable;
|
|
1227
1340
|
case "array-row-table":
|
|
1228
1341
|
return convertArrowToArrayRowTable(arrowTable);
|
|
1229
1342
|
case "object-row-table":
|
|
@@ -1236,13 +1349,6 @@ function convertArrowToTable(arrowTable, shape) {
|
|
|
1236
1349
|
throw new Error(shape);
|
|
1237
1350
|
}
|
|
1238
1351
|
}
|
|
1239
|
-
function convertArrowToArrowTable(arrowTable) {
|
|
1240
|
-
return {
|
|
1241
|
-
shape: "arrow-table",
|
|
1242
|
-
schema: convertArrowToSchema(arrowTable.schema),
|
|
1243
|
-
data: arrowTable
|
|
1244
|
-
};
|
|
1245
|
-
}
|
|
1246
1352
|
function convertArrowToArrayRowTable(arrowTable) {
|
|
1247
1353
|
const columnarTable = convertArrowToColumnarTable(arrowTable);
|
|
1248
1354
|
return convertTable(columnarTable, "array-row-table");
|
|
@@ -1282,6 +1388,8 @@ function convertArrowToGeoJSONTable(arrowTable) {
|
|
|
1282
1388
|
|
|
1283
1389
|
// src/schema-utils/lib/table/tables/convert-table.ts
|
|
1284
1390
|
function convertTable(table, shape) {
|
|
1391
|
+
if (shape === "arrow") return convertTableToArrow(table);
|
|
1392
|
+
if (!("shape" in table)) return convertArrowToTable(table, shape);
|
|
1285
1393
|
switch (shape) {
|
|
1286
1394
|
case "object-row-table":
|
|
1287
1395
|
return convertToObjectRowTable(table);
|
|
@@ -1289,8 +1397,6 @@ function convertTable(table, shape) {
|
|
|
1289
1397
|
return convertToArrayRowTable(table);
|
|
1290
1398
|
case "columnar-table":
|
|
1291
1399
|
return convertToColumnarTable(table);
|
|
1292
|
-
case "arrow-table":
|
|
1293
|
-
return convertToArrowTable(table);
|
|
1294
1400
|
default:
|
|
1295
1401
|
throw new Error(shape);
|
|
1296
1402
|
}
|
|
@@ -1346,15 +1452,6 @@ function convertToObjectRowTable(table) {
|
|
|
1346
1452
|
data
|
|
1347
1453
|
};
|
|
1348
1454
|
}
|
|
1349
|
-
function convertToArrowTable(table) {
|
|
1350
|
-
const schema = table.schema || deduceTableSchema(table);
|
|
1351
|
-
const arrowTable = convertTableToArrow({ ...table, schema });
|
|
1352
|
-
return {
|
|
1353
|
-
shape: "arrow-table",
|
|
1354
|
-
schema,
|
|
1355
|
-
data: arrowTable
|
|
1356
|
-
};
|
|
1357
|
-
}
|
|
1358
1455
|
|
|
1359
1456
|
// src/schema-utils/lib/table/tables/table-converter/convert-tables.ts
|
|
1360
1457
|
function convertTables(table, shape) {
|
|
@@ -1365,8 +1462,8 @@ function convertTables(table, shape) {
|
|
|
1365
1462
|
return convertTable(table, "array-row-table");
|
|
1366
1463
|
case "columnar-table":
|
|
1367
1464
|
return convertTable(table, "columnar-table");
|
|
1368
|
-
case "arrow
|
|
1369
|
-
return convertTable(table, "arrow
|
|
1465
|
+
case "arrow":
|
|
1466
|
+
return convertTable(table, "arrow");
|
|
1370
1467
|
default:
|
|
1371
1468
|
throw new Error(`Unsupported table conversion target: ${shape}`);
|
|
1372
1469
|
}
|
|
@@ -1375,13 +1472,14 @@ function convertTables(table, shape) {
|
|
|
1375
1472
|
// src/schema-utils/lib/table/tables/table-converter/table-converter.ts
|
|
1376
1473
|
var TableConverter = {
|
|
1377
1474
|
id: "table",
|
|
1378
|
-
from: ["object-row-table", "array-row-table", "columnar-table", "arrow
|
|
1379
|
-
to: ["object-row-table", "array-row-table", "columnar-table", "arrow
|
|
1475
|
+
from: ["object-row-table", "array-row-table", "columnar-table", "arrow"],
|
|
1476
|
+
to: ["object-row-table", "array-row-table", "columnar-table", "arrow"],
|
|
1380
1477
|
canConvert(sourceShape, targetShape) {
|
|
1381
1478
|
return sourceShape !== targetShape;
|
|
1382
1479
|
},
|
|
1383
1480
|
detectInputShape(input) {
|
|
1384
|
-
if (
|
|
1481
|
+
if (isArrowTable(input)) return "arrow";
|
|
1482
|
+
if (typeof input === "object" && input !== null && "shape" in input && typeof input.shape === "string" && ["object-row-table", "array-row-table", "columnar-table"].includes(input.shape)) {
|
|
1385
1483
|
return input.shape;
|
|
1386
1484
|
}
|
|
1387
1485
|
return null;
|
|
@@ -1394,8 +1492,8 @@ var TableConverter = {
|
|
|
1394
1492
|
return convertTables(input, "array-row-table");
|
|
1395
1493
|
case "columnar-table":
|
|
1396
1494
|
return convertTables(input, "columnar-table");
|
|
1397
|
-
case "arrow
|
|
1398
|
-
return convertTables(input, "arrow
|
|
1495
|
+
case "arrow":
|
|
1496
|
+
return convertTables(input, "arrow");
|
|
1399
1497
|
default:
|
|
1400
1498
|
throw new Error(`Unsupported table conversion target: ${targetShape}`);
|
|
1401
1499
|
}
|
|
@@ -1415,7 +1513,7 @@ function convertToObjectRow(arrayRow, headers) {
|
|
|
1415
1513
|
}
|
|
1416
1514
|
} else {
|
|
1417
1515
|
for (let i = 0; i < arrayRow.length; i++) {
|
|
1418
|
-
const columnName = `column
|
|
1516
|
+
const columnName = `column${i + 1}`;
|
|
1419
1517
|
objectRow[columnName] = arrayRow[i];
|
|
1420
1518
|
}
|
|
1421
1519
|
}
|
|
@@ -1437,7 +1535,7 @@ function convertToArrayRow(objectRow, headers) {
|
|
|
1437
1535
|
function inferHeadersFromArrayRow(arrayRow) {
|
|
1438
1536
|
const headers = [];
|
|
1439
1537
|
for (let i = 0; i < arrayRow.length; i++) {
|
|
1440
|
-
const columnName = `column
|
|
1538
|
+
const columnName = `column${i + 1}`;
|
|
1441
1539
|
headers.push(columnName);
|
|
1442
1540
|
}
|
|
1443
1541
|
return headers;
|
|
@@ -1474,7 +1572,7 @@ function makeBatchFromTable(table) {
|
|
|
1474
1572
|
// src/schema-utils/lib/table/query-arrow-table.ts
|
|
1475
1573
|
var arrow5 = __toESM(require("apache-arrow"), 1);
|
|
1476
1574
|
function queryArrowTable(table, options = {}, filterRows) {
|
|
1477
|
-
const availableColumns = table.
|
|
1575
|
+
const availableColumns = table.schema.fields.map((field) => field.name);
|
|
1478
1576
|
const selectedColumns = options.columns ? [...options.columns] : availableColumns;
|
|
1479
1577
|
for (const columnName of selectedColumns) {
|
|
1480
1578
|
if (!availableColumns.includes(columnName)) {
|
|
@@ -1485,22 +1583,15 @@ function queryArrowTable(table, options = {}, filterRows) {
|
|
|
1485
1583
|
if (options.predicate !== void 0) {
|
|
1486
1584
|
if (!filterRows) throw new Error("Arrow table query requires a predicate evaluator.");
|
|
1487
1585
|
const columns = Object.fromEntries(
|
|
1488
|
-
availableColumns.map((name) => [name, [...table.
|
|
1586
|
+
availableColumns.map((name) => [name, [...table.getChild(name) || []]])
|
|
1489
1587
|
);
|
|
1490
|
-
rowIndices = filterRows(options.predicate, columns, table.
|
|
1588
|
+
rowIndices = filterRows(options.predicate, columns, table.numRows);
|
|
1491
1589
|
}
|
|
1492
1590
|
const limitedRowIndices = rowIndices ? rowIndices.slice(0, options.limit ?? Number.POSITIVE_INFINITY) : void 0;
|
|
1493
|
-
|
|
1494
|
-
const schema = table.schema ? {
|
|
1495
|
-
...table.schema,
|
|
1496
|
-
fields: selectedColumns.flatMap(
|
|
1497
|
-
(columnName) => table.schema?.fields.filter((field) => field.name === columnName) || []
|
|
1498
|
-
)
|
|
1499
|
-
} : void 0;
|
|
1500
|
-
return schema ? { shape: "arrow-table", schema, data } : { shape: "arrow-table", data };
|
|
1591
|
+
return limitedRowIndices ? createArrowTableFromRowIndices(table, selectedColumns, limitedRowIndices) : table.select(selectedColumns).slice(0, options.limit ?? Number.POSITIVE_INFINITY);
|
|
1501
1592
|
}
|
|
1502
1593
|
function selectArrowTableRows(table, rowIndices, columns, limit) {
|
|
1503
|
-
const availableColumns = table.
|
|
1594
|
+
const availableColumns = table.schema.fields.map((field) => field.name);
|
|
1504
1595
|
const selectedColumns = columns ? [...columns] : availableColumns;
|
|
1505
1596
|
for (const columnName of selectedColumns) {
|
|
1506
1597
|
if (!availableColumns.includes(columnName)) {
|
|
@@ -1508,20 +1599,14 @@ function selectArrowTableRows(table, rowIndices, columns, limit) {
|
|
|
1508
1599
|
}
|
|
1509
1600
|
}
|
|
1510
1601
|
const limitedRowIndices = rowIndices.slice(0, limit ?? Number.POSITIVE_INFINITY);
|
|
1511
|
-
|
|
1512
|
-
const schema = table.schema ? {
|
|
1513
|
-
...table.schema,
|
|
1514
|
-
fields: selectedColumns.flatMap(
|
|
1515
|
-
(columnName) => table.schema?.fields.filter((field) => field.name === columnName) || []
|
|
1516
|
-
)
|
|
1517
|
-
} : void 0;
|
|
1518
|
-
return schema ? { shape: "arrow-table", schema, data } : { shape: "arrow-table", data };
|
|
1602
|
+
return createArrowTableFromRowIndices(table, selectedColumns, limitedRowIndices);
|
|
1519
1603
|
}
|
|
1520
1604
|
function createArrowTableFromRowIndices(sourceData, selectedColumns, rowIndices) {
|
|
1521
1605
|
const schema = new arrow5.Schema(
|
|
1522
1606
|
selectedColumns.map(
|
|
1523
1607
|
(columnName) => sourceData.schema.fields.find((field) => field.name === columnName)
|
|
1524
|
-
)
|
|
1608
|
+
),
|
|
1609
|
+
sourceData.schema.metadata
|
|
1525
1610
|
);
|
|
1526
1611
|
const vectors = Object.fromEntries(
|
|
1527
1612
|
selectedColumns.map((columnName) => {
|
|
@@ -1549,6 +1634,10 @@ function createArrowTableFromRowIndices(sourceData, selectedColumns, rowIndices)
|
|
|
1549
1634
|
|
|
1550
1635
|
// src/schema-utils/lib/table/batches/convert-batches.ts
|
|
1551
1636
|
function convertBatch(batch, shape) {
|
|
1637
|
+
if (isArrowRecordBatch(batch)) {
|
|
1638
|
+
if (shape === "arrow") return batch;
|
|
1639
|
+
throw new Error("Convert a native RecordBatch as a table to select a row or column layout");
|
|
1640
|
+
}
|
|
1552
1641
|
switch (shape) {
|
|
1553
1642
|
case "object-row-table":
|
|
1554
1643
|
return { ...batch, ...convertTable(batch, "object-row-table") };
|
|
@@ -1556,14 +1645,21 @@ function convertBatch(batch, shape) {
|
|
|
1556
1645
|
return { ...batch, ...convertTable(batch, "array-row-table") };
|
|
1557
1646
|
case "columnar-table":
|
|
1558
1647
|
return { ...batch, ...convertTable(batch, "columnar-table") };
|
|
1559
|
-
case "arrow
|
|
1560
|
-
|
|
1648
|
+
case "arrow": {
|
|
1649
|
+
const table = convertTable(batch, "arrow");
|
|
1650
|
+
return table.batches[0] ?? makeArrowMetadataBatch(table.schema);
|
|
1651
|
+
}
|
|
1561
1652
|
default:
|
|
1562
1653
|
throw new Error(shape);
|
|
1563
1654
|
}
|
|
1564
1655
|
}
|
|
1565
1656
|
async function* convertBatches(batches, shape) {
|
|
1566
1657
|
for await (const batch of batches) {
|
|
1658
|
+
if (isArrowRecordBatch(batch)) {
|
|
1659
|
+
if (shape !== "arrow") throw new Error("Expected a loaders.gl table batch");
|
|
1660
|
+
yield batch;
|
|
1661
|
+
continue;
|
|
1662
|
+
}
|
|
1567
1663
|
switch (shape) {
|
|
1568
1664
|
case "object-row-table":
|
|
1569
1665
|
yield convertBatch(batch, "object-row-table");
|
|
@@ -1574,9 +1670,12 @@ async function* convertBatches(batches, shape) {
|
|
|
1574
1670
|
case "columnar-table":
|
|
1575
1671
|
yield convertBatch(batch, "columnar-table");
|
|
1576
1672
|
break;
|
|
1577
|
-
case "arrow
|
|
1578
|
-
|
|
1673
|
+
case "arrow": {
|
|
1674
|
+
const table = convertTable(batch, "arrow");
|
|
1675
|
+
if (table.batches.length) yield* table.batches;
|
|
1676
|
+
else yield makeArrowMetadataBatch(table.schema);
|
|
1579
1677
|
break;
|
|
1678
|
+
}
|
|
1580
1679
|
default:
|
|
1581
1680
|
throw new Error(shape);
|
|
1582
1681
|
}
|
|
@@ -1596,343 +1695,107 @@ function isColumnarTable(table) {
|
|
|
1596
1695
|
function isGeoJSONTable(table) {
|
|
1597
1696
|
return table.shape === "geojson-table";
|
|
1598
1697
|
}
|
|
1599
|
-
function isArrowTable(table) {
|
|
1600
|
-
return table.shape === "arrow-table";
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
|
-
// src/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.ts
|
|
1604
|
-
var DEFAULT_ROW_COUNT = 100;
|
|
1605
|
-
var BaseTableBatchAggregator = class {
|
|
1606
|
-
schema;
|
|
1607
|
-
options;
|
|
1608
|
-
shape;
|
|
1609
|
-
length = 0;
|
|
1610
|
-
rows = null;
|
|
1611
|
-
cursor = 0;
|
|
1612
|
-
_headers = [];
|
|
1613
|
-
constructor(schema, options) {
|
|
1614
|
-
this.options = options;
|
|
1615
|
-
this.schema = schema;
|
|
1616
|
-
if (!Array.isArray(schema)) {
|
|
1617
|
-
this._headers = [];
|
|
1618
|
-
for (const key in schema) {
|
|
1619
|
-
this._headers[schema[key].index] = schema[key].name;
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
rowCount() {
|
|
1624
|
-
return this.length;
|
|
1625
|
-
}
|
|
1626
|
-
addArrayRow(row, cursor) {
|
|
1627
|
-
if (Number.isFinite(cursor)) {
|
|
1628
|
-
this.cursor = cursor;
|
|
1629
|
-
}
|
|
1630
|
-
this.shape = "array-row-table";
|
|
1631
|
-
this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
|
|
1632
|
-
this.rows[this.length] = row;
|
|
1633
|
-
this.length++;
|
|
1634
|
-
}
|
|
1635
|
-
addObjectRow(row, cursor) {
|
|
1636
|
-
if (Number.isFinite(cursor)) {
|
|
1637
|
-
this.cursor = cursor;
|
|
1638
|
-
}
|
|
1639
|
-
this.shape = "object-row-table";
|
|
1640
|
-
this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
|
|
1641
|
-
this.rows[this.length] = row;
|
|
1642
|
-
this.length++;
|
|
1643
|
-
}
|
|
1644
|
-
getBatch() {
|
|
1645
|
-
let rows = this.rows;
|
|
1646
|
-
if (!rows) {
|
|
1647
|
-
return null;
|
|
1648
|
-
}
|
|
1649
|
-
rows = rows.slice(0, this.length);
|
|
1650
|
-
this.rows = null;
|
|
1651
|
-
const batch = {
|
|
1652
|
-
shape: this.shape || "array-row-table",
|
|
1653
|
-
batchType: "data",
|
|
1654
|
-
data: rows,
|
|
1655
|
-
length: this.length,
|
|
1656
|
-
schema: this.schema,
|
|
1657
|
-
cursor: this.cursor
|
|
1658
|
-
};
|
|
1659
|
-
return batch;
|
|
1660
|
-
}
|
|
1661
|
-
};
|
|
1662
1698
|
|
|
1663
|
-
// src/schema-utils/lib/table/batch-builder/
|
|
1664
|
-
var
|
|
1665
|
-
var RowTableBatchAggregator = class {
|
|
1666
|
-
schema;
|
|
1667
|
-
options;
|
|
1668
|
-
length = 0;
|
|
1669
|
-
objectRows = null;
|
|
1670
|
-
arrayRows = null;
|
|
1671
|
-
cursor = 0;
|
|
1672
|
-
_headers = null;
|
|
1673
|
-
constructor(schema, options) {
|
|
1674
|
-
this.options = options;
|
|
1675
|
-
this.schema = schema;
|
|
1676
|
-
if (schema) {
|
|
1677
|
-
this._headers = [];
|
|
1678
|
-
for (let i = 0; i < schema.fields.length; i++) {
|
|
1679
|
-
this._headers[i] = schema.fields[i].name;
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
rowCount() {
|
|
1684
|
-
return this.length;
|
|
1685
|
-
}
|
|
1686
|
-
addArrayRow(row, cursor) {
|
|
1687
|
-
if (Number.isFinite(cursor)) {
|
|
1688
|
-
this.cursor = cursor;
|
|
1689
|
-
}
|
|
1690
|
-
this._headers ||= inferHeadersFromArrayRow(row);
|
|
1691
|
-
switch (this.options.shape) {
|
|
1692
|
-
case "object-row-table":
|
|
1693
|
-
const rowObject = convertToObjectRow(row, this._headers);
|
|
1694
|
-
this.addObjectRow(rowObject, cursor);
|
|
1695
|
-
break;
|
|
1696
|
-
case "array-row-table":
|
|
1697
|
-
this.arrayRows = this.arrayRows || new Array(DEFAULT_ROW_COUNT2);
|
|
1698
|
-
this.arrayRows[this.length] = row;
|
|
1699
|
-
this.length++;
|
|
1700
|
-
break;
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
addObjectRow(row, cursor) {
|
|
1704
|
-
if (Number.isFinite(cursor)) {
|
|
1705
|
-
this.cursor = cursor;
|
|
1706
|
-
}
|
|
1707
|
-
this._headers ||= inferHeadersFromObjectRow(row);
|
|
1708
|
-
switch (this.options.shape) {
|
|
1709
|
-
case "array-row-table":
|
|
1710
|
-
const rowArray = convertToArrayRow(row, this._headers);
|
|
1711
|
-
this.addArrayRow(rowArray, cursor);
|
|
1712
|
-
break;
|
|
1713
|
-
case "object-row-table":
|
|
1714
|
-
this.objectRows = this.objectRows || new Array(DEFAULT_ROW_COUNT2);
|
|
1715
|
-
this.objectRows[this.length] = row;
|
|
1716
|
-
this.length++;
|
|
1717
|
-
break;
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
getBatch() {
|
|
1721
|
-
let rows = this.arrayRows || this.objectRows;
|
|
1722
|
-
if (!rows) {
|
|
1723
|
-
return null;
|
|
1724
|
-
}
|
|
1725
|
-
rows = rows.slice(0, this.length);
|
|
1726
|
-
this.arrayRows = null;
|
|
1727
|
-
this.objectRows = null;
|
|
1728
|
-
return {
|
|
1729
|
-
shape: this.options.shape,
|
|
1730
|
-
batchType: "data",
|
|
1731
|
-
data: rows,
|
|
1732
|
-
length: this.length,
|
|
1733
|
-
// @ts-expect-error we should infer a schema
|
|
1734
|
-
schema: this.schema,
|
|
1735
|
-
cursor: this.cursor
|
|
1736
|
-
};
|
|
1737
|
-
}
|
|
1738
|
-
};
|
|
1699
|
+
// src/schema-utils/lib/table/batch-builder/table-batch-builder.ts
|
|
1700
|
+
var import_apache_arrow = require("apache-arrow");
|
|
1739
1701
|
|
|
1740
|
-
// src/schema-utils/lib/table/batch-builder/
|
|
1741
|
-
var
|
|
1742
|
-
var
|
|
1702
|
+
// src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts
|
|
1703
|
+
var arrow6 = __toESM(require("apache-arrow"), 1);
|
|
1704
|
+
var ArrowTableBuilder = class {
|
|
1743
1705
|
schema;
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1706
|
+
arrowSchema;
|
|
1707
|
+
arrowBuilders;
|
|
1708
|
+
length;
|
|
1747
1709
|
constructor(schema, options) {
|
|
1748
|
-
this.
|
|
1749
|
-
this.
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
addArrayRow(row) {
|
|
1755
|
-
this._reallocateColumns();
|
|
1756
|
-
let i = 0;
|
|
1757
|
-
for (const fieldName in this.columns) {
|
|
1758
|
-
this.columns[fieldName][this.length] = row[i++];
|
|
1759
|
-
}
|
|
1760
|
-
this.length++;
|
|
1710
|
+
this.arrowSchema = convertSchemaToArrow(schema, options);
|
|
1711
|
+
this.schema = options?.viewTypes && options.viewTypes !== "never" ? convertArrowToSchema(this.arrowSchema) : schema;
|
|
1712
|
+
this.arrowBuilders = this.arrowSchema.fields.map(
|
|
1713
|
+
(field) => arrow6.makeBuilder({ type: field.type, nullValues: [null, void 0] })
|
|
1714
|
+
);
|
|
1715
|
+
this.length = 0;
|
|
1761
1716
|
}
|
|
1762
1717
|
addObjectRow(row) {
|
|
1763
|
-
this.
|
|
1764
|
-
|
|
1765
|
-
|
|
1718
|
+
for (let i = 0; i < this.arrowBuilders.length; i++) {
|
|
1719
|
+
const columnName = this.schema.fields[i].name;
|
|
1720
|
+
const value = row[columnName];
|
|
1721
|
+
this.arrowBuilders[i].append(value);
|
|
1766
1722
|
}
|
|
1767
1723
|
this.length++;
|
|
1768
1724
|
}
|
|
1769
|
-
|
|
1770
|
-
this.
|
|
1771
|
-
|
|
1772
|
-
shape: "columnar-table",
|
|
1773
|
-
batchType: "data",
|
|
1774
|
-
data: this.columns,
|
|
1775
|
-
schema: this.schema,
|
|
1776
|
-
length: this.length
|
|
1777
|
-
};
|
|
1778
|
-
return batch;
|
|
1779
|
-
}
|
|
1780
|
-
// HELPERS
|
|
1781
|
-
_reallocateColumns() {
|
|
1782
|
-
if (this.length < this.allocated) {
|
|
1783
|
-
return;
|
|
1784
|
-
}
|
|
1785
|
-
this.allocated = this.allocated > 0 ? this.allocated * 2 : DEFAULT_ROW_COUNT3;
|
|
1786
|
-
this.columns = {};
|
|
1787
|
-
for (const field of this.schema.fields) {
|
|
1788
|
-
const ArrayType = getArrayTypeFromDataType(field.type, field.nullable);
|
|
1789
|
-
const oldColumn = this.columns[field.name];
|
|
1790
|
-
if (!oldColumn) {
|
|
1791
|
-
this.columns[field.name] = new ArrayType(this.allocated);
|
|
1792
|
-
} else if (Array.isArray(oldColumn)) {
|
|
1793
|
-
oldColumn.length = this.allocated;
|
|
1794
|
-
} else if (ArrayBuffer.isView(oldColumn) && !(oldColumn instanceof DataView)) {
|
|
1795
|
-
const typedArray = new ArrayType(this.allocated);
|
|
1796
|
-
typedArray.set(oldColumn);
|
|
1797
|
-
this.columns[field.name] = typedArray;
|
|
1798
|
-
} else {
|
|
1799
|
-
throw new Error("Invalid column type");
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
}
|
|
1803
|
-
_pruneColumns() {
|
|
1804
|
-
for (const [columnName, column] of Object.entries(this.columns)) {
|
|
1805
|
-
this.columns[columnName] = column.slice(0, this.length);
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
};
|
|
1809
|
-
|
|
1810
|
-
// src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.ts
|
|
1811
|
-
var arrow6 = __toESM(require("apache-arrow"), 1);
|
|
1812
|
-
var ArrowTableBatchAggregator = class extends ColumnarTableBatchAggregator {
|
|
1813
|
-
arrowSchema;
|
|
1814
|
-
constructor(schema, options) {
|
|
1815
|
-
super(schema, options);
|
|
1816
|
-
this.arrowSchema = null;
|
|
1817
|
-
}
|
|
1818
|
-
getBatch() {
|
|
1819
|
-
const batch = super.getBatch();
|
|
1820
|
-
if (batch) {
|
|
1821
|
-
this.arrowSchema = this.arrowSchema || getArrowSchema(batch.schema);
|
|
1822
|
-
const arrowVectors = getArrowVectors(this.arrowSchema, batch.data);
|
|
1823
|
-
const recordBatch = new arrow6.RecordBatch(
|
|
1824
|
-
this.arrowSchema,
|
|
1825
|
-
arrow6.makeData({
|
|
1826
|
-
type: new arrow6.Struct(this.arrowSchema.fields),
|
|
1827
|
-
children: arrowVectors.map(({ data }) => data[0])
|
|
1828
|
-
})
|
|
1829
|
-
);
|
|
1830
|
-
return {
|
|
1831
|
-
shape: "arrow-table",
|
|
1832
|
-
batchType: "data",
|
|
1833
|
-
data: new arrow6.Table([recordBatch]),
|
|
1834
|
-
length: batch.length
|
|
1835
|
-
};
|
|
1725
|
+
addArrayRow(row) {
|
|
1726
|
+
for (let i = 0; i < this.arrowBuilders.length; i++) {
|
|
1727
|
+
this.arrowBuilders[i].append(row[i]);
|
|
1836
1728
|
}
|
|
1837
|
-
|
|
1729
|
+
this.length++;
|
|
1838
1730
|
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
const fields = Array.isArray(schema.fields) ? schema.fields : Object.values(schema);
|
|
1843
|
-
for (const field of fields) {
|
|
1844
|
-
if (field.type === "float32" || field.type === Float32Array) {
|
|
1845
|
-
const metadata = /* @__PURE__ */ new Map();
|
|
1846
|
-
const arrowField = new arrow6.Field(field.name, new arrow6.Float32(), field.nullable, metadata);
|
|
1847
|
-
arrowFields.push(arrowField);
|
|
1848
|
-
}
|
|
1731
|
+
/** Emits the declared schema before any rows are buffered. */
|
|
1732
|
+
firstBatch() {
|
|
1733
|
+
return this.length === 0 ? this._getArrowRecordBatch() : null;
|
|
1849
1734
|
}
|
|
1850
|
-
|
|
1851
|
-
|
|
1735
|
+
/** Flushes the buffered rows as a native record batch. */
|
|
1736
|
+
flushBatch() {
|
|
1737
|
+
return this.length === 0 ? null : this._getArrowRecordBatch();
|
|
1852
1738
|
}
|
|
1853
|
-
|
|
1854
|
-
|
|
1739
|
+
/** Finishes the builders and returns the final native batch when it has rows or fields. */
|
|
1740
|
+
finishBatch() {
|
|
1741
|
+
const batch = this._getArrowRecordBatch();
|
|
1742
|
+
this.arrowBuilders.forEach((builder) => builder.finish());
|
|
1743
|
+
return batch.numCols || batch.numRows ? batch : null;
|
|
1855
1744
|
}
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
const vector = data[field.name];
|
|
1862
|
-
if (vector instanceof Float32Array) {
|
|
1863
|
-
const arrowVector = arrow6.makeVector(vector);
|
|
1864
|
-
arrowVectors.push(arrowVector);
|
|
1865
|
-
}
|
|
1745
|
+
/** Finishes the builders and returns a native Arrow table. */
|
|
1746
|
+
finishTable() {
|
|
1747
|
+
const batch = this._getArrowRecordBatch();
|
|
1748
|
+
this.arrowBuilders.forEach((builder) => builder.finish());
|
|
1749
|
+
return new arrow6.Table(batch);
|
|
1866
1750
|
}
|
|
1867
|
-
|
|
1868
|
-
|
|
1751
|
+
/** Extract a record batch flushing the currently accumulated data in the builders */
|
|
1752
|
+
_getArrowRecordBatch() {
|
|
1753
|
+
const { arrowBuilders, arrowSchema } = this;
|
|
1754
|
+
const arrowDatas = arrowBuilders.map((builder) => builder.flush());
|
|
1755
|
+
const length = arrowDatas[0]?.length || this.length;
|
|
1756
|
+
this.length = 0;
|
|
1757
|
+
const structField = new arrow6.Struct(arrowSchema.fields);
|
|
1758
|
+
const arrowStructData = new arrow6.Data(structField, 0, length, 0, void 0, arrowDatas);
|
|
1759
|
+
const arrowRecordBatch = new arrow6.RecordBatch(
|
|
1760
|
+
snapshotArrowSchema(arrowSchema),
|
|
1761
|
+
arrowStructData
|
|
1762
|
+
);
|
|
1763
|
+
return arrowRecordBatch;
|
|
1869
1764
|
}
|
|
1870
|
-
|
|
1871
|
-
}
|
|
1765
|
+
};
|
|
1872
1766
|
|
|
1873
1767
|
// src/schema-utils/lib/table/batch-builder/table-batch-builder.ts
|
|
1874
1768
|
var DEFAULT_OPTIONS = {
|
|
1875
1769
|
shape: void 0,
|
|
1876
|
-
batchSize: "auto"
|
|
1877
|
-
batchDebounceMs: 0,
|
|
1878
|
-
limit: 0,
|
|
1879
|
-
_limitMB: 0
|
|
1770
|
+
batchSize: "auto"
|
|
1880
1771
|
};
|
|
1881
1772
|
var TableBatchBuilder = class {
|
|
1882
1773
|
schema;
|
|
1883
1774
|
options;
|
|
1884
|
-
|
|
1775
|
+
/** Persistent Arrow builders for typed output. */
|
|
1776
|
+
arrowBuilder = null;
|
|
1777
|
+
/** Rows retained for explicit raw output, including schema-less JSON. */
|
|
1778
|
+
rows = [];
|
|
1885
1779
|
batchCount = 0;
|
|
1886
1780
|
bytesUsed = 0;
|
|
1887
1781
|
isChunkComplete = false;
|
|
1888
|
-
lastBatchEmittedMs = Date.now();
|
|
1889
|
-
totalLength = 0;
|
|
1890
|
-
totalBytes = 0;
|
|
1891
|
-
rowBytes = 0;
|
|
1892
|
-
static ArrowBatch;
|
|
1893
1782
|
constructor(schema, options) {
|
|
1894
1783
|
this.schema = schema;
|
|
1895
1784
|
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
1896
1785
|
}
|
|
1897
|
-
limitReached() {
|
|
1898
|
-
if (Boolean(this.options?.limit) && this.totalLength >= this.options.limit) {
|
|
1899
|
-
return true;
|
|
1900
|
-
}
|
|
1901
|
-
if (Boolean(this.options?._limitMB) && this.totalBytes / 1e6 >= this.options._limitMB) {
|
|
1902
|
-
return true;
|
|
1903
|
-
}
|
|
1904
|
-
return false;
|
|
1905
|
-
}
|
|
1906
1786
|
/** @deprecated Use addArrayRow or addObjectRow */
|
|
1907
1787
|
addRow(row) {
|
|
1908
|
-
if (this.
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
this.addArrayRow(row);
|
|
1788
|
+
if (this.options.shape === "columnar-table") {
|
|
1789
|
+
this.arrowBuilder ??= new ArrowTableBuilder(this.schema);
|
|
1790
|
+
if (Array.isArray(row)) {
|
|
1791
|
+
this.arrowBuilder.addArrayRow(row);
|
|
1792
|
+
} else {
|
|
1793
|
+
this.arrowBuilder.addObjectRow(row);
|
|
1794
|
+
}
|
|
1916
1795
|
} else {
|
|
1917
|
-
this.
|
|
1796
|
+
this.rows.push(row);
|
|
1918
1797
|
}
|
|
1919
1798
|
}
|
|
1920
|
-
/** Add one row to the batch */
|
|
1921
|
-
addArrayRow(row) {
|
|
1922
|
-
if (!this.aggregator) {
|
|
1923
|
-
const TableBatchType = this._getTableBatchType();
|
|
1924
|
-
this.aggregator = new TableBatchType(this.schema, this.options);
|
|
1925
|
-
}
|
|
1926
|
-
this.aggregator.addArrayRow(row);
|
|
1927
|
-
}
|
|
1928
|
-
/** Add one row to the batch */
|
|
1929
|
-
addObjectRow(row) {
|
|
1930
|
-
if (!this.aggregator) {
|
|
1931
|
-
const TableBatchType = this._getTableBatchType();
|
|
1932
|
-
this.aggregator = new TableBatchType(this.schema, this.options);
|
|
1933
|
-
}
|
|
1934
|
-
this.aggregator.addObjectRow(row);
|
|
1935
|
-
}
|
|
1936
1799
|
/** Mark an incoming raw memory chunk has completed */
|
|
1937
1800
|
chunkComplete(chunk) {
|
|
1938
1801
|
if (chunk instanceof ArrayBuffer) {
|
|
@@ -1950,57 +1813,73 @@ var TableBatchBuilder = class {
|
|
|
1950
1813
|
return this._getBatch(options);
|
|
1951
1814
|
}
|
|
1952
1815
|
// INTERNAL
|
|
1953
|
-
_estimateRowMB(row) {
|
|
1954
|
-
return Array.isArray(row) ? row.length * 8 : Object.keys(row).length * 8;
|
|
1955
|
-
}
|
|
1956
1816
|
_isFull() {
|
|
1957
|
-
if (
|
|
1817
|
+
if (this.rowCount() === 0) {
|
|
1958
1818
|
return false;
|
|
1959
1819
|
}
|
|
1960
1820
|
if (this.options.batchSize === "auto") {
|
|
1961
1821
|
if (!this.isChunkComplete) {
|
|
1962
1822
|
return false;
|
|
1963
1823
|
}
|
|
1964
|
-
} else if (this.options.batchSize > this.
|
|
1965
|
-
return false;
|
|
1966
|
-
}
|
|
1967
|
-
if (this.options.batchDebounceMs > Date.now() - this.lastBatchEmittedMs) {
|
|
1824
|
+
} else if (this.options.batchSize > this.rowCount()) {
|
|
1968
1825
|
return false;
|
|
1969
1826
|
}
|
|
1970
1827
|
this.isChunkComplete = false;
|
|
1971
|
-
this.lastBatchEmittedMs = Date.now();
|
|
1972
1828
|
return true;
|
|
1973
1829
|
}
|
|
1974
1830
|
/**
|
|
1975
1831
|
* bytesUsed can be set via chunkComplete or via getBatch*
|
|
1976
1832
|
*/
|
|
1977
1833
|
_getBatch(options) {
|
|
1978
|
-
if (
|
|
1834
|
+
if (this.rowCount() === 0) {
|
|
1979
1835
|
return null;
|
|
1980
1836
|
}
|
|
1981
1837
|
if (options?.bytesUsed) {
|
|
1982
1838
|
this.bytesUsed = options.bytesUsed;
|
|
1983
1839
|
}
|
|
1984
|
-
const normalizedBatch = this.
|
|
1840
|
+
const normalizedBatch = this.takeBatch();
|
|
1985
1841
|
normalizedBatch.count = this.batchCount;
|
|
1986
1842
|
normalizedBatch.bytesUsed = this.bytesUsed;
|
|
1987
1843
|
Object.assign(normalizedBatch, options);
|
|
1988
1844
|
this.batchCount++;
|
|
1989
|
-
this.aggregator = null;
|
|
1990
1845
|
return normalizedBatch;
|
|
1991
1846
|
}
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
1847
|
+
/** Returns the number of rows buffered for the next batch. */
|
|
1848
|
+
rowCount() {
|
|
1849
|
+
return this.arrowBuilder?.length ?? this.rows.length;
|
|
1850
|
+
}
|
|
1851
|
+
/** Flushes typed output or takes ownership of the buffered raw rows. */
|
|
1852
|
+
takeBatch() {
|
|
1853
|
+
if (this.arrowBuilder) {
|
|
1854
|
+
const batch = this.arrowBuilder.flushBatch();
|
|
1855
|
+
return {
|
|
1856
|
+
...convertArrowToTable(new import_apache_arrow.Table(batch), "columnar-table"),
|
|
1857
|
+
schema: structuredClone(this.schema),
|
|
1858
|
+
batchType: "data",
|
|
1859
|
+
length: batch.numRows
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
const rows = this.rows;
|
|
1863
|
+
this.rows = [];
|
|
1864
|
+
const shape = this.options.shape ?? (Array.isArray(rows[0]) ? "array-row-table" : "object-row-table");
|
|
1865
|
+
const firstRow = rows[0];
|
|
1866
|
+
const fieldNames = this.schema?.fields.map((field) => field.name) ?? (Array.isArray(firstRow) ? inferHeadersFromArrayRow(firstRow) : inferHeadersFromObjectRow(firstRow));
|
|
1867
|
+
if (shape === "array-row-table") {
|
|
1868
|
+
return {
|
|
1869
|
+
shape,
|
|
1870
|
+
batchType: "data",
|
|
1871
|
+
data: rows.map((row) => Array.isArray(row) ? row : convertToArrayRow(row, fieldNames)),
|
|
1872
|
+
schema: this.schema,
|
|
1873
|
+
length: rows.length
|
|
1874
|
+
};
|
|
2003
1875
|
}
|
|
1876
|
+
return {
|
|
1877
|
+
shape: "object-row-table",
|
|
1878
|
+
batchType: "data",
|
|
1879
|
+
data: rows.map((row) => Array.isArray(row) ? convertToObjectRow(row, fieldNames) : row),
|
|
1880
|
+
schema: this.schema,
|
|
1881
|
+
length: rows.length
|
|
1882
|
+
};
|
|
2004
1883
|
}
|
|
2005
1884
|
};
|
|
2006
1885
|
|
|
@@ -2104,10 +1983,8 @@ var ArrowLikeVector = class {
|
|
|
2104
1983
|
return getTableCell(this.table, rowIndex, this.columnName);
|
|
2105
1984
|
}
|
|
2106
1985
|
toArray() {
|
|
1986
|
+
if (!("shape" in this.table)) return this.table.getChild(this.columnName)?.toArray();
|
|
2107
1987
|
switch (this.table.shape) {
|
|
2108
|
-
case "arrow-table":
|
|
2109
|
-
const arrowTable = this.table.data;
|
|
2110
|
-
return arrowTable.getChild(this.columnName)?.toArray();
|
|
2111
1988
|
case "columnar-table":
|
|
2112
1989
|
return this.table.data[this.columnName];
|
|
2113
1990
|
default:
|
|
@@ -2119,14 +1996,15 @@ var ArrowLikeTable = class {
|
|
|
2119
1996
|
schema;
|
|
2120
1997
|
table;
|
|
2121
1998
|
constructor(table) {
|
|
2122
|
-
const schema = table.schema || deduceTableSchema(table);
|
|
1999
|
+
const schema = "shape" in table ? table.schema || deduceTableSchema(table) : deduceTableSchema(table);
|
|
2123
2000
|
this.schema = new ArrowLikeSchema(schema.fields, schema.metadata);
|
|
2124
|
-
this.table = { ...table, schema };
|
|
2001
|
+
this.table = "shape" in table ? { ...table, schema } : table;
|
|
2125
2002
|
}
|
|
2126
2003
|
// get schema() {
|
|
2127
2004
|
// return this.table.schema;
|
|
2128
2005
|
// }
|
|
2129
2006
|
get data() {
|
|
2007
|
+
if (!("shape" in this.table)) return this.table;
|
|
2130
2008
|
return this.table.shape === "geojson-table" ? this.table.features : this.table.data;
|
|
2131
2009
|
}
|
|
2132
2010
|
get numCols() {
|
|
@@ -2143,17 +2021,7 @@ var ArrowLikeTable = class {
|
|
|
2143
2021
|
// }
|
|
2144
2022
|
};
|
|
2145
2023
|
|
|
2146
|
-
// src/schema-utils/lib/mesh/mesh-
|
|
2147
|
-
function getMeshSize(attributes) {
|
|
2148
|
-
let size = 0;
|
|
2149
|
-
for (const attributeName in attributes) {
|
|
2150
|
-
const attribute = attributes[attributeName];
|
|
2151
|
-
if (ArrayBuffer.isView(attribute)) {
|
|
2152
|
-
size += attribute.byteLength * attribute.BYTES_PER_ELEMENT;
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
return size;
|
|
2156
|
-
}
|
|
2024
|
+
// src/schema-utils/lib/mesh/get-mesh-bounding-box.ts
|
|
2157
2025
|
function getMeshBoundingBox(attributes) {
|
|
2158
2026
|
const positionAttribute = attributes?.POSITION;
|
|
2159
2027
|
if (!positionAttribute || !("value" in positionAttribute) || !positionAttribute.value.length) {
|
|
@@ -2184,6 +2052,18 @@ function getMeshBoundingBox(attributes) {
|
|
|
2184
2052
|
];
|
|
2185
2053
|
}
|
|
2186
2054
|
|
|
2055
|
+
// src/schema-utils/lib/mesh/mesh-utils.ts
|
|
2056
|
+
function getMeshSize(attributes) {
|
|
2057
|
+
let size = 0;
|
|
2058
|
+
for (const attributeName in attributes) {
|
|
2059
|
+
const attribute = attributes[attributeName];
|
|
2060
|
+
if (ArrayBuffer.isView(attribute)) {
|
|
2061
|
+
size += attribute.byteLength * attribute.BYTES_PER_ELEMENT;
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
return size;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2187
2067
|
// src/schema/float16.ts
|
|
2188
2068
|
var import_core2 = require("@math.gl/core");
|
|
2189
2069
|
function createFloat16Array(length) {
|
|
@@ -2313,7 +2193,7 @@ function convertMeshToTable(mesh, shape) {
|
|
|
2313
2193
|
switch (shape) {
|
|
2314
2194
|
case "columnar-table":
|
|
2315
2195
|
return convertMeshToColumnarTable(mesh);
|
|
2316
|
-
case "arrow
|
|
2196
|
+
case "arrow":
|
|
2317
2197
|
return convertMeshToArrowTable(mesh);
|
|
2318
2198
|
default:
|
|
2319
2199
|
throw new Error(shape);
|
|
@@ -2333,7 +2213,7 @@ function convertMeshToColumnarTable(mesh) {
|
|
|
2333
2213
|
indices: hasIndices ? mesh.indices : void 0
|
|
2334
2214
|
};
|
|
2335
2215
|
}
|
|
2336
|
-
function convertMeshToArrowTable(mesh
|
|
2216
|
+
function convertMeshToArrowTable(mesh) {
|
|
2337
2217
|
return makeMeshArrowTable(mesh.attributes, {
|
|
2338
2218
|
schema: mesh.schema,
|
|
2339
2219
|
topology: mesh.topology,
|
|
@@ -2354,22 +2234,14 @@ function makeMeshArrowTable(attributes, options = {}) {
|
|
|
2354
2234
|
fields.push(
|
|
2355
2235
|
getAttributeArrowField(options.schema, attributeName, column, attribute.componentType)
|
|
2356
2236
|
);
|
|
2357
|
-
if (attributeName ===
|
|
2237
|
+
if (attributeName === attributeNames[0] && options.indices?.value?.length) {
|
|
2358
2238
|
const indicesField = indexedMeshArrowSchema.fields.find((field) => field.name === "indices");
|
|
2359
2239
|
columns.indices = getIndicesVector(options.indices.value, column.length, indicesField.type);
|
|
2360
2240
|
fields.push(indicesField);
|
|
2361
2241
|
}
|
|
2362
2242
|
}
|
|
2363
2243
|
const arrowSchema = new arrow9.Schema(fields, getMeshArrowMetadata(options));
|
|
2364
|
-
|
|
2365
|
-
const schema = serializeArrowSchema(table.schema);
|
|
2366
|
-
return {
|
|
2367
|
-
shape: "arrow-table",
|
|
2368
|
-
schema,
|
|
2369
|
-
data: table,
|
|
2370
|
-
topology: options.topology || "point-list",
|
|
2371
|
-
indices: options.indices
|
|
2372
|
-
};
|
|
2244
|
+
return columns[attributeNames[0]]?.length === 0 ? new arrow9.Table(arrowSchema) : new arrow9.Table(arrowSchema, columns);
|
|
2373
2245
|
}
|
|
2374
2246
|
function getAttributeArrowVector(value, size, componentType) {
|
|
2375
2247
|
if (componentType === "float16") {
|
|
@@ -2483,18 +2355,13 @@ function getMeshArrowMetadata(options) {
|
|
|
2483
2355
|
// src/schema-utils/lib/mesh/convert-table-to-mesh.ts
|
|
2484
2356
|
var arrow10 = __toESM(require("apache-arrow"), 1);
|
|
2485
2357
|
function convertTableToMesh(table) {
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
// return convertColumnarTableToMesh(table);
|
|
2489
|
-
case "arrow-table":
|
|
2490
|
-
return convertArrowTableToMesh(table);
|
|
2491
|
-
default:
|
|
2492
|
-
throw new Error(table.shape);
|
|
2493
|
-
}
|
|
2358
|
+
if (isArrowTable(table)) return convertArrowTableToMesh(table);
|
|
2359
|
+
throw new Error(table.shape);
|
|
2494
2360
|
}
|
|
2495
|
-
function convertArrowTableToMesh(
|
|
2496
|
-
const arrowTable = table.data;
|
|
2361
|
+
function convertArrowTableToMesh(arrowTable) {
|
|
2497
2362
|
const schema = serializeArrowSchema(arrowTable.schema);
|
|
2363
|
+
const localBounds = arrowTable.batches.length === 1 ? arrowTable.batches[0].metadata.get("boundingBox") : void 0;
|
|
2364
|
+
if (localBounds) schema.metadata = { ...schema.metadata, boundingBox: localBounds };
|
|
2498
2365
|
const fields = schema.fields;
|
|
2499
2366
|
const attributes = {};
|
|
2500
2367
|
const columns = [];
|
|
@@ -2595,13 +2462,18 @@ function getAttributeTypedArray(attributeData, size) {
|
|
|
2595
2462
|
if (!(attributeData.type instanceof arrow10.FixedSizeList)) {
|
|
2596
2463
|
return attributeData.toArray();
|
|
2597
2464
|
}
|
|
2598
|
-
|
|
2465
|
+
if (attributeData.length === 0) {
|
|
2466
|
+
const EmptyStorage = attributeData.type.valueType.ArrayType;
|
|
2467
|
+
return new EmptyStorage(0);
|
|
2468
|
+
}
|
|
2469
|
+
const values = attributeData.data.find((chunk) => chunk.length > 0).children[0].values;
|
|
2599
2470
|
const TypedArrayConstructor = values.constructor;
|
|
2600
2471
|
const typedArray = new TypedArrayConstructor(attributeData.length * size);
|
|
2601
2472
|
let targetOffset = 0;
|
|
2602
2473
|
for (const data of attributeData.data) {
|
|
2603
|
-
const child = data.children[0];
|
|
2604
2474
|
const sourceLength = data.length * size;
|
|
2475
|
+
if (sourceLength === 0) continue;
|
|
2476
|
+
const child = data.children[0];
|
|
2605
2477
|
const sourceOffset = child.offset || data.offset * size;
|
|
2606
2478
|
const sourceStart = sourceOffset + sourceLength <= child.values.length ? sourceOffset : 0;
|
|
2607
2479
|
const source = child.values.subarray(sourceStart, sourceStart + sourceLength);
|
|
@@ -2804,101 +2676,6 @@ var DataType3 = class {
|
|
|
2804
2676
|
}
|
|
2805
2677
|
};
|
|
2806
2678
|
|
|
2807
|
-
// src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts
|
|
2808
|
-
var arrow11 = __toESM(require("apache-arrow"), 1);
|
|
2809
|
-
var ArrowTableBuilder = class {
|
|
2810
|
-
schema;
|
|
2811
|
-
arrowSchema;
|
|
2812
|
-
arrowBuilders;
|
|
2813
|
-
length;
|
|
2814
|
-
constructor(schema, options) {
|
|
2815
|
-
this.arrowSchema = convertSchemaToArrow(schema, options);
|
|
2816
|
-
this.schema = options?.viewTypes && options.viewTypes !== "never" ? convertArrowToSchema(this.arrowSchema) : schema;
|
|
2817
|
-
this.arrowBuilders = this.arrowSchema.fields.map(
|
|
2818
|
-
(field) => arrow11.makeBuilder({ type: field.type, nullValues: [null] })
|
|
2819
|
-
);
|
|
2820
|
-
this.length = 0;
|
|
2821
|
-
}
|
|
2822
|
-
addObjectRow(row) {
|
|
2823
|
-
for (let i = 0; i < this.arrowBuilders.length; i++) {
|
|
2824
|
-
const columnName = this.schema.fields[i].name;
|
|
2825
|
-
const value = row[columnName];
|
|
2826
|
-
this.arrowBuilders[i].append(value);
|
|
2827
|
-
}
|
|
2828
|
-
this.length++;
|
|
2829
|
-
}
|
|
2830
|
-
addArrayRow(row) {
|
|
2831
|
-
for (let i = 0; i < this.arrowBuilders.length; i++) {
|
|
2832
|
-
this.arrowBuilders[i].append(row[i]);
|
|
2833
|
-
}
|
|
2834
|
-
this.length++;
|
|
2835
|
-
}
|
|
2836
|
-
/** Makes sure that a first batch with schema is sent even if no rows */
|
|
2837
|
-
firstBatch() {
|
|
2838
|
-
const arrowRecordBatch = this._getArrowRecordBatch();
|
|
2839
|
-
if (arrowRecordBatch.numCols !== 0) {
|
|
2840
|
-
return null;
|
|
2841
|
-
}
|
|
2842
|
-
return {
|
|
2843
|
-
shape: "arrow-table",
|
|
2844
|
-
batchType: "data",
|
|
2845
|
-
length: arrowRecordBatch.numRows,
|
|
2846
|
-
schema: this.schema,
|
|
2847
|
-
data: new arrow11.Table(arrowRecordBatch)
|
|
2848
|
-
};
|
|
2849
|
-
}
|
|
2850
|
-
/** Flush the current batch if conditions are right */
|
|
2851
|
-
flushBatch() {
|
|
2852
|
-
const arrowRecordBatch = this._getArrowRecordBatch();
|
|
2853
|
-
if (arrowRecordBatch.numCols === 0) {
|
|
2854
|
-
return null;
|
|
2855
|
-
}
|
|
2856
|
-
return {
|
|
2857
|
-
shape: "arrow-table",
|
|
2858
|
-
batchType: "data",
|
|
2859
|
-
length: arrowRecordBatch.numRows,
|
|
2860
|
-
schema: this.schema,
|
|
2861
|
-
data: new arrow11.Table(arrowRecordBatch)
|
|
2862
|
-
};
|
|
2863
|
-
}
|
|
2864
|
-
/** Get a last batch if any data is left */
|
|
2865
|
-
finishBatch() {
|
|
2866
|
-
const arrowRecordBatch = this._getArrowRecordBatch();
|
|
2867
|
-
this.arrowBuilders.forEach((builder) => builder.finish());
|
|
2868
|
-
if (arrowRecordBatch.numCols === 0 && arrowRecordBatch.numRows === 0) {
|
|
2869
|
-
return null;
|
|
2870
|
-
}
|
|
2871
|
-
return {
|
|
2872
|
-
shape: "arrow-table",
|
|
2873
|
-
batchType: "data",
|
|
2874
|
-
length: arrowRecordBatch.numRows,
|
|
2875
|
-
schema: this.schema,
|
|
2876
|
-
data: new arrow11.Table(arrowRecordBatch)
|
|
2877
|
-
};
|
|
2878
|
-
}
|
|
2879
|
-
/** Return a table with all the accumulated data */
|
|
2880
|
-
finishTable() {
|
|
2881
|
-
const arrowRecordBatch = this._getArrowRecordBatch();
|
|
2882
|
-
this.arrowBuilders.forEach((builder) => builder.finish());
|
|
2883
|
-
return {
|
|
2884
|
-
shape: "arrow-table",
|
|
2885
|
-
schema: this.schema,
|
|
2886
|
-
data: new arrow11.Table(arrowRecordBatch)
|
|
2887
|
-
};
|
|
2888
|
-
}
|
|
2889
|
-
/** Extract a record batch flushing the currently accumulated data in the builders */
|
|
2890
|
-
_getArrowRecordBatch() {
|
|
2891
|
-
const { arrowBuilders, arrowSchema } = this;
|
|
2892
|
-
const arrowDatas = arrowBuilders.map((builder) => builder.flush());
|
|
2893
|
-
const length = arrowDatas[0]?.length || this.length;
|
|
2894
|
-
this.length = 0;
|
|
2895
|
-
const structField = new arrow11.Struct(arrowSchema.fields);
|
|
2896
|
-
const arrowStructData = new arrow11.Data(structField, 0, length, 0, void 0, arrowDatas);
|
|
2897
|
-
const arrowRecordBatch = new arrow11.RecordBatch(arrowSchema, arrowStructData);
|
|
2898
|
-
return arrowRecordBatch;
|
|
2899
|
-
}
|
|
2900
|
-
};
|
|
2901
|
-
|
|
2902
2679
|
// src/schema-utils/lib/table/arrow-api/get-type-info.ts
|
|
2903
2680
|
function getTypeInfo(arrowTypeLike) {
|
|
2904
2681
|
return {
|
|
@@ -3154,7 +2931,8 @@ var PointCloudTiler = class {
|
|
|
3154
2931
|
/** Validates the decoded profile and creates a root cube from finite native coordinates. */
|
|
3155
2932
|
async initialize(input) {
|
|
3156
2933
|
this.signal.throwIfAborted();
|
|
3157
|
-
if ("
|
|
2934
|
+
if (!("attributes" in input)) {
|
|
2935
|
+
const table = input;
|
|
3158
2936
|
const buffers2 = /* @__PURE__ */ new Set();
|
|
3159
2937
|
let arrowBytes = 0;
|
|
3160
2938
|
const checkData = (data) => {
|
|
@@ -3170,15 +2948,15 @@ var PointCloudTiler = class {
|
|
|
3170
2948
|
if (data.dictionary)
|
|
3171
2949
|
for (const dictionaryData of data.dictionary.data) checkData(dictionaryData);
|
|
3172
2950
|
};
|
|
3173
|
-
for (const batch of
|
|
2951
|
+
for (const batch of table.batches) checkData(batch.data);
|
|
3174
2952
|
if (arrowBytes > this.options.maxInputBytes)
|
|
3175
2953
|
throw new Error("PointCloudTiler: input byte budget exceeded");
|
|
3176
|
-
for (const column of
|
|
3177
|
-
if (
|
|
2954
|
+
for (const column of table.schema.fields) {
|
|
2955
|
+
if (table.getChild(column.name)?.nullCount)
|
|
3178
2956
|
throw new Error("PointCloudTiler: null point attributes require an explicit mapping");
|
|
3179
2957
|
}
|
|
3180
2958
|
}
|
|
3181
|
-
const mesh = "
|
|
2959
|
+
const mesh = "attributes" in input ? input : convertTableToMesh(input);
|
|
3182
2960
|
if (mesh.topology !== "point-list" || mesh.indices)
|
|
3183
2961
|
throw new Error("PointCloudTiler: unindexed point-list input required");
|
|
3184
2962
|
const position = mesh.attributes.POSITION;
|
|
@@ -3356,9 +3134,7 @@ function getAttributeStorageKey(attribute) {
|
|
|
3356
3134
|
ArrowLikeTable,
|
|
3357
3135
|
ArrowTableBuilder,
|
|
3358
3136
|
AsyncQueue,
|
|
3359
|
-
ColumnarTableBatchAggregator,
|
|
3360
3137
|
PointCloudTiler,
|
|
3361
|
-
RowTableBatchAggregator,
|
|
3362
3138
|
TABLE_CONVERTERS,
|
|
3363
3139
|
TableBatchBuilder,
|
|
3364
3140
|
TableConverter,
|
|
@@ -3367,6 +3143,7 @@ function getAttributeStorageKey(attribute) {
|
|
|
3367
3143
|
convertArrowToTable,
|
|
3368
3144
|
convertBatch,
|
|
3369
3145
|
convertBatches,
|
|
3146
|
+
convertMeshToArrowTable,
|
|
3370
3147
|
convertMeshToTable,
|
|
3371
3148
|
convertSchemaToArrow,
|
|
3372
3149
|
convertTable,
|
|
@@ -3397,14 +3174,16 @@ function getAttributeStorageKey(attribute) {
|
|
|
3397
3174
|
getTableRowShape,
|
|
3398
3175
|
getTypeInfo,
|
|
3399
3176
|
isArrayRowTable,
|
|
3177
|
+
isArrowRecordBatch,
|
|
3400
3178
|
isArrowTable,
|
|
3401
3179
|
isColumnarTable,
|
|
3402
3180
|
isGeoJSONTable,
|
|
3403
3181
|
isObjectRowTable,
|
|
3404
3182
|
isTable,
|
|
3405
3183
|
makeArrayRowIterator,
|
|
3184
|
+
makeArrowMetadataBatch,
|
|
3406
3185
|
makeArrowRecordBatchIterator,
|
|
3407
|
-
|
|
3186
|
+
makeArrowTableFromBatches,
|
|
3408
3187
|
makeBatchFromTable,
|
|
3409
3188
|
makeMeshArrowTable,
|
|
3410
3189
|
makeMeshAttributeMetadata,
|
|
@@ -3413,10 +3192,15 @@ function getAttributeStorageKey(attribute) {
|
|
|
3413
3192
|
makeTableBatchIterator,
|
|
3414
3193
|
makeTableFromBatches,
|
|
3415
3194
|
makeTableFromData,
|
|
3195
|
+
mergeArrowSchemas,
|
|
3416
3196
|
queryArrowTable,
|
|
3197
|
+
refineArrowTableBatches,
|
|
3417
3198
|
selectArrowTableRows,
|
|
3418
3199
|
serializeArrowField,
|
|
3419
3200
|
serializeArrowMetadata,
|
|
3420
3201
|
serializeArrowSchema,
|
|
3421
|
-
serializeArrowType
|
|
3202
|
+
serializeArrowType,
|
|
3203
|
+
snapshotArrowSchema,
|
|
3204
|
+
updateArrowTableSchema,
|
|
3205
|
+
updateNativeArrowTableMetadata
|
|
3422
3206
|
});
|