@luma.gl/graph 10.0.0-beta.1 → 10.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/experimental-models.cjs +21 -0
- package/dist/experimental-models.d.ts +2 -0
- package/dist/experimental-models.d.ts.map +1 -0
- package/dist/experimental-models.js +5 -0
- package/dist/experimental-models.js.map +1 -0
- package/dist/experimental-simulation.cjs +21 -0
- package/dist/experimental-simulation.d.ts +2 -0
- package/dist/experimental-simulation.d.ts.map +1 -0
- package/dist/experimental-simulation.js +5 -0
- package/dist/experimental-simulation.js.map +1 -0
- package/dist/gpu-dataframe/gpu-data-frame-query.cjs +7 -3
- package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.js +14 -4
- package/dist/gpu-dataframe/gpu-data-frame-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression-shader.cjs +87 -5
- package/dist/gpu-dataframe/gpu-expression-shader.d.ts +2 -1
- package/dist/gpu-dataframe/gpu-expression-shader.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression-shader.js +101 -5
- package/dist/gpu-dataframe/gpu-expression-shader.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.cjs +86 -0
- package/dist/gpu-dataframe/gpu-expression.d.ts +23 -2
- package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.js +81 -0
- package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.cjs +0 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js +0 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-query.cjs +2 -2
- package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-query.js +5 -3
- package/dist/gpu-dataframe/gpu-global-aggregation-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.cjs +23 -11
- package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.js +24 -12
- package/dist/gpu-dataframe/gpu-global-sort-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.cjs +0 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js +0 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-group-by-query.cjs +2 -2
- package/dist/gpu-dataframe/gpu-group-by-query.js +5 -3
- package/dist/gpu-dataframe/gpu-group-by-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-histogram-compiler.cjs +0 -1
- package/dist/gpu-dataframe/gpu-histogram-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-histogram-compiler.js +0 -1
- package/dist/gpu-dataframe/gpu-histogram-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.cjs +0 -2
- package/dist/gpu-dataframe/gpu-join-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.js +0 -2
- package/dist/gpu-dataframe/gpu-join-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-query-compiler.cjs +3 -1
- package/dist/gpu-dataframe/gpu-query-compiler.d.ts +0 -1
- package/dist/gpu-dataframe/gpu-query-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-query-compiler.js +3 -1
- package/dist/gpu-dataframe/gpu-query-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-sort-compiler.cjs +0 -1
- package/dist/gpu-dataframe/gpu-sort-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-sort-compiler.js +0 -1
- package/dist/gpu-dataframe/gpu-sort-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-sort-query.cjs +13 -5
- package/dist/gpu-dataframe/gpu-sort-query.d.ts +4 -1
- package/dist/gpu-dataframe/gpu-sort-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-sort-query.js +14 -5
- package/dist/gpu-dataframe/gpu-sort-query.js.map +1 -1
- package/dist/gpu-dataframe/index.cjs +8 -0
- package/dist/gpu-dataframe/index.cjs.map +2 -2
- package/dist/gpu-dataframe/index.d.ts +2 -2
- package/dist/gpu-dataframe/index.d.ts.map +1 -1
- package/dist/gpu-dataframe/index.js +1 -1
- package/dist/gpu-dataframe/index.js.map +1 -1
- package/dist/gpu-dataframe/portable-expression.cjs +68 -4
- package/dist/gpu-dataframe/portable-expression.d.ts +3 -1
- package/dist/gpu-dataframe/portable-expression.d.ts.map +1 -1
- package/dist/gpu-dataframe/portable-expression.js +69 -5
- package/dist/gpu-dataframe/portable-expression.js.map +1 -1
- package/dist/gpu-dggs-benchmarks.cjs +21 -0
- package/dist/gpu-dggs-benchmarks.d.ts +2 -0
- package/dist/gpu-dggs-benchmarks.d.ts.map +1 -0
- package/dist/gpu-dggs-benchmarks.js +5 -0
- package/dist/gpu-dggs-benchmarks.js.map +1 -0
- package/dist/gpu-graph-algorithms-benchmarks.cjs +21 -0
- package/dist/gpu-graph-algorithms-benchmarks.d.ts +2 -0
- package/dist/gpu-graph-algorithms-benchmarks.d.ts.map +1 -0
- package/dist/gpu-graph-algorithms-benchmarks.js +5 -0
- package/dist/gpu-graph-algorithms-benchmarks.js.map +1 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.cjs +116 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.d.ts +42 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.d.ts.map +1 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.js +90 -0
- package/dist/gpu-physics/gpu-physics-ensemble-terrain.js.map +1 -0
- package/dist/gpu-physics/gpu-physics-ensemble.cjs +97 -5
- package/dist/gpu-physics/gpu-physics-ensemble.d.ts +31 -2
- package/dist/gpu-physics/gpu-physics-ensemble.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-physics-ensemble.js +99 -3
- package/dist/gpu-physics/gpu-physics-ensemble.js.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.cjs +483 -152
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts +64 -3
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.js +523 -161
- package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
- package/dist/gpu-physics/index.cjs +23 -2
- package/dist/gpu-physics/index.cjs.map +3 -3
- package/dist/gpu-physics/index.d.ts +8 -2
- package/dist/gpu-physics/index.d.ts.map +1 -1
- package/dist/gpu-physics/index.js +6 -1
- package/dist/gpu-physics/index.js.map +1 -1
- package/dist/gpu-physics/rigid-body-bounds-shaders.cjs +21 -8
- package/dist/gpu-physics/rigid-body-bounds-shaders.d.ts +2 -1
- package/dist/gpu-physics/rigid-body-bounds-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-bounds-shaders.js +15 -1
- package/dist/gpu-physics/rigid-body-bounds-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-convex-shaders.cjs +3 -2
- package/dist/gpu-physics/rigid-body-convex-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-convex-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-convex-shaders.js +3 -2
- package/dist/gpu-physics/rigid-body-convex-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-reset.cjs +36 -7
- package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-reset.js +42 -7
- package/dist/gpu-physics/rigid-body-ensemble-reset.js.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.cjs +23 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts +4 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.js +25 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.js.map +1 -1
- package/dist/gpu-physics/rigid-body-geometry.cjs +41 -4
- package/dist/gpu-physics/rigid-body-geometry.d.ts +10 -1
- package/dist/gpu-physics/rigid-body-geometry.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-geometry.js +44 -3
- package/dist/gpu-physics/rigid-body-geometry.js.map +1 -1
- package/dist/gpu-physics/rigid-body-height-field-shader.cjs +80 -0
- package/dist/gpu-physics/rigid-body-height-field-shader.d.ts +3 -0
- package/dist/gpu-physics/rigid-body-height-field-shader.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-height-field-shader.js +56 -0
- package/dist/gpu-physics/rigid-body-height-field-shader.js.map +1 -0
- package/dist/gpu-physics/rigid-body-height-field.cjs +166 -0
- package/dist/gpu-physics/rigid-body-height-field.d.ts +55 -0
- package/dist/gpu-physics/rigid-body-height-field.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-height-field.js +184 -0
- package/dist/gpu-physics/rigid-body-height-field.js.map +1 -0
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.cjs +4 -2
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.js +4 -2
- package/dist/gpu-physics/rigid-body-mesh-query-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-mesh.cjs +72 -17
- package/dist/gpu-physics/rigid-body-mesh.d.ts +3 -0
- package/dist/gpu-physics/rigid-body-mesh.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-mesh.js +76 -20
- package/dist/gpu-physics/rigid-body-mesh.js.map +1 -1
- package/dist/gpu-physics/rigid-body-properties.cjs +4 -4
- package/dist/gpu-physics/rigid-body-properties.d.ts +6 -0
- package/dist/gpu-physics/rigid-body-properties.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-properties.js +1 -1
- package/dist/gpu-physics/rigid-body-properties.js.map +1 -1
- package/dist/gpu-physics/rigid-body-publication.cjs +2 -2
- package/dist/gpu-physics/rigid-body-publication.js +1 -1
- package/dist/gpu-physics/rigid-body-publication.js.map +1 -1
- package/dist/gpu-physics/rigid-body-query-geometry.cjs +22 -4
- package/dist/gpu-physics/rigid-body-query-geometry.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-query-geometry.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-query-geometry.js +22 -4
- package/dist/gpu-physics/rigid-body-query-geometry.js.map +1 -1
- package/dist/gpu-physics/rigid-body-shaders.cjs +11 -5
- package/dist/gpu-physics/rigid-body-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-shaders.js +14 -6
- package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-shape-properties.cjs +2 -0
- package/dist/gpu-physics/rigid-body-shape-properties.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-shape-properties.js +2 -0
- package/dist/gpu-physics/rigid-body-shape-properties.js.map +1 -1
- package/dist/gpu-physics/rigid-body-terrain-atlas.cjs +287 -0
- package/dist/gpu-physics/rigid-body-terrain-atlas.d.ts +87 -0
- package/dist/gpu-physics/rigid-body-terrain-atlas.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-atlas.js +275 -0
- package/dist/gpu-physics/rigid-body-terrain-atlas.js.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.cjs +240 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.d.ts +76 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.js +247 -0
- package/dist/gpu-physics/rigid-body-terrain-lod.js.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.cjs +215 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.d.ts +25 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.js +218 -0
- package/dist/gpu-physics/rigid-body-terrain-stitch.js.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.cjs +263 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.d.ts +97 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.js +250 -0
- package/dist/gpu-physics/rigid-body-terrain-stream.js.map +1 -0
- package/dist/gpu-physics/rigid-body-triggers.cjs +1 -0
- package/dist/gpu-physics/rigid-body-triggers.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-triggers.js +1 -0
- package/dist/gpu-physics/rigid-body-triggers.js.map +1 -1
- package/dist/gpu-physics/rigid-body-vehicle.cjs +99 -44
- package/dist/gpu-physics/rigid-body-vehicle.d.ts +15 -3
- package/dist/gpu-physics/rigid-body-vehicle.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-vehicle.js +93 -40
- package/dist/gpu-physics/rigid-body-vehicle.js.map +1 -1
- package/dist/gpu-project/cpu-geometry-pipelines.d.ts +1 -1
- package/dist/gpu-project/cpu-projection-operation.d.ts +1 -1
- package/dist/gpu-project/crs.cjs.map +2 -2
- package/dist/gpu-project/crs.d.ts +1 -1
- package/dist/gpu-project/projection-crs-benchmark.cjs +2 -2
- package/dist/gpu-project/projection-crs-benchmark.d.ts +1 -1
- package/dist/gpu-project/projection-crs-benchmark.js +1 -1
- package/dist/gpu-project/projection-crs-input.cjs +7 -7
- package/dist/gpu-project/projection-crs-input.d.ts +1 -1
- package/dist/gpu-project/projection-crs-input.js +4 -4
- package/dist/gpu-project/projection-engine.d.ts +2 -2
- package/dist/gpu-project-benchmarks.cjs +21 -0
- package/dist/gpu-project-benchmarks.d.ts +2 -0
- package/dist/gpu-project-benchmarks.d.ts.map +1 -0
- package/dist/gpu-project-benchmarks.js +5 -0
- package/dist/gpu-project-benchmarks.js.map +1 -0
- package/dist/gpu-project-crs.cjs +21 -0
- package/dist/gpu-project-crs.d.ts +2 -0
- package/dist/gpu-project-crs.d.ts.map +1 -0
- package/dist/gpu-project-crs.js +5 -0
- package/dist/gpu-project-crs.js.map +1 -0
- package/dist/gpu-project-geoarrow.cjs +21 -0
- package/dist/gpu-project-geoarrow.d.ts +2 -0
- package/dist/gpu-project-geoarrow.d.ts.map +1 -0
- package/dist/gpu-project-geoarrow.js +5 -0
- package/dist/gpu-project-geoarrow.js.map +1 -0
- package/dist/gpu-project-graph.cjs +21 -0
- package/dist/gpu-project-graph.d.ts +2 -0
- package/dist/gpu-project-graph.d.ts.map +1 -0
- package/dist/gpu-project-graph.js +5 -0
- package/dist/gpu-project-graph.js.map +1 -0
- package/dist/gpu-simple-graph/gpu-simple-graph-transfer.d.ts +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-transfer.d.ts.map +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-value.d.ts +1 -1
- package/dist/gpu-simple-graph/gpu-simple-graph-value.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts +1 -1
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operation/operation.d.ts +1 -1
- package/dist/gpu-simple-graph/operation/operation.d.ts.map +1 -1
- package/dist/gpu-simple-graph-cpu.cjs +21 -0
- package/dist/gpu-simple-graph-cpu.d.ts +2 -0
- package/dist/gpu-simple-graph-cpu.d.ts.map +1 -0
- package/dist/gpu-simple-graph-cpu.js +5 -0
- package/dist/gpu-simple-graph-cpu.js.map +1 -0
- package/dist/gpu-simple-graph-webgl.cjs +21 -0
- package/dist/gpu-simple-graph-webgl.d.ts +2 -0
- package/dist/gpu-simple-graph-webgl.d.ts.map +1 -0
- package/dist/gpu-simple-graph-webgl.js +5 -0
- package/dist/gpu-simple-graph-webgl.js.map +1 -0
- package/dist/gpu-simple-graph-webgpu.cjs +21 -0
- package/dist/gpu-simple-graph-webgpu.d.ts +2 -0
- package/dist/gpu-simple-graph-webgpu.d.ts.map +1 -0
- package/dist/gpu-simple-graph-webgpu.js +5 -0
- package/dist/gpu-simple-graph-webgpu.js.map +1 -0
- package/dist/gpu-sql/gpu-sql.cjs +76 -122
- package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
- package/dist/gpu-sql/gpu-sql.js +99 -130
- package/dist/gpu-sql/gpu-sql.js.map +1 -1
- package/dist/gpu-sql/index.cjs.map +2 -2
- package/package.json +19 -19
- package/src/experimental-models.ts +5 -0
- package/src/experimental-simulation.ts +5 -0
- package/src/gpu-dataframe/gpu-data-frame-query.ts +18 -5
- package/src/gpu-dataframe/gpu-expression-shader.ts +128 -7
- package/src/gpu-dataframe/gpu-expression.ts +124 -1
- package/src/gpu-dataframe/gpu-global-aggregation-compiler.ts +0 -1
- package/src/gpu-dataframe/gpu-global-aggregation-query.ts +5 -3
- package/src/gpu-dataframe/gpu-global-sort-compiler.ts +26 -12
- package/src/gpu-dataframe/gpu-group-aggregation-compiler.ts +0 -1
- package/src/gpu-dataframe/gpu-group-by-query.ts +5 -3
- package/src/gpu-dataframe/gpu-histogram-compiler.ts +0 -1
- package/src/gpu-dataframe/gpu-join-compiler.ts +0 -2
- package/src/gpu-dataframe/gpu-query-compiler.ts +3 -3
- package/src/gpu-dataframe/gpu-sort-compiler.ts +0 -1
- package/src/gpu-dataframe/gpu-sort-query.ts +31 -5
- package/src/gpu-dataframe/index.ts +15 -2
- package/src/gpu-dataframe/portable-expression.ts +81 -4
- package/src/gpu-dggs-benchmarks.ts +5 -0
- package/src/gpu-graph-algorithms-benchmarks.ts +5 -0
- package/src/gpu-physics/gpu-physics-ensemble-terrain.ts +114 -0
- package/src/gpu-physics/gpu-physics-ensemble.ts +147 -4
- package/src/gpu-physics/gpu-rigid-body-world.ts +668 -198
- package/src/gpu-physics/index.ts +37 -0
- package/src/gpu-physics/rigid-body-bounds-shaders.ts +16 -1
- package/src/gpu-physics/rigid-body-convex-shaders.ts +3 -2
- package/src/gpu-physics/rigid-body-ensemble-reset.ts +48 -8
- package/src/gpu-physics/rigid-body-ensemble-transaction.ts +34 -1
- package/src/gpu-physics/rigid-body-geometry.ts +49 -4
- package/src/gpu-physics/rigid-body-height-field-shader.ts +56 -0
- package/src/gpu-physics/rigid-body-height-field.ts +257 -0
- package/src/gpu-physics/rigid-body-mesh-query-shaders.ts +4 -2
- package/src/gpu-physics/rigid-body-mesh.ts +97 -26
- package/src/gpu-physics/rigid-body-properties.ts +5 -2
- package/src/gpu-physics/rigid-body-publication.ts +1 -1
- package/src/gpu-physics/rigid-body-query-geometry.ts +22 -4
- package/src/gpu-physics/rigid-body-shaders.ts +17 -6
- package/src/gpu-physics/rigid-body-shape-properties.ts +2 -0
- package/src/gpu-physics/rigid-body-terrain-atlas.ts +378 -0
- package/src/gpu-physics/rigid-body-terrain-lod.ts +332 -0
- package/src/gpu-physics/rigid-body-terrain-stitch.ts +286 -0
- package/src/gpu-physics/rigid-body-terrain-stream.ts +323 -0
- package/src/gpu-physics/rigid-body-triggers.ts +1 -0
- package/src/gpu-physics/rigid-body-vehicle.ts +108 -41
- package/src/gpu-project/README.md +2 -2
- package/src/gpu-project/cpu-geometry-pipelines.ts +1 -1
- package/src/gpu-project/cpu-projection-operation.ts +1 -1
- package/src/gpu-project/crs.ts +2 -2
- package/src/gpu-project/projection-crs-benchmark.ts +2 -2
- package/src/gpu-project/projection-crs-input.ts +4 -4
- package/src/gpu-project/projection-engine.ts +2 -2
- package/src/gpu-project-benchmarks.ts +5 -0
- package/src/gpu-project-crs.ts +5 -0
- package/src/gpu-project-geoarrow.ts +5 -0
- package/src/gpu-project-graph.ts +5 -0
- package/src/gpu-simple-graph/gpu-simple-graph-transfer.ts +1 -1
- package/src/gpu-simple-graph/gpu-simple-graph-value.ts +1 -1
- package/src/gpu-simple-graph/operation/gpu-data-evaluator.ts +1 -1
- package/src/gpu-simple-graph/operation/operation.ts +1 -1
- package/src/gpu-simple-graph/operations/swizzle.ts +1 -1
- package/src/gpu-simple-graph-cpu.ts +5 -0
- package/src/gpu-simple-graph-webgl.ts +5 -0
- package/src/gpu-simple-graph-webgpu.ts +5 -0
- package/src/gpu-sql/gpu-sql.ts +150 -152
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
isVertexListGPUVectorFormat,
|
|
22
22
|
type GPUVectorFormat
|
|
23
23
|
} from '@luma.gl/graph/gpu-data';
|
|
24
|
-
import type {TypedArray, TypedArrayConstructor} from '@math.gl/core';
|
|
24
|
+
import type {TypedArray, TypedArrayConstructor} from '@math.gl/core/types';
|
|
25
25
|
import {bufferPool} from '../utils/buffer-pool';
|
|
26
26
|
import type {Operation} from './operation';
|
|
27
27
|
import type {GPUEvaluationScope} from './gpu-evaluation-scope';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import type {Device, Buffer} from '@luma.gl/core';
|
|
6
|
-
import type {TypedArray} from '@math.gl/core';
|
|
6
|
+
import type {TypedArray} from '@math.gl/core/types';
|
|
7
7
|
import {GPUDataEvaluator} from './gpu-data-evaluator';
|
|
8
8
|
import {backendRegistry} from './backend-registry';
|
|
9
9
|
import type {GPUEvaluationScope} from './gpu-evaluation-scope';
|
package/src/gpu-sql/gpu-sql.ts
CHANGED
|
@@ -11,10 +11,11 @@ import {GPUDataFrameQuery} from '../gpu-dataframe/gpu-data-frame-query';
|
|
|
11
11
|
import {
|
|
12
12
|
GPUExpression,
|
|
13
13
|
column,
|
|
14
|
-
|
|
14
|
+
isGPUScalarFunction,
|
|
15
15
|
parameter,
|
|
16
16
|
type GPUExpressionNode
|
|
17
17
|
} from '../gpu-dataframe/gpu-expression';
|
|
18
|
+
import {lowerPortableExpression} from '../gpu-dataframe/portable-expression';
|
|
18
19
|
import type {GPUDataFrameJoinType} from '../gpu-dataframe/gpu-join-query';
|
|
19
20
|
import type {
|
|
20
21
|
CompiledGPUDataFrameQuery,
|
|
@@ -27,10 +28,13 @@ export type GPUSQLTables = Readonly<Record<string, GPUDataFrame>>;
|
|
|
27
28
|
/** Defaults for named SQL parameters such as `:minimumFare`; values remain caller-controlled. */
|
|
28
29
|
export type GPUSQLQueryOptions = Readonly<{parameters?: GPUDataFrameQueryParameters}>;
|
|
29
30
|
|
|
31
|
+
/** A source column name with its optional, separately parsed table qualifier. */
|
|
32
|
+
type GPUSQLColumnReference = Readonly<{name: string; qualifier?: string}>;
|
|
33
|
+
|
|
30
34
|
type GPUSQLSelectItem = Readonly<{
|
|
31
|
-
expression?:
|
|
35
|
+
expression?: Expression;
|
|
32
36
|
aggregate?: 'count' | 'sum' | 'min' | 'max' | 'mean';
|
|
33
|
-
aggregateColumn?:
|
|
37
|
+
aggregateColumn?: GPUSQLColumnReference;
|
|
34
38
|
alias?: string;
|
|
35
39
|
star?: boolean;
|
|
36
40
|
}>;
|
|
@@ -42,17 +46,18 @@ type GPUSQLStatement = Readonly<{
|
|
|
42
46
|
type: GPUDataFrameJoinType;
|
|
43
47
|
table: string;
|
|
44
48
|
alias?: string;
|
|
45
|
-
left:
|
|
46
|
-
right:
|
|
49
|
+
left: GPUSQLColumnReference;
|
|
50
|
+
right: GPUSQLColumnReference;
|
|
47
51
|
}>;
|
|
48
|
-
predicate?:
|
|
49
|
-
groupBy?:
|
|
52
|
+
predicate?: Expression;
|
|
53
|
+
groupBy?: GPUSQLColumnReference;
|
|
50
54
|
orderBy?: Readonly<{
|
|
51
|
-
column:
|
|
55
|
+
column: GPUSQLColumnReference;
|
|
52
56
|
direction: 'ascending' | 'descending';
|
|
53
57
|
nulls?: 'first' | 'last';
|
|
54
58
|
}>;
|
|
55
59
|
limit?: number;
|
|
60
|
+
offset?: number;
|
|
56
61
|
}>;
|
|
57
62
|
|
|
58
63
|
type GPUSQLCompiledPlan = Readonly<{
|
|
@@ -66,7 +71,6 @@ type GPUSQLAggregationDefinitions = Record<
|
|
|
66
71
|
|
|
67
72
|
/** Runtime-validated SQL names cross the strongly typed dataframe boundary exactly once. */
|
|
68
73
|
type GPUSQLDynamicQuery = GPUSQLCompiledPlan & {
|
|
69
|
-
predicates: readonly GPUExpression<boolean, string>[];
|
|
70
74
|
filter: (predicate: GPUExpression<boolean, string>) => GPUSQLDynamicQuery;
|
|
71
75
|
select: (names: readonly string[]) => GPUSQLDynamicQuery;
|
|
72
76
|
withColumn: (
|
|
@@ -80,7 +84,7 @@ type GPUSQLDynamicQuery = GPUSQLCompiledPlan & {
|
|
|
80
84
|
sortByGlobal: (
|
|
81
85
|
name: string,
|
|
82
86
|
options: {direction: 'ascending' | 'descending'; nulls?: 'first' | 'last'}
|
|
83
|
-
) => GPUSQLCompiledPlan & {
|
|
87
|
+
) => GPUSQLCompiledPlan & {page: (offset: number, limit?: number) => GPUSQLCompiledPlan};
|
|
84
88
|
innerJoin: (
|
|
85
89
|
right: GPUDataFrame,
|
|
86
90
|
options: {leftOn: string; rightOn: string}
|
|
@@ -115,8 +119,11 @@ export class GPUSQLContext {
|
|
|
115
119
|
|
|
116
120
|
/** Parses and validates one immutable SELECT plan without touching registered GPU sources. */
|
|
117
121
|
query(source: string, options: GPUSQLQueryOptions = {}): GPUSQLQuery {
|
|
118
|
-
const statement = parseGPUSQLStatement(source
|
|
119
|
-
return new GPUSQLQuery(
|
|
122
|
+
const statement = parseGPUSQLStatement(source);
|
|
123
|
+
return new GPUSQLQuery(
|
|
124
|
+
source,
|
|
125
|
+
buildGPUSQLPlan(this.tables, statement, options.parameters ?? {})
|
|
126
|
+
);
|
|
120
127
|
}
|
|
121
128
|
}
|
|
122
129
|
|
|
@@ -141,32 +148,42 @@ export class GPUSQLQuery {
|
|
|
141
148
|
|
|
142
149
|
function buildGPUSQLPlan(
|
|
143
150
|
tables: Readonly<Record<string, GPUDataFrame>>,
|
|
144
|
-
statement: GPUSQLStatement
|
|
151
|
+
statement: GPUSQLStatement,
|
|
152
|
+
parameters: GPUDataFrameQueryParameters
|
|
145
153
|
): GPUSQLCompiledPlan {
|
|
146
154
|
const frame = tables[statement.table.toLowerCase()];
|
|
147
155
|
if (!frame) throw new Error(`GPUSQL table "${statement.table}" is not registered`);
|
|
148
156
|
let query = new GPUDataFrameQuery(frame, [], frame.columnNames) as unknown as GPUSQLDynamicQuery;
|
|
149
157
|
const qualifier = statement.alias ?? statement.table;
|
|
150
|
-
const resolve = (
|
|
158
|
+
const resolve = (reference: GPUSQLColumnReference): string =>
|
|
159
|
+
resolveGPUSQLColumn(reference, qualifier, frame.columnNames);
|
|
151
160
|
if (statement.predicate) {
|
|
152
161
|
query = query.filter(
|
|
153
|
-
new GPUExpression<boolean, string>(
|
|
162
|
+
new GPUExpression<boolean, string>(
|
|
163
|
+
lowerSQLExpression(statement.predicate, parameters, resolve)
|
|
164
|
+
)
|
|
154
165
|
);
|
|
155
166
|
}
|
|
156
167
|
|
|
157
168
|
const aggregates = statement.items.filter(item => item.aggregate);
|
|
158
169
|
if (aggregates.length > 0) {
|
|
159
|
-
if (
|
|
160
|
-
|
|
170
|
+
if (
|
|
171
|
+
statement.join ||
|
|
172
|
+
statement.orderBy ||
|
|
173
|
+
statement.limit !== undefined ||
|
|
174
|
+
statement.offset !== undefined
|
|
175
|
+
) {
|
|
176
|
+
throw new Error('GPUSQL aggregate queries do not yet support joins, ordering, or pagination');
|
|
161
177
|
}
|
|
162
178
|
const definitions: GPUSQLAggregationDefinitions = {};
|
|
163
179
|
for (const item of aggregates) {
|
|
164
|
-
const
|
|
180
|
+
const inputColumn = item.aggregateColumn && resolve(item.aggregateColumn);
|
|
181
|
+
const name = item.alias ?? `${item.aggregate}_${inputColumn ?? 'all'}`;
|
|
165
182
|
if (definitions[name]) throw new Error(`GPUSQL aggregate alias "${name}" is duplicated`);
|
|
166
183
|
definitions[name] =
|
|
167
184
|
item.aggregate === 'count'
|
|
168
185
|
? 'count'
|
|
169
|
-
: ({[item.aggregate!]:
|
|
186
|
+
: ({[item.aggregate!]: inputColumn!} as
|
|
170
187
|
| {sum: string}
|
|
171
188
|
| {min: string}
|
|
172
189
|
| {max: string}
|
|
@@ -198,7 +215,7 @@ function buildGPUSQLPlan(
|
|
|
198
215
|
selected.push(...frame.columnNames);
|
|
199
216
|
continue;
|
|
200
217
|
}
|
|
201
|
-
const node =
|
|
218
|
+
const node = lowerSQLExpression(item.expression!, parameters, resolve);
|
|
202
219
|
const name = item.alias ?? (node.kind === 'column' ? node.name : undefined);
|
|
203
220
|
if (!name) throw new Error('GPUSQL computed SELECT expressions require an explicit AS alias');
|
|
204
221
|
if (selected.includes(name)) throw new Error(`GPUSQL output column "${name}" is duplicated`);
|
|
@@ -212,14 +229,25 @@ function buildGPUSQLPlan(
|
|
|
212
229
|
}
|
|
213
230
|
|
|
214
231
|
if (statement.join) {
|
|
215
|
-
if (statement.orderBy || statement.limit !== undefined) {
|
|
216
|
-
throw new Error('GPUSQL joined results do not yet support ORDER BY or
|
|
232
|
+
if (statement.orderBy || statement.limit !== undefined || statement.offset !== undefined) {
|
|
233
|
+
throw new Error('GPUSQL joined results do not yet support ORDER BY or pagination');
|
|
217
234
|
}
|
|
218
235
|
const right = tables[statement.join.table.toLowerCase()];
|
|
219
236
|
if (!right) throw new Error(`GPUSQL table "${statement.join.table}" is not registered`);
|
|
220
|
-
const leftKey = resolve(statement.join.left);
|
|
221
237
|
const rightQualifier = statement.join.alias ?? statement.join.table;
|
|
222
|
-
const
|
|
238
|
+
const {left: firstOperand, right: secondOperand} = statement.join;
|
|
239
|
+
const matchesLeft = (reference: GPUSQLColumnReference) =>
|
|
240
|
+
matchesGPUSQLColumn(reference, qualifier, frame.columnNames);
|
|
241
|
+
const matchesRight = (reference: GPUSQLColumnReference) =>
|
|
242
|
+
matchesGPUSQLColumn(reference, rightQualifier, right.columnNames);
|
|
243
|
+
const forward = matchesLeft(firstOperand) && matchesRight(secondOperand);
|
|
244
|
+
const reversed = !forward && matchesLeft(secondOperand) && matchesRight(firstOperand);
|
|
245
|
+
const leftKey = resolve(reversed ? secondOperand : firstOperand);
|
|
246
|
+
const rightKey = resolveGPUSQLColumn(
|
|
247
|
+
reversed ? firstOperand : secondOperand,
|
|
248
|
+
rightQualifier,
|
|
249
|
+
right.columnNames
|
|
250
|
+
);
|
|
223
251
|
if (!selected.includes(leftKey)) {
|
|
224
252
|
throw new Error('GPUSQL joins require the left join key to remain selected');
|
|
225
253
|
}
|
|
@@ -239,7 +267,10 @@ function buildGPUSQLPlan(
|
|
|
239
267
|
|
|
240
268
|
if (statement.orderBy) {
|
|
241
269
|
const {column: requested, direction, nulls} = statement.orderBy;
|
|
242
|
-
const orderColumn =
|
|
270
|
+
const orderColumn =
|
|
271
|
+
requested.qualifier === undefined && selected.includes(requested.name)
|
|
272
|
+
? requested.name
|
|
273
|
+
: resolve(requested);
|
|
243
274
|
if (!selected.includes(orderColumn)) {
|
|
244
275
|
throw new Error('GPUSQL ORDER BY requires the sort column in the SELECT projection');
|
|
245
276
|
}
|
|
@@ -247,68 +278,72 @@ function buildGPUSQLPlan(
|
|
|
247
278
|
direction,
|
|
248
279
|
...(nulls ? {nulls} : {})
|
|
249
280
|
});
|
|
250
|
-
return statement.limit === undefined
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
if (query.predicates.length === 0) {
|
|
254
|
-
const firstColumn = frame.columnNames[0];
|
|
255
|
-
if (!firstColumn) throw new Error('GPUSQL SELECT requires at least one GPU source column');
|
|
256
|
-
query = query.filter(column(firstColumn).isValid().or(column(firstColumn).isNull()));
|
|
281
|
+
return statement.limit === undefined && statement.offset === undefined
|
|
282
|
+
? sort
|
|
283
|
+
: sort.page(statement.offset ?? 0, statement.limit);
|
|
257
284
|
}
|
|
285
|
+
if (statement.limit !== undefined || statement.offset !== undefined)
|
|
286
|
+
throw new Error('GPUSQL LIMIT or OFFSET currently requires ORDER BY');
|
|
258
287
|
return query.select(selected);
|
|
259
288
|
}
|
|
260
289
|
|
|
290
|
+
/** Resolves the only non-aggregate item in a grouped projection. */
|
|
261
291
|
function resolveGPUSQLProjectionName(
|
|
262
292
|
item: GPUSQLSelectItem,
|
|
263
|
-
resolve: (
|
|
293
|
+
resolve: (reference: GPUSQLColumnReference) => string
|
|
264
294
|
): string {
|
|
265
|
-
if (item.expression?.
|
|
295
|
+
if (item.expression?.type !== 'Identifier' && item.expression?.type !== 'MemberExpression') {
|
|
266
296
|
throw new Error('GPUSQL grouped source expressions must reference the group key directly');
|
|
267
297
|
}
|
|
268
|
-
return resolve(item.expression
|
|
298
|
+
return resolve(readGPUSQLColumn(item.expression));
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** Formats the source spelling for diagnostics. */
|
|
302
|
+
function formatGPUSQLColumn({name, qualifier}: GPUSQLColumnReference): string {
|
|
303
|
+
return qualifier === undefined ? name : qualifier + '.' + name;
|
|
269
304
|
}
|
|
270
305
|
|
|
271
|
-
|
|
272
|
-
|
|
306
|
+
/** Checks whether a join operand can bind to one side of the join. */
|
|
307
|
+
function matchesGPUSQLColumn(
|
|
308
|
+
reference: GPUSQLColumnReference,
|
|
309
|
+
qualifier: string,
|
|
310
|
+
columns: readonly string[]
|
|
311
|
+
): boolean {
|
|
312
|
+
return (
|
|
313
|
+
(reference.qualifier === undefined ||
|
|
314
|
+
reference.qualifier.toLowerCase() === qualifier.toLowerCase()) &&
|
|
315
|
+
columns.includes(reference.name)
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/** Binds a parsed reference to an exact dataframe field. */
|
|
320
|
+
function resolveGPUSQLColumn(
|
|
321
|
+
reference: GPUSQLColumnReference,
|
|
322
|
+
qualifier: string,
|
|
323
|
+
columns: readonly string[]
|
|
324
|
+
): string {
|
|
273
325
|
if (
|
|
274
|
-
|
|
275
|
-
|
|
326
|
+
reference.qualifier !== undefined &&
|
|
327
|
+
reference.qualifier.toLowerCase() !== qualifier.toLowerCase()
|
|
276
328
|
) {
|
|
277
|
-
throw new Error(
|
|
329
|
+
throw new Error(
|
|
330
|
+
'GPUSQL column "' + formatGPUSQLColumn(reference) + '" has an unknown table qualifier'
|
|
331
|
+
);
|
|
278
332
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
return requested;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function resolveGPUSQLExpression(
|
|
285
|
-
expression: GPUExpressionNode,
|
|
286
|
-
resolve: (name: string) => string
|
|
287
|
-
): GPUExpressionNode {
|
|
288
|
-
switch (expression.kind) {
|
|
289
|
-
case 'column':
|
|
290
|
-
return {kind: 'column', name: resolve(expression.name)};
|
|
291
|
-
case 'unary':
|
|
292
|
-
return {...expression, operand: resolveGPUSQLExpression(expression.operand, resolve)};
|
|
293
|
-
case 'binary':
|
|
294
|
-
return {
|
|
295
|
-
...expression,
|
|
296
|
-
left: resolveGPUSQLExpression(expression.left, resolve),
|
|
297
|
-
right: resolveGPUSQLExpression(expression.right, resolve)
|
|
298
|
-
};
|
|
299
|
-
default:
|
|
300
|
-
return expression;
|
|
333
|
+
if (!columns.includes(reference.name)) {
|
|
334
|
+
throw new Error('GPUSQL column "' + formatGPUSQLColumn(reference) + '" does not exist');
|
|
301
335
|
}
|
|
336
|
+
return reference.name;
|
|
302
337
|
}
|
|
303
338
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
parameters: GPUDataFrameQueryParameters
|
|
307
|
-
): GPUSQLStatement {
|
|
339
|
+
/** Parses the SQL subset supported by the GPU relational planner. */
|
|
340
|
+
function parseGPUSQLStatement(source: string): GPUSQLStatement {
|
|
308
341
|
const statement = parseSQLSelectStatement(source, {
|
|
309
342
|
parseParameter: name => ({type: 'Identifier', name, gpuSQLParameter: true})
|
|
310
343
|
});
|
|
311
|
-
if (statement.offset !== undefined
|
|
344
|
+
if (statement.offset !== undefined && statement.offset > 0xffffffff) {
|
|
345
|
+
throw new Error('GPUSQL OFFSET must fit an unsigned 32-bit row count');
|
|
346
|
+
}
|
|
312
347
|
if (statement.joins.length > 1) throw new Error('GPUSQL currently supports one JOIN');
|
|
313
348
|
if ((statement.groupBy?.length ?? 0) > 1) {
|
|
314
349
|
throw new Error('GPUSQL currently supports one GROUP BY column');
|
|
@@ -345,7 +380,7 @@ function parseGPUSQLStatement(
|
|
|
345
380
|
}
|
|
346
381
|
}
|
|
347
382
|
}
|
|
348
|
-
return {expression
|
|
383
|
+
return {expression, alias};
|
|
349
384
|
}) ?? [{star: true}];
|
|
350
385
|
const join = statement.joins[0];
|
|
351
386
|
if (statement.from.inputTable !== undefined || join?.table.inputTable !== undefined) {
|
|
@@ -372,26 +407,25 @@ function parseGPUSQLStatement(
|
|
|
372
407
|
table: statement.from.name,
|
|
373
408
|
alias: statement.from.alias,
|
|
374
409
|
join: loweredJoin,
|
|
375
|
-
predicate: statement.where
|
|
410
|
+
predicate: statement.where as Expression | undefined,
|
|
376
411
|
groupBy: statement.groupBy?.[0] && readGPUSQLColumn(statement.groupBy[0]),
|
|
377
412
|
orderBy: sort && {
|
|
378
413
|
column: readGPUSQLColumn(sort.expression),
|
|
379
414
|
direction: sort.direction === 'desc' ? 'descending' : 'ascending',
|
|
380
415
|
nulls: sort.nulls
|
|
381
416
|
},
|
|
417
|
+
offset: statement.offset,
|
|
382
418
|
limit: statement.limit
|
|
383
419
|
};
|
|
384
420
|
}
|
|
385
421
|
|
|
386
422
|
/** Reads a source column name or a two-part qualified column reference. */
|
|
387
|
-
function readGPUSQLColumn(
|
|
423
|
+
function readGPUSQLColumn(
|
|
424
|
+
node: Extract<Expression, {type: 'BinaryExpression'}>['left']
|
|
425
|
+
): GPUSQLColumnReference {
|
|
388
426
|
const expression = node as Expression;
|
|
389
|
-
if (
|
|
390
|
-
expression.
|
|
391
|
-
!('gpuSQLParameter' in expression) &&
|
|
392
|
-
!expression.name.includes('.')
|
|
393
|
-
) {
|
|
394
|
-
return expression.name;
|
|
427
|
+
if (expression.type === 'Identifier' && !('gpuSQLParameter' in expression)) {
|
|
428
|
+
return {name: expression.name};
|
|
395
429
|
}
|
|
396
430
|
if (expression.type === 'MemberExpression' && !expression.computed) {
|
|
397
431
|
const object = expression.object as Expression;
|
|
@@ -400,95 +434,59 @@ function readGPUSQLColumn(node: Extract<Expression, {type: 'BinaryExpression'}>[
|
|
|
400
434
|
object.type === 'Identifier' &&
|
|
401
435
|
property.type === 'Identifier' &&
|
|
402
436
|
!('gpuSQLParameter' in object) &&
|
|
403
|
-
!
|
|
404
|
-
!property.name.includes('.')
|
|
437
|
+
!('gpuSQLParameter' in property)
|
|
405
438
|
) {
|
|
406
|
-
return
|
|
439
|
+
return {qualifier: object.name, name: property.name};
|
|
407
440
|
}
|
|
408
441
|
}
|
|
409
442
|
throw new Error('GPUSQL expected a table or column identifier');
|
|
410
443
|
}
|
|
411
444
|
|
|
412
|
-
const SQL_BINARY_OPERATORS: Readonly<
|
|
413
|
-
Partial<Record<string, Extract<GPUExpressionNode, {kind: 'binary'}>['operator']>>
|
|
414
|
-
> = {
|
|
415
|
-
'||': 'or',
|
|
416
|
-
'&&': 'and',
|
|
417
|
-
'==': 'equal',
|
|
418
|
-
'!=': 'not-equal',
|
|
419
|
-
'>': 'greater-than',
|
|
420
|
-
'>=': 'greater-than-or-equal',
|
|
421
|
-
'<': 'less-than',
|
|
422
|
-
'<=': 'less-than-or-equal',
|
|
423
|
-
'+': 'add',
|
|
424
|
-
'-': 'subtract',
|
|
425
|
-
'*': 'multiply',
|
|
426
|
-
'/': 'divide'
|
|
427
|
-
};
|
|
428
|
-
|
|
429
445
|
function lowerSQLExpression(
|
|
430
446
|
node: Extract<Expression, {type: 'BinaryExpression'}>['left'],
|
|
431
|
-
parameters: GPUDataFrameQueryParameters
|
|
447
|
+
parameters: GPUDataFrameQueryParameters,
|
|
448
|
+
resolve: (reference: GPUSQLColumnReference) => string
|
|
432
449
|
): GPUExpressionNode {
|
|
433
|
-
// math.gl types child nodes as generic expressions, though the SQL parser emits the AST union.
|
|
434
450
|
const expression = node as Expression;
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
if (
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
case 'MemberExpression':
|
|
445
|
-
return column(readGPUSQLColumn(expression)).node;
|
|
446
|
-
case 'Literal': {
|
|
447
|
-
const value = expression.value;
|
|
448
|
-
if (
|
|
449
|
-
value === null ||
|
|
450
|
-
typeof value === 'boolean' ||
|
|
451
|
-
(typeof value === 'number' && Number.isFinite(value))
|
|
452
|
-
) {
|
|
453
|
-
return literal(value).node;
|
|
451
|
+
try {
|
|
452
|
+
return lowerPortableExpression(expression, leaf => {
|
|
453
|
+
if (leaf.type === 'Identifier' && 'gpuSQLParameter' in leaf) {
|
|
454
|
+
const name = leaf.name;
|
|
455
|
+
if (!Object.hasOwn(parameters, name)) {
|
|
456
|
+
throw new Error(`GPUSQL parameter ":${name}" requires an explicit default`);
|
|
457
|
+
}
|
|
458
|
+
return parameter(name, parameters[name]).node;
|
|
454
459
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
case 'UnaryExpression':
|
|
458
|
-
if (expression.operator === '!' || expression.operator === '-') {
|
|
459
|
-
return {
|
|
460
|
-
kind: 'unary',
|
|
461
|
-
operator: expression.operator === '!' ? 'not' : 'negate',
|
|
462
|
-
operand: lowerSQLExpression(expression.argument, parameters)
|
|
463
|
-
};
|
|
460
|
+
if (leaf.type === 'Identifier' || leaf.type === 'MemberExpression') {
|
|
461
|
+
return column(resolve(readGPUSQLColumn(leaf))).node;
|
|
464
462
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
463
|
+
if (leaf.type === 'CallExpression' && leaf.callee.type === 'Identifier') {
|
|
464
|
+
const name = leaf.callee['name'];
|
|
465
|
+
const functionName =
|
|
466
|
+
typeof name === 'string' && leaf['sqlFunction'] === true ? name.toLowerCase() : name;
|
|
467
|
+
if (
|
|
468
|
+
name !== 'isNull' &&
|
|
469
|
+
name !== 'isNotNull' &&
|
|
470
|
+
name !== 'in' &&
|
|
471
|
+
name !== 'cast' &&
|
|
472
|
+
functionName !== 'coalesce' &&
|
|
473
|
+
functionName !== 'nullif' &&
|
|
474
|
+
!isGPUScalarFunction(functionName)
|
|
475
|
+
) {
|
|
476
|
+
throw new Error(`GPUSQL does not support SQL expression "${name}"`);
|
|
477
|
+
}
|
|
475
478
|
}
|
|
476
|
-
|
|
479
|
+
return undefined;
|
|
480
|
+
});
|
|
481
|
+
} catch (error) {
|
|
482
|
+
if (
|
|
483
|
+
error instanceof Error &&
|
|
484
|
+
error.message === 'Unsupported portable GPU dataframe expression'
|
|
485
|
+
) {
|
|
486
|
+
throw new Error(`GPUSQL does not support SQL expression "${expression.type}"`, {
|
|
487
|
+
cause: error
|
|
488
|
+
});
|
|
477
489
|
}
|
|
478
|
-
|
|
479
|
-
if (
|
|
480
|
-
expression.arguments.length === 1 &&
|
|
481
|
-
(expression.callee['name'] === 'isNull' || expression.callee['name'] === 'isNotNull')
|
|
482
|
-
) {
|
|
483
|
-
return {
|
|
484
|
-
kind: 'unary',
|
|
485
|
-
operator: expression.callee['name'] === 'isNull' ? 'is-null' : 'is-valid',
|
|
486
|
-
operand: lowerSQLExpression(expression.arguments[0], parameters)
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
break;
|
|
490
|
-
default:
|
|
491
|
-
break;
|
|
490
|
+
throw error;
|
|
492
491
|
}
|
|
493
|
-
throw new Error(`GPUSQL does not support SQL expression "${expression.type}"`);
|
|
494
492
|
}
|