@loaders.gl/core 5.0.0-beta.4 → 5.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GEOARROW-README.md +1 -1
- package/README.md +1 -1
- package/SCAN-README.md +1 -1
- 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/geojson-table.cjs +3 -3
- package/dist/arrow-geometry/geojson-table.cjs.map +2 -2
- package/dist/arrow-geometry/geojson-table.js +2 -2
- 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-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 +81 -0
- package/dist/arrow-worker-transport.cjs.map +6 -0
- package/dist/arrow-worker-transport.d.ts +9 -0
- package/dist/arrow-worker-transport.d.ts.map +1 -0
- package/dist/arrow-worker-transport.js +60 -0
- package/dist/arrow-worker-transport.js.map +1 -0
- package/dist/cluster-source.cjs +198 -585
- package/dist/cluster-source.cjs.map +3 -3
- package/dist/dist.dev.js +546 -54
- package/dist/dist.min.js +3 -3
- package/dist/federated-table-scan-source.cjs +272 -201
- package/dist/federated-table-scan-source.cjs.map +3 -3
- 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/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/geoarrow-converter.d.ts +2 -2
- 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 +1 -1
- package/dist/geoarrow/geoarrow-stream.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-stream.js +1 -1
- 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/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/index.cjs +8 -11
- package/dist/index.cjs.map +3 -3
- package/dist/lib/init.js +1 -1
- package/dist/loader-utils/index.cjs +251 -33
- package/dist/loader-utils/index.cjs.map +3 -3
- package/dist/loader-utils/index.d.ts +8 -4
- package/dist/loader-utils/index.d.ts.map +1 -1
- package/dist/loader-utils/index.js +4 -2
- package/dist/loader-utils/index.js.map +1 -1
- package/dist/loader-utils/json-loader.js +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.js +1 -1
- package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts +38 -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 +96 -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/loader-utils/lib/scan-utils/{experimental-scan-options.js → 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 +12 -17
- 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 +5 -5
- 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 +33 -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.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts +2 -2
- 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 +11 -3
- 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 +50 -1
- package/dist/loader-utils/lib/sources/data-source.js.map +1 -1
- package/dist/loader-utils/lib/sources/table-source-collection.d.ts +30 -0
- package/dist/loader-utils/lib/sources/table-source-collection.d.ts.map +1 -0
- package/dist/loader-utils/lib/sources/table-source-collection.js +5 -0
- package/dist/loader-utils/lib/sources/table-source-collection.js.map +1 -0
- package/dist/loader-utils/loader-types.d.ts +5 -5
- package/dist/loader-utils/loader-types.d.ts.map +1 -1
- package/dist/null-loader.js +1 -1
- package/dist/null-worker-node.js +244 -11
- package/dist/null-worker.js +239 -11
- package/dist/scan/arrow-execution/filter-arrow-table.cjs +254 -0
- package/dist/scan/arrow-execution/filter-arrow-table.cjs.map +7 -0
- package/dist/scan/arrow-execution/filter-arrow-table.d.ts +16 -0
- package/dist/scan/arrow-execution/filter-arrow-table.d.ts.map +1 -0
- package/dist/scan/arrow-execution/filter-arrow-table.js +222 -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.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 +4 -4
- package/dist/scan/federated-table-scan-source.cjs.map +2 -2
- package/dist/scan/federated-table-scan-source.d.ts +1 -1
- package/dist/scan/federated-table-scan-source.d.ts.map +1 -1
- package/dist/scan/federated-table-scan-source.js +4 -4
- package/dist/scan/federated-table-scan-source.js.map +1 -1
- package/dist/scan/index.cjs +188 -4
- package/dist/scan/index.cjs.map +4 -4
- package/dist/scan/index.d.ts +9 -2
- package/dist/scan/index.d.ts.map +1 -1
- package/dist/scan/index.js +4 -0
- package/dist/scan/index.js.map +1 -1
- package/dist/scan/parse-sql-predicate.cjs +3 -3
- package/dist/scan/parse-sql-predicate.cjs.map +2 -2
- package/dist/scan/parse-sql-predicate.d.ts +5 -2
- package/dist/scan/parse-sql-predicate.d.ts.map +1 -1
- package/dist/scan/parse-sql-predicate.js +3 -10
- package/dist/scan/parse-sql-predicate.js.map +1 -1
- package/dist/scan/parse-sql-query.cjs +70 -0
- package/dist/scan/parse-sql-query.cjs.map +7 -0
- package/dist/scan/parse-sql-query.d.ts +5 -0
- package/dist/scan/parse-sql-query.d.ts.map +1 -0
- package/dist/scan/parse-sql-query.js +49 -0
- package/dist/scan/parse-sql-query.js.map +1 -0
- package/dist/scan/parse-sql-select.cjs +215 -0
- package/dist/scan/parse-sql-select.cjs.map +7 -0
- package/dist/scan/parse-sql-select.d.ts +38 -0
- package/dist/scan/parse-sql-select.d.ts.map +1 -0
- package/dist/scan/parse-sql-select.js +208 -0
- package/dist/scan/parse-sql-select.js.map +1 -0
- package/dist/scan/query-arrow-table-in-batches.cjs +65 -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 +44 -0
- package/dist/scan/query-arrow-table-in-batches.js.map +1 -0
- package/dist/scan/query-arrow-table.cjs +52 -179
- package/dist/scan/query-arrow-table.cjs.map +3 -3
- package/dist/scan/query-arrow-table.d.ts +4 -37
- package/dist/scan/query-arrow-table.d.ts.map +1 -1
- package/dist/scan/query-arrow-table.js +37 -188
- package/dist/scan/query-arrow-table.js.map +1 -1
- package/dist/scan/query.cjs +257 -0
- package/dist/scan/query.cjs.map +7 -0
- package/dist/scan/query.d.ts +44 -0
- package/dist/scan/query.d.ts.map +1 -0
- package/dist/scan/query.js +246 -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/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/schema/geometry/geoarrow.d.ts +3 -6
- package/dist/schema/geometry/geoarrow.d.ts.map +1 -1
- package/dist/vector-table-scan-source.cjs +281 -193
- package/dist/vector-table-scan-source.cjs.map +3 -3
- package/dist/worker-utils/index.cjs +20 -26
- package/dist/worker-utils/index.cjs.map +3 -3
- package/dist/worker-utils/index.d.ts +0 -3
- package/dist/worker-utils/index.d.ts.map +1 -1
- package/dist/worker-utils/index.js +0 -3
- 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/library-utils/library-utils.js +1 -1
- package/dist/worker-utils/lib/library-utils/library-utils.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/worker-utils/lib/worker-api/task-runtime.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-api/task-runtime.js +1 -1
- package/dist/worker-utils/lib/worker-api/task-runtime.js.map +1 -1
- package/dist/worker-utils/null-worker-node.js +243 -10
- package/dist/worker-utils/null-worker-node.js.map +4 -4
- package/dist/worker-utils/null-worker.js +238 -10
- package/dist/worker-utils/null-worker.js.map +4 -4
- package/dist/worker-utils/types.d.ts +1 -1
- package/dist/worker-utils/types.d.ts.map +1 -1
- package/package.json +23 -11
- package/src/arrow-geometry/binary-geometry-to-wkb.ts +1 -1
- package/src/arrow-geometry/geojson-table.ts +2 -2
- 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-builder.ts +2 -2
- package/src/arrow-geometry/wkb-statistics.ts +2 -2
- package/src/arrow-worker-transport.ts +87 -0
- package/src/geoarrow/binary-polygon-to-geoarrow.ts +2 -2
- 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-inspection.ts +2 -2
- package/src/geoarrow/geoarrow-stream.ts +1 -1
- package/src/geoarrow/get-geoarrow-vertex-count.ts +1 -1
- 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/loader-utils/index.ts +31 -7
- 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/scan-utils/logical-table-query.ts +164 -0
- package/src/loader-utils/lib/scan-utils/query-options.ts +44 -0
- package/src/loader-utils/lib/scan-utils/scan-query-metadata.ts +17 -26
- package/src/loader-utils/lib/scan-utils/table-query.ts +49 -8
- package/src/loader-utils/lib/scan-utils/table-scan-batch.ts +25 -9
- package/src/loader-utils/lib/sources/data-source.ts +54 -1
- package/src/loader-utils/lib/sources/table-source-collection.ts +38 -0
- package/src/loader-utils/loader-types.ts +5 -5
- package/src/scan/arrow-execution/filter-arrow-table.ts +293 -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.ts +3 -0
- package/src/scan/catalog-query-source.ts +132 -0
- package/src/scan/federated-table-scan-source.ts +19 -19
- package/src/scan/index.ts +28 -4
- package/src/scan/parse-sql-predicate.ts +9 -3
- package/src/scan/parse-sql-query.ts +53 -0
- package/src/scan/parse-sql-select.ts +220 -0
- package/src/scan/query-arrow-table-in-batches.ts +58 -0
- package/src/scan/query-arrow-table.ts +60 -237
- package/src/scan/query.ts +339 -0
- package/src/scan/resolve-query-source.ts +47 -0
- package/src/scan/sql-catalog.ts +167 -0
- package/src/scan/table-query.ts +6 -1
- package/src/schema/geometry/geoarrow.ts +8 -19
- package/src/worker-utils/index.ts +0 -16
- package/src/worker-utils/lib/library-utils/library-utils.ts +1 -1
- package/src/worker-utils/lib/worker-api/create-worker.ts +1 -1
- package/src/worker-utils/lib/worker-api/process-on-worker.ts +1 -6
- package/src/worker-utils/lib/worker-api/task-runtime.ts +1 -1
- package/src/worker-utils/types.ts +1 -1
- 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/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-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/src/arrow-geometry/arrow-geoarrow-adapter.ts +0 -568
- package/src/geoarrow/lib/arrow-geoarrow-adapter.ts +0 -12
- package/src/loader-utils/lib/scan-utils/experimental-scan-options.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
|
@@ -1,568 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
import type {
|
|
6
|
-
GeoArrowArray,
|
|
7
|
-
GeoArrowColumn,
|
|
8
|
-
GeoArrowCoordinateLayout,
|
|
9
|
-
GeoArrowDenseUnion,
|
|
10
|
-
GeoArrowDimension,
|
|
11
|
-
GeoArrowEncoding,
|
|
12
|
-
GeoArrowNumericArray,
|
|
13
|
-
GeoArrowOffsets,
|
|
14
|
-
GeoArrowValidity
|
|
15
|
-
} from '@math.gl/geospatial/geoarrow';
|
|
16
|
-
import * as arrow from 'apache-arrow';
|
|
17
|
-
|
|
18
|
-
/** Options for adapting an Apache Arrow vector to math.gl's runtime-neutral GeoArrow ABI. */
|
|
19
|
-
export type MakeGeoArrowColumnFromArrowVectorOptions = {
|
|
20
|
-
/** GeoArrow extension encoding. Inferred from the physical type when omitted. */
|
|
21
|
-
encoding?: GeoArrowEncoding;
|
|
22
|
-
/** Semantic coordinate dimension. Inferred from native coordinate fields when omitted. */
|
|
23
|
-
dimension?: GeoArrowDimension;
|
|
24
|
-
/** Coordinate organization. Inferred from the physical type when omitted. */
|
|
25
|
-
coordinateLayout?: GeoArrowCoordinateLayout | null;
|
|
26
|
-
/** Opaque extension metadata retained on the descriptor envelope. */
|
|
27
|
-
metadata?: Readonly<Record<string, unknown>>;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Adapts Apache Arrow physical buffers to `@math.gl/geospatial/geoarrow` borrowed descriptors.
|
|
32
|
-
* Arrow slices already adjust numeric buffers, list offsets, union buffers, and fixed-width
|
|
33
|
-
* children. Their Data.offset is retained only as the validity bitmap's bit offset;
|
|
34
|
-
* copying it onto the geometry descriptor would apply the physical slice twice.
|
|
35
|
-
*/
|
|
36
|
-
export function makeGeoArrowColumnFromArrowVector(
|
|
37
|
-
vector: arrow.Vector,
|
|
38
|
-
options: MakeGeoArrowColumnFromArrowVectorOptions = {}
|
|
39
|
-
): GeoArrowColumn {
|
|
40
|
-
const encoding = options.encoding ?? inferGeoArrowEncodingFromArrowType(vector.type);
|
|
41
|
-
const dimension =
|
|
42
|
-
options.dimension ??
|
|
43
|
-
(isSerializedArrowType(vector.type) ? 'xy' : inferGeoArrowDimensionFromArrowType(vector.type));
|
|
44
|
-
const coordinateLayout =
|
|
45
|
-
options.coordinateLayout === undefined
|
|
46
|
-
? inferGeoArrowCoordinateLayoutFromArrowType(vector.type)
|
|
47
|
-
: options.coordinateLayout;
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
encoding,
|
|
51
|
-
dimension,
|
|
52
|
-
coordinateLayout,
|
|
53
|
-
chunks: vector.data.map(data => makeGeoArrowArrayFromArrowData(data)),
|
|
54
|
-
metadata: options.metadata
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** Converts a math.gl GeoArrow descriptor back to an Apache Arrow vector. */
|
|
59
|
-
export function makeArrowVectorFromGeoArrowColumn(column: GeoArrowColumn): arrow.Vector {
|
|
60
|
-
return new arrow.Vector(
|
|
61
|
-
column.chunks.map(chunk =>
|
|
62
|
-
makeArrowDataFromGeoArrowArray(chunk, column.dimension, column.coordinateLayout)
|
|
63
|
-
)
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** Infers a GeoArrow encoding from an Apache Arrow physical type. */
|
|
68
|
-
export function inferGeoArrowEncodingFromArrowType(type: arrow.DataType): GeoArrowEncoding {
|
|
69
|
-
if (arrow.DataType.isDenseUnion(type)) return 'geoarrow.geometry';
|
|
70
|
-
if (
|
|
71
|
-
arrow.DataType.isBinary(type) ||
|
|
72
|
-
arrow.DataType.isLargeBinary(type) ||
|
|
73
|
-
arrow.DataType.isBinaryView(type)
|
|
74
|
-
) {
|
|
75
|
-
return 'geoarrow.wkb';
|
|
76
|
-
}
|
|
77
|
-
if (
|
|
78
|
-
arrow.DataType.isUtf8(type) ||
|
|
79
|
-
arrow.DataType.isLargeUtf8(type) ||
|
|
80
|
-
arrow.DataType.isUtf8View(type)
|
|
81
|
-
) {
|
|
82
|
-
return 'geoarrow.wkt';
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const nesting = getArrowListNesting(type);
|
|
86
|
-
switch (nesting) {
|
|
87
|
-
case 0:
|
|
88
|
-
return 'geoarrow.point';
|
|
89
|
-
case 1:
|
|
90
|
-
return 'geoarrow.linestring';
|
|
91
|
-
case 2:
|
|
92
|
-
return 'geoarrow.polygon';
|
|
93
|
-
case 3:
|
|
94
|
-
return 'geoarrow.multipolygon';
|
|
95
|
-
default:
|
|
96
|
-
throw new Error(`Cannot infer GeoArrow encoding from Arrow type ${type.toString()}`);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/** Infers semantic coordinate dimensions from Arrow coordinate fields. */
|
|
101
|
-
export function inferGeoArrowDimensionFromArrowType(type: arrow.DataType): GeoArrowDimension {
|
|
102
|
-
if (arrow.DataType.isFixedSizeList(type)) {
|
|
103
|
-
const dimensionName = type.children[0]?.name.toLowerCase();
|
|
104
|
-
if (isGeoArrowDimension(dimensionName)) return dimensionName;
|
|
105
|
-
switch (type.listSize) {
|
|
106
|
-
case 2:
|
|
107
|
-
return 'xy';
|
|
108
|
-
case 3:
|
|
109
|
-
return 'xyz';
|
|
110
|
-
case 4:
|
|
111
|
-
return 'xyzm';
|
|
112
|
-
default:
|
|
113
|
-
throw new Error(
|
|
114
|
-
`GeoArrow coordinates require 2, 3, or 4 values, received ${type.listSize}`
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if (arrow.DataType.isStruct(type)) {
|
|
119
|
-
const names = type.children.map(field => field.name.toLowerCase());
|
|
120
|
-
if (names[0] === 'x' && names[1] === 'y') {
|
|
121
|
-
if (names[2] === 'm') return 'xym';
|
|
122
|
-
if (names[2] === 'z' && names[3] === 'm') return 'xyzm';
|
|
123
|
-
if (names[2] === 'z') return 'xyz';
|
|
124
|
-
return 'xy';
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
if (arrow.DataType.isList(type) || arrow.DataType.isLargeList(type)) {
|
|
128
|
-
return inferGeoArrowDimensionFromArrowType(type.children[0].type);
|
|
129
|
-
}
|
|
130
|
-
if (arrow.DataType.isDenseUnion(type)) {
|
|
131
|
-
return type.children.reduce<GeoArrowDimension>(
|
|
132
|
-
(dimension, field) =>
|
|
133
|
-
mergeGeoArrowDimensions(dimension, inferGeoArrowDimensionFromUnionChild(field)),
|
|
134
|
-
'xy'
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
throw new Error(`Cannot infer GeoArrow dimension from Arrow type ${type.toString()}`);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** Infers whether Arrow coordinate leaves are interleaved or separated. */
|
|
141
|
-
export function inferGeoArrowCoordinateLayoutFromArrowType(
|
|
142
|
-
type: arrow.DataType
|
|
143
|
-
): GeoArrowCoordinateLayout | null {
|
|
144
|
-
if (arrow.DataType.isFixedSizeList(type)) return 'interleaved';
|
|
145
|
-
if (arrow.DataType.isStruct(type)) return 'separated';
|
|
146
|
-
if (arrow.DataType.isList(type) || arrow.DataType.isLargeList(type)) {
|
|
147
|
-
return inferGeoArrowCoordinateLayoutFromArrowType(type.children[0].type);
|
|
148
|
-
}
|
|
149
|
-
if (arrow.DataType.isDenseUnion(type)) {
|
|
150
|
-
for (const field of type.children) {
|
|
151
|
-
const layout = inferGeoArrowCoordinateLayoutFromArrowType(field.type);
|
|
152
|
-
if (layout) return layout;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function makeGeoArrowArrayFromArrowData(data: arrow.Data): GeoArrowArray {
|
|
159
|
-
const validity = makeGeoArrowValidity(data);
|
|
160
|
-
if (arrow.DataType.isFixedSizeList(data.type)) {
|
|
161
|
-
return {
|
|
162
|
-
kind: 'fixed-size-list',
|
|
163
|
-
length: data.length,
|
|
164
|
-
size: data.type.listSize,
|
|
165
|
-
child: makeGeoArrowArrayFromArrowData(data.children[0]),
|
|
166
|
-
validity
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
if (arrow.DataType.isList(data.type) || arrow.DataType.isLargeList(data.type)) {
|
|
170
|
-
return {
|
|
171
|
-
kind: 'list',
|
|
172
|
-
length: data.length,
|
|
173
|
-
offsets: data.valueOffsets as GeoArrowOffsets,
|
|
174
|
-
child: makeGeoArrowArrayFromArrowData(data.children[0]),
|
|
175
|
-
validity
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
if (arrow.DataType.isStruct(data.type)) {
|
|
179
|
-
const children: Record<string, GeoArrowArray> = {};
|
|
180
|
-
for (let childIndex = 0; childIndex < data.type.children.length; childIndex++) {
|
|
181
|
-
children[data.type.children[childIndex].name] = makeGeoArrowArrayFromArrowData(
|
|
182
|
-
data.children[childIndex]
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
return {kind: 'struct', length: data.length, children, validity};
|
|
186
|
-
}
|
|
187
|
-
if (arrow.DataType.isDenseUnion(data.type)) {
|
|
188
|
-
const unionType = data.type as arrow.DenseUnion;
|
|
189
|
-
return {
|
|
190
|
-
kind: 'dense-union',
|
|
191
|
-
length: data.length,
|
|
192
|
-
typeIds: data.typeIds as Int8Array | Uint8Array,
|
|
193
|
-
valueOffsets: data.valueOffsets,
|
|
194
|
-
children: unionType.children.map((field, childIndex) => ({
|
|
195
|
-
name: field.name,
|
|
196
|
-
typeId: unionType.typeIds[childIndex],
|
|
197
|
-
encoding: inferGeoArrowEncodingFromUnionChild(field),
|
|
198
|
-
dimension: inferGeoArrowDimensionFromUnionChild(field),
|
|
199
|
-
coordinateLayout: inferGeoArrowCoordinateLayoutFromArrowType(field.type),
|
|
200
|
-
data: makeGeoArrowArrayFromArrowData(data.children[childIndex])
|
|
201
|
-
}))
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
if (arrow.DataType.isBinaryView(data.type) || arrow.DataType.isUtf8View(data.type)) {
|
|
205
|
-
const viewBytes = data.values as Uint8Array;
|
|
206
|
-
return {
|
|
207
|
-
kind: 'serialized',
|
|
208
|
-
encoding: arrow.DataType.isBinaryView(data.type) ? 'binary' : 'utf8',
|
|
209
|
-
length: data.length,
|
|
210
|
-
offsets: new Int32Array(0),
|
|
211
|
-
values: new Uint8Array(0),
|
|
212
|
-
views: new Uint32Array(
|
|
213
|
-
viewBytes.buffer,
|
|
214
|
-
viewBytes.byteOffset,
|
|
215
|
-
Math.floor(viewBytes.byteLength / Uint32Array.BYTES_PER_ELEMENT)
|
|
216
|
-
),
|
|
217
|
-
dataBuffers: data.variadicBuffers,
|
|
218
|
-
validity
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
if (isOffsetSerializedArrowType(data.type)) {
|
|
222
|
-
return {
|
|
223
|
-
kind: 'serialized',
|
|
224
|
-
encoding:
|
|
225
|
-
arrow.DataType.isBinary(data.type) || arrow.DataType.isLargeBinary(data.type)
|
|
226
|
-
? 'binary'
|
|
227
|
-
: 'utf8',
|
|
228
|
-
length: data.length,
|
|
229
|
-
offsets: data.valueOffsets as GeoArrowOffsets,
|
|
230
|
-
values: data.values as Uint8Array,
|
|
231
|
-
validity
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
if (arrow.DataType.isInt(data.type) || arrow.DataType.isFloat(data.type)) {
|
|
235
|
-
return {
|
|
236
|
-
kind: 'primitive',
|
|
237
|
-
length: data.length,
|
|
238
|
-
values: data.values as GeoArrowNumericArray,
|
|
239
|
-
validity
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
throw new Error(`Unsupported GeoArrow physical Arrow type ${data.type.toString()}`);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function makeGeoArrowValidity(data: arrow.Data): GeoArrowValidity | undefined {
|
|
246
|
-
if (data.nullCount === 0 || !data.nullBitmap || data.nullBitmap.length === 0) return undefined;
|
|
247
|
-
return {values: data.nullBitmap, bitOffset: data.offset};
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function makeArrowDataFromGeoArrowArray(
|
|
251
|
-
array: GeoArrowArray,
|
|
252
|
-
dimension: GeoArrowDimension,
|
|
253
|
-
coordinateLayout: GeoArrowCoordinateLayout | null
|
|
254
|
-
): arrow.Data {
|
|
255
|
-
const validity = makeCompactValidity(array.validity, array.length);
|
|
256
|
-
const nullCount = validity ? -1 : 0;
|
|
257
|
-
const validityBuffers = validity ? {[arrow.BufferType.VALIDITY]: validity} : {};
|
|
258
|
-
|
|
259
|
-
switch (array.kind) {
|
|
260
|
-
case 'primitive': {
|
|
261
|
-
const values = makePackedPrimitiveValues(array);
|
|
262
|
-
return new arrow.Data(getArrowTypeForValues(values), 0, array.length, nullCount, {
|
|
263
|
-
...validityBuffers,
|
|
264
|
-
[arrow.BufferType.DATA]: values
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
case 'fixed-size-list': {
|
|
268
|
-
const child = makeArrowDataFromGeoArrowArray(array.child, dimension, coordinateLayout);
|
|
269
|
-
const childStart = (array.offset ?? 0) * array.size;
|
|
270
|
-
const slicedChild =
|
|
271
|
-
childStart === 0 && child.length === array.length * array.size
|
|
272
|
-
? child
|
|
273
|
-
: child.slice(childStart, array.length * array.size);
|
|
274
|
-
const type = new arrow.FixedSizeList(
|
|
275
|
-
array.size,
|
|
276
|
-
new arrow.Field('value', slicedChild.type, true)
|
|
277
|
-
);
|
|
278
|
-
return new arrow.Data(type, 0, array.length, nullCount, validityBuffers, [slicedChild]);
|
|
279
|
-
}
|
|
280
|
-
case 'list': {
|
|
281
|
-
const child = makeArrowDataFromGeoArrowArray(array.child, dimension, coordinateLayout);
|
|
282
|
-
const offsets = makeArrowOffsets(array.offsets, array.offset, array.length, array.offsetBase);
|
|
283
|
-
const field = new arrow.Field('value', child.type, true);
|
|
284
|
-
const type =
|
|
285
|
-
offsets instanceof BigInt64Array ? new arrow.LargeList(field) : new arrow.List(field);
|
|
286
|
-
return new arrow.Data(
|
|
287
|
-
type,
|
|
288
|
-
0,
|
|
289
|
-
array.length,
|
|
290
|
-
nullCount,
|
|
291
|
-
{...validityBuffers, [arrow.BufferType.OFFSET]: offsets},
|
|
292
|
-
[child]
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
case 'struct': {
|
|
296
|
-
const fields: arrow.Field[] = [];
|
|
297
|
-
const children: arrow.Data[] = [];
|
|
298
|
-
for (const [name, childArray] of Object.entries(array.children)) {
|
|
299
|
-
let child = makeArrowDataFromGeoArrowArray(childArray, dimension, coordinateLayout);
|
|
300
|
-
const childOffset = array.offset ?? 0;
|
|
301
|
-
if (childOffset > 0 || child.length !== array.length) {
|
|
302
|
-
child = child.slice(childOffset, array.length);
|
|
303
|
-
}
|
|
304
|
-
fields.push(new arrow.Field(name, child.type, true));
|
|
305
|
-
children.push(child);
|
|
306
|
-
}
|
|
307
|
-
return new arrow.Data(
|
|
308
|
-
new arrow.Struct(fields),
|
|
309
|
-
0,
|
|
310
|
-
array.length,
|
|
311
|
-
nullCount,
|
|
312
|
-
validityBuffers,
|
|
313
|
-
children
|
|
314
|
-
);
|
|
315
|
-
}
|
|
316
|
-
case 'dense-union':
|
|
317
|
-
return makeArrowDenseUnionData(array, dimension, coordinateLayout);
|
|
318
|
-
case 'serialized': {
|
|
319
|
-
if (array.views) {
|
|
320
|
-
const type = array.encoding === 'binary' ? new arrow.BinaryView() : new arrow.Utf8View();
|
|
321
|
-
const viewBytes = new Uint8Array(
|
|
322
|
-
array.views.buffer,
|
|
323
|
-
array.views.byteOffset,
|
|
324
|
-
array.views.byteLength
|
|
325
|
-
);
|
|
326
|
-
return new arrow.Data(
|
|
327
|
-
type,
|
|
328
|
-
0,
|
|
329
|
-
array.length,
|
|
330
|
-
nullCount,
|
|
331
|
-
{...validityBuffers, [arrow.BufferType.DATA]: viewBytes},
|
|
332
|
-
[],
|
|
333
|
-
undefined,
|
|
334
|
-
array.dataBuffers
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
const offsets = makeArrowOffsets(array.offsets, array.offset, array.length, array.offsetBase);
|
|
338
|
-
const type = getSerializedArrowType(array.encoding, offsets);
|
|
339
|
-
return new arrow.Data(type, 0, array.length, nullCount, {
|
|
340
|
-
...validityBuffers,
|
|
341
|
-
[arrow.BufferType.OFFSET]: offsets,
|
|
342
|
-
[arrow.BufferType.DATA]: array.values
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
function makeArrowDenseUnionData(
|
|
349
|
-
array: GeoArrowDenseUnion,
|
|
350
|
-
dimension: GeoArrowDimension,
|
|
351
|
-
coordinateLayout: GeoArrowCoordinateLayout | null
|
|
352
|
-
): arrow.Data {
|
|
353
|
-
const offset = array.offset ?? 0;
|
|
354
|
-
const sourceTypeIds = array.typeIds.subarray(offset, offset + array.length);
|
|
355
|
-
const typeIds =
|
|
356
|
-
sourceTypeIds instanceof Int8Array
|
|
357
|
-
? sourceTypeIds
|
|
358
|
-
: new Int8Array(sourceTypeIds.buffer, sourceTypeIds.byteOffset, sourceTypeIds.byteLength);
|
|
359
|
-
const valueOffsets = array.valueOffsets.subarray(offset, offset + array.length);
|
|
360
|
-
const children = array.children.map(child =>
|
|
361
|
-
makeArrowDataFromGeoArrowArray(
|
|
362
|
-
child.data,
|
|
363
|
-
child.dimension ?? dimension,
|
|
364
|
-
child.coordinateLayout === undefined ? coordinateLayout : child.coordinateLayout
|
|
365
|
-
)
|
|
366
|
-
);
|
|
367
|
-
|
|
368
|
-
if (array.validity) {
|
|
369
|
-
for (let rowIndex = 0; rowIndex < array.length; rowIndex++) {
|
|
370
|
-
if (isGeoArrowValueValid(array.validity, rowIndex)) continue;
|
|
371
|
-
const childIndex = array.children.findIndex(child => child.typeId === typeIds[rowIndex]);
|
|
372
|
-
const childOffset = valueOffsets[rowIndex];
|
|
373
|
-
const childValidity = array.children[childIndex]?.data.validity;
|
|
374
|
-
if (
|
|
375
|
-
childIndex < 0 ||
|
|
376
|
-
childOffset < 0 ||
|
|
377
|
-
childOffset >= children[childIndex].length ||
|
|
378
|
-
!childValidity ||
|
|
379
|
-
isGeoArrowValueValid(childValidity, childOffset)
|
|
380
|
-
) {
|
|
381
|
-
throw new Error('GeoArrow dense-union null does not reference a nullable child value');
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
const fields = array.children.map(
|
|
387
|
-
(child, childIndex) =>
|
|
388
|
-
new arrow.Field(
|
|
389
|
-
getArrowUnionChildName(child.name, child.dimension ?? dimension),
|
|
390
|
-
children[childIndex].type,
|
|
391
|
-
true
|
|
392
|
-
)
|
|
393
|
-
);
|
|
394
|
-
const type = new arrow.DenseUnion(
|
|
395
|
-
Int32Array.from(array.children.map(child => child.typeId)),
|
|
396
|
-
fields
|
|
397
|
-
);
|
|
398
|
-
return new arrow.Data(
|
|
399
|
-
type,
|
|
400
|
-
0,
|
|
401
|
-
array.length,
|
|
402
|
-
0,
|
|
403
|
-
{[arrow.BufferType.TYPE]: typeIds, [arrow.BufferType.OFFSET]: valueOffsets},
|
|
404
|
-
children
|
|
405
|
-
);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
function makePackedPrimitiveValues(
|
|
409
|
-
array: Extract<GeoArrowArray, {kind: 'primitive'}>
|
|
410
|
-
): GeoArrowNumericArray {
|
|
411
|
-
const offset = array.offset ?? 0;
|
|
412
|
-
const stride = array.stride ?? 1;
|
|
413
|
-
if (stride === 1) {
|
|
414
|
-
return array.values.subarray(offset, offset + array.length) as GeoArrowNumericArray;
|
|
415
|
-
}
|
|
416
|
-
const ValuesConstructor = array.values.constructor as {
|
|
417
|
-
new (length: number): GeoArrowNumericArray;
|
|
418
|
-
};
|
|
419
|
-
const values = new ValuesConstructor(array.length);
|
|
420
|
-
for (let index = 0; index < array.length; index++) {
|
|
421
|
-
values[index] = array.values[offset + index * stride] as never;
|
|
422
|
-
}
|
|
423
|
-
return values;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
function getArrowTypeForValues(values: GeoArrowNumericArray): arrow.DataType {
|
|
427
|
-
if (values instanceof Int8Array) return new arrow.Int8();
|
|
428
|
-
if (values instanceof Uint8Array || values instanceof Uint8ClampedArray) return new arrow.Uint8();
|
|
429
|
-
if (values instanceof Int16Array) return new arrow.Int16();
|
|
430
|
-
if (values instanceof Uint16Array) return new arrow.Uint16();
|
|
431
|
-
if (values instanceof Int32Array) return new arrow.Int32();
|
|
432
|
-
if (values instanceof Uint32Array) return new arrow.Uint32();
|
|
433
|
-
if (values instanceof BigInt64Array) return new arrow.Int64();
|
|
434
|
-
if (values instanceof BigUint64Array) return new arrow.Uint64();
|
|
435
|
-
if (values instanceof Float32Array) return new arrow.Float32();
|
|
436
|
-
if (values instanceof Float64Array) return new arrow.Float64();
|
|
437
|
-
throw new Error(`Unsupported GeoArrow primitive values ${(values as object).constructor.name}`);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
function makeArrowOffsets(
|
|
441
|
-
offsets: GeoArrowOffsets,
|
|
442
|
-
offset = 0,
|
|
443
|
-
length: number,
|
|
444
|
-
offsetBase: number | bigint = 0
|
|
445
|
-
): GeoArrowOffsets {
|
|
446
|
-
const source = offsets.subarray(offset, offset + length + 1) as GeoArrowOffsets;
|
|
447
|
-
if (offsetBase === 0 || offsetBase === 0n) return source;
|
|
448
|
-
const normalized =
|
|
449
|
-
offsets instanceof BigInt64Array
|
|
450
|
-
? new BigInt64Array(source.length)
|
|
451
|
-
: new Int32Array(source.length);
|
|
452
|
-
for (let index = 0; index < source.length; index++) {
|
|
453
|
-
if (normalized instanceof BigInt64Array) {
|
|
454
|
-
normalized[index] = BigInt(source[index]) - BigInt(offsetBase);
|
|
455
|
-
} else {
|
|
456
|
-
normalized[index] = Number(source[index]) - Number(offsetBase);
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
return normalized;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
function makeCompactValidity(
|
|
463
|
-
validity: GeoArrowValidity | undefined,
|
|
464
|
-
length: number
|
|
465
|
-
): Uint8Array | undefined {
|
|
466
|
-
if (!validity) return undefined;
|
|
467
|
-
const bitOffset = validity.bitOffset ?? 0;
|
|
468
|
-
if (bitOffset === 0 && validity.values.length === Math.ceil(length / 8)) {
|
|
469
|
-
return validity.values;
|
|
470
|
-
}
|
|
471
|
-
const values = new Uint8Array(Math.ceil(length / 8));
|
|
472
|
-
let nullCount = 0;
|
|
473
|
-
for (let index = 0; index < length; index++) {
|
|
474
|
-
if (isGeoArrowValueValid(validity, index)) values[index >> 3] |= 1 << (index & 7);
|
|
475
|
-
else nullCount++;
|
|
476
|
-
}
|
|
477
|
-
return nullCount > 0 ? values : undefined;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
function isGeoArrowValueValid(validity: GeoArrowValidity, index: number): boolean {
|
|
481
|
-
const bitIndex = (validity.bitOffset ?? 0) + index;
|
|
482
|
-
return Boolean(validity.values[bitIndex >> 3] & (1 << (bitIndex & 7)));
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
function inferGeoArrowEncodingFromUnionChild(field: arrow.Field): GeoArrowEncoding {
|
|
486
|
-
const normalizedName = field.name.replace(/[^a-z]/gi, '').toLowerCase();
|
|
487
|
-
const names: Record<string, GeoArrowEncoding> = {
|
|
488
|
-
point: 'geoarrow.point',
|
|
489
|
-
linestring: 'geoarrow.linestring',
|
|
490
|
-
polygon: 'geoarrow.polygon',
|
|
491
|
-
multipoint: 'geoarrow.multipoint',
|
|
492
|
-
multilinestring: 'geoarrow.multilinestring',
|
|
493
|
-
multipolygon: 'geoarrow.multipolygon',
|
|
494
|
-
geometrycollection: 'geoarrow.geometrycollection'
|
|
495
|
-
};
|
|
496
|
-
for (const [name, encoding] of Object.entries(names)) {
|
|
497
|
-
if (normalizedName.startsWith(name)) return encoding;
|
|
498
|
-
}
|
|
499
|
-
return inferGeoArrowEncodingFromArrowType(field.type);
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
function inferGeoArrowDimensionFromUnionChild(field: arrow.Field): GeoArrowDimension {
|
|
503
|
-
if (/\sZM$/i.test(field.name)) return 'xyzm';
|
|
504
|
-
if (/\sM$/i.test(field.name)) return 'xym';
|
|
505
|
-
if (/\sZ$/i.test(field.name)) return 'xyz';
|
|
506
|
-
return inferGeoArrowDimensionFromArrowType(field.type);
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
function getArrowUnionChildName(name: string, dimension: GeoArrowDimension): string {
|
|
510
|
-
if (/\s(?:Z|M|ZM)$/i.test(name) || dimension === 'xy') return name;
|
|
511
|
-
const suffix = dimension === 'xyz' ? 'Z' : dimension === 'xym' ? 'M' : 'ZM';
|
|
512
|
-
return `${name} ${suffix}`;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
function getArrowListNesting(type: arrow.DataType): number {
|
|
516
|
-
let nesting = 0;
|
|
517
|
-
let currentType = type;
|
|
518
|
-
while (arrow.DataType.isList(currentType) || arrow.DataType.isLargeList(currentType)) {
|
|
519
|
-
nesting++;
|
|
520
|
-
currentType = currentType.children[0].type;
|
|
521
|
-
}
|
|
522
|
-
if (arrow.DataType.isFixedSizeList(currentType) || arrow.DataType.isStruct(currentType)) {
|
|
523
|
-
return nesting;
|
|
524
|
-
}
|
|
525
|
-
throw new Error(`GeoArrow type does not terminate in coordinates: ${type.toString()}`);
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
function getSerializedArrowType(
|
|
529
|
-
encoding: 'binary' | 'utf8',
|
|
530
|
-
offsets: GeoArrowOffsets
|
|
531
|
-
): arrow.DataType {
|
|
532
|
-
if (encoding === 'binary') {
|
|
533
|
-
return offsets instanceof BigInt64Array ? new arrow.LargeBinary() : new arrow.Binary();
|
|
534
|
-
}
|
|
535
|
-
return offsets instanceof BigInt64Array ? new arrow.LargeUtf8() : new arrow.Utf8();
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
function isOffsetSerializedArrowType(type: arrow.DataType): boolean {
|
|
539
|
-
return (
|
|
540
|
-
arrow.DataType.isBinary(type) ||
|
|
541
|
-
arrow.DataType.isLargeBinary(type) ||
|
|
542
|
-
arrow.DataType.isUtf8(type) ||
|
|
543
|
-
arrow.DataType.isLargeUtf8(type)
|
|
544
|
-
);
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
function isSerializedArrowType(type: arrow.DataType): boolean {
|
|
548
|
-
return (
|
|
549
|
-
isOffsetSerializedArrowType(type) ||
|
|
550
|
-
arrow.DataType.isBinaryView(type) ||
|
|
551
|
-
arrow.DataType.isUtf8View(type)
|
|
552
|
-
);
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
function isGeoArrowDimension(value: string | undefined): value is GeoArrowDimension {
|
|
556
|
-
return value === 'xy' || value === 'xyz' || value === 'xym' || value === 'xyzm';
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
function mergeGeoArrowDimensions(
|
|
560
|
-
left: GeoArrowDimension,
|
|
561
|
-
right: GeoArrowDimension
|
|
562
|
-
): GeoArrowDimension {
|
|
563
|
-
if (left === right) return left;
|
|
564
|
-
if (left === 'xy') return right;
|
|
565
|
-
if (right === 'xy') return left;
|
|
566
|
-
if (left === 'xyzm' || right === 'xyzm') return 'xyzm';
|
|
567
|
-
return left === 'xym' && right === 'xym' ? 'xym' : 'xyzm';
|
|
568
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
makeGeoArrowColumnFromArrowVector,
|
|
7
|
-
makeArrowVectorFromGeoArrowColumn,
|
|
8
|
-
inferGeoArrowEncodingFromArrowType,
|
|
9
|
-
inferGeoArrowDimensionFromArrowType,
|
|
10
|
-
inferGeoArrowCoordinateLayoutFromArrowType,
|
|
11
|
-
type MakeGeoArrowColumnFromArrowVectorOptions
|
|
12
|
-
} from '@loaders.gl/core/arrow-geometry';
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
import type {ColumnarPredicate} from './columnar-predicate';
|
|
6
|
-
import type {ScanBounds, ScanExecutionTelemetryCallback} from './scan-query-metadata';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Experimental common scan request accepted by loaders that implement the scan protocol.
|
|
10
|
-
*
|
|
11
|
-
* Format loaders apply the fields relevant to their query family and must reject unsupported
|
|
12
|
-
* fields rather than silently ignoring them. This intentionally remains a common superset in 5.0
|
|
13
|
-
* so applications and Deck.gl adapters can forward one stable option object.
|
|
14
|
-
*/
|
|
15
|
-
export type ExperimentalScanOptions = Readonly<{
|
|
16
|
-
/** Portable predicate for table-like sources. */
|
|
17
|
-
predicate?: ColumnarPredicate;
|
|
18
|
-
/** Output columns or bands selected by the caller. */
|
|
19
|
-
columns?: readonly string[];
|
|
20
|
-
/** Maximum number of rows or points retained after filtering. */
|
|
21
|
-
limit?: number;
|
|
22
|
-
/** Cooperative cancellation signal. */
|
|
23
|
-
signal?: AbortSignal;
|
|
24
|
-
/** Receives one terminal execution snapshot without changing query semantics. */
|
|
25
|
-
onTelemetry?: ScanExecutionTelemetryCallback;
|
|
26
|
-
/** Source-coordinate bounds for spatial, raster, and point-cloud scans. */
|
|
27
|
-
bounds?: ScanBounds;
|
|
28
|
-
/** Raster overview or point-cloud hierarchy level. */
|
|
29
|
-
level?: number;
|
|
30
|
-
/** Shallowest point-cloud hierarchy level to read. */
|
|
31
|
-
minimumLevel?: number;
|
|
32
|
-
/** Deepest point-cloud hierarchy level to read. */
|
|
33
|
-
maximumLevel?: number;
|
|
34
|
-
/** Desired maximum point spacing for point-cloud scans. */
|
|
35
|
-
targetSpacing?: number;
|
|
36
|
-
/** Requested raster output width in pixels. */
|
|
37
|
-
width?: number;
|
|
38
|
-
/** Requested raster output height in pixels. */
|
|
39
|
-
height?: number;
|
|
40
|
-
/** Named raster variables or bands. */
|
|
41
|
-
variables?: readonly string[];
|
|
42
|
-
/** Numeric raster channel indices. */
|
|
43
|
-
channels?: readonly number[];
|
|
44
|
-
/** Raster dimension indices or half-open ranges. */
|
|
45
|
-
slices?: Readonly<Record<string, number | readonly [number, number]>>;
|
|
46
|
-
}>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
/** Transfer-safe Apache Arrow table serialization and buffer ownership helpers. */
|
|
6
|
-
export * from './lib/arrow/arrow-table-transport';
|
|
7
|
-
export * from './lib/arrow/split-arrow-buffers';
|