@luma.gl/graph 10.0.0-alpha.13 → 10.0.0-alpha.15
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/arrow/arrow-colors.cjs +99 -18
- package/dist/arrow/arrow-colors.d.ts +27 -10
- package/dist/arrow/arrow-colors.d.ts.map +1 -1
- package/dist/arrow/arrow-colors.js +107 -24
- package/dist/arrow/arrow-colors.js.map +1 -1
- package/dist/arrow/gpu/arrow-column-gpu-vector.cjs +27 -8
- package/dist/arrow/gpu/arrow-column-gpu-vector.d.ts +11 -1
- package/dist/arrow/gpu/arrow-column-gpu-vector.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-column-gpu-vector.js +33 -8
- package/dist/arrow/gpu/arrow-column-gpu-vector.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.cjs +2 -0
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.d.ts +1 -0
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.js +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-adapters.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.cjs +32 -3
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts +6 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.js +37 -3
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.js.map +1 -1
- package/dist/arrow/index.cjs +2 -0
- package/dist/arrow/index.cjs.map +3 -3
- package/dist/arrow/index.d.ts +1 -1
- package/dist/arrow/index.d.ts.map +1 -1
- package/dist/arrow/index.js +1 -1
- package/dist/arrow/index.js.map +1 -1
- package/dist/dist.dev.js +98 -43
- package/dist/dist.min.js +63 -63
- package/dist/experimental/index.cjs.map +1 -1
- package/dist/experimental/simulation/index.cjs.map +1 -1
- package/dist/geospatial/gpu-point-spatial-query.cjs +2 -15
- package/dist/geospatial/gpu-point-spatial-query.d.ts.map +1 -1
- package/dist/geospatial/gpu-point-spatial-query.js +2 -15
- package/dist/geospatial/gpu-point-spatial-query.js.map +1 -1
- package/dist/geospatial/index.cjs.map +2 -2
- package/dist/gpu-a5/index.cjs.map +1 -1
- package/dist/gpu-core/gpu-command-graph-compiler.cjs +11 -2
- package/dist/gpu-core/gpu-command-graph-compiler.d.ts +2 -1
- package/dist/gpu-core/gpu-command-graph-compiler.d.ts.map +1 -1
- package/dist/gpu-core/gpu-command-graph-compiler.js +13 -2
- package/dist/gpu-core/gpu-command-graph-compiler.js.map +1 -1
- package/dist/gpu-core/gpu-command-graph-types.d.ts +16 -1
- package/dist/gpu-core/gpu-command-graph-types.d.ts.map +1 -1
- package/dist/gpu-core/gpu-command-graph-types.js.map +1 -1
- package/dist/gpu-core/gpu-command-graph.cjs +6 -4
- package/dist/gpu-core/gpu-command-graph.d.ts +4 -4
- package/dist/gpu-core/gpu-command-graph.d.ts.map +1 -1
- package/dist/gpu-core/gpu-command-graph.js +6 -4
- package/dist/gpu-core/gpu-command-graph.js.map +1 -1
- package/dist/gpu-core/gpu-dispatch-utils.cjs +7 -3
- package/dist/gpu-core/gpu-dispatch-utils.d.ts +2 -0
- package/dist/gpu-core/gpu-dispatch-utils.d.ts.map +1 -1
- package/dist/gpu-core/gpu-dispatch-utils.js +4 -1
- package/dist/gpu-core/gpu-dispatch-utils.js.map +1 -1
- package/dist/gpu-core/gpu-expression-operation.cjs +1 -1
- package/dist/gpu-core/gpu-expression-operation.d.ts +1 -1
- package/dist/gpu-core/gpu-expression-operation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-expression-operation.js +1 -1
- package/dist/gpu-core/gpu-expression-operation.js.map +1 -1
- package/dist/gpu-core/gpu-grid-aggregation.cjs +2 -5
- package/dist/gpu-core/gpu-grid-aggregation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-aggregation.js +2 -5
- package/dist/gpu-core/gpu-grid-aggregation.js.map +1 -1
- package/dist/gpu-core/gpu-grid-binning.cjs +2 -5
- package/dist/gpu-core/gpu-grid-binning.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-binning.js +2 -5
- package/dist/gpu-core/gpu-grid-binning.js.map +1 -1
- package/dist/gpu-core/gpu-grid-coordinate.cjs +41 -0
- package/dist/gpu-core/gpu-grid-coordinate.d.ts +7 -0
- package/dist/gpu-core/gpu-grid-coordinate.d.ts.map +1 -0
- package/dist/gpu-core/gpu-grid-coordinate.js +24 -0
- package/dist/gpu-core/gpu-grid-coordinate.js.map +1 -0
- package/dist/gpu-core/gpu-grid-index-internals.cjs +2 -15
- package/dist/gpu-core/gpu-grid-index-internals.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-index-internals.js +2 -15
- package/dist/gpu-core/gpu-grid-index-internals.js.map +1 -1
- package/dist/gpu-core/gpu-grid-index-query.cjs +2 -16
- package/dist/gpu-core/gpu-grid-index-query.d.ts.map +1 -1
- package/dist/gpu-core/gpu-grid-index-query.js +2 -16
- package/dist/gpu-core/gpu-grid-index-query.js.map +1 -1
- package/dist/gpu-core/gpu-scan.cjs +46 -32
- package/dist/gpu-core/gpu-scan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-scan.js +56 -44
- package/dist/gpu-core/gpu-scan.js.map +1 -1
- package/dist/gpu-core/gpu-segmented-reduction.cjs +12 -9
- package/dist/gpu-core/gpu-segmented-reduction.d.ts +1 -1
- package/dist/gpu-core/gpu-segmented-reduction.d.ts.map +1 -1
- package/dist/gpu-core/gpu-segmented-reduction.js +12 -9
- package/dist/gpu-core/gpu-segmented-reduction.js.map +1 -1
- package/dist/gpu-core/gpu-segmented-scan.cjs +73 -16
- package/dist/gpu-core/gpu-segmented-scan.d.ts.map +1 -1
- package/dist/gpu-core/gpu-segmented-scan.js +73 -16
- package/dist/gpu-core/gpu-segmented-scan.js.map +1 -1
- package/dist/gpu-core/index.cjs +18 -0
- package/dist/gpu-core/index.cjs.map +3 -3
- package/dist/gpu-core/index.d.ts +13 -1
- package/dist/gpu-core/index.d.ts.map +1 -1
- package/dist/gpu-core/index.js +6 -0
- package/dist/gpu-core/index.js.map +1 -1
- package/dist/gpu-data/color-conversion.cjs +105 -0
- package/dist/gpu-data/color-conversion.d.ts +30 -0
- package/dist/gpu-data/color-conversion.d.ts.map +1 -0
- package/dist/gpu-data/color-conversion.js +109 -0
- package/dist/gpu-data/color-conversion.js.map +1 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.cjs +50 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.d.ts +41 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.d.ts.map +1 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.js +45 -0
- package/dist/gpu-data/gpu-vector-wgsl-layout.js.map +1 -0
- package/dist/gpu-data/index.cjs +10 -2
- package/dist/gpu-data/index.cjs.map +3 -3
- package/dist/gpu-data/index.d.ts +3 -0
- package/dist/gpu-data/index.d.ts.map +1 -1
- package/dist/gpu-data/index.js +2 -0
- package/dist/gpu-data/index.js.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.cjs +1 -16
- package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.js +1 -23
- package/dist/gpu-dataframe/gpu-data-frame-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.cjs +91 -2
- package/dist/gpu-dataframe/gpu-expression.d.ts +37 -0
- package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.js +106 -0
- package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
- package/dist/gpu-dataframe/index.cjs +12 -2
- package/dist/gpu-dataframe/index.cjs.map +3 -3
- package/dist/gpu-dataframe/index.d.ts +4 -0
- package/dist/gpu-dataframe/index.d.ts.map +1 -1
- package/dist/gpu-dataframe/index.js +2 -0
- package/dist/gpu-dataframe/index.js.map +1 -1
- package/dist/gpu-dataframe/portable-expression.cjs +103 -0
- package/dist/gpu-dataframe/portable-expression.d.ts +19 -0
- package/dist/gpu-dataframe/portable-expression.d.ts.map +1 -0
- package/dist/gpu-dataframe/portable-expression.js +98 -0
- package/dist/gpu-dataframe/portable-expression.js.map +1 -0
- package/dist/gpu-dggs/benchmarks.cjs.map +1 -1
- package/dist/gpu-dggs/index.cjs.map +1 -1
- package/dist/gpu-geometry/index.cjs.map +1 -1
- package/dist/gpu-graph/index.cjs.map +1 -1
- package/dist/gpu-graph-algorithms/benchmarks.cjs.map +2 -2
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.cjs +2 -15
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.d.ts.map +1 -1
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.js +2 -15
- package/dist/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.js.map +1 -1
- package/dist/gpu-graph-algorithms/index.cjs.map +2 -2
- package/dist/gpu-h3/index.cjs.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.cjs +3 -1
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts +4 -0
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.js +3 -1
- package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
- package/dist/gpu-physics/index.cjs.map +1 -1
- package/dist/gpu-physics/rigid-body-parallel-shaders.cjs +24 -9
- package/dist/gpu-physics/rigid-body-parallel-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-parallel-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-parallel-shaders.js +28 -9
- package/dist/gpu-physics/rigid-body-parallel-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-shaders.cjs +2 -2
- 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 +2 -2
- package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
- package/dist/gpu-pointcloud/index.cjs.map +1 -1
- package/dist/gpu-project/graph.cjs.map +3 -3
- package/dist/gpu-simple-graph/index.cjs.map +3 -3
- package/dist/gpu-simple-graph/index.d.ts +1 -1
- package/dist/gpu-simple-graph/index.d.ts.map +1 -1
- package/dist/gpu-simple-graph/index.js.map +1 -1
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.cjs +2 -0
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.js +3 -0
- package/dist/gpu-simple-graph/operation/gpu-data-evaluator.js.map +1 -1
- package/dist/gpu-simple-graph/operations/convert-colors.cjs +6 -6
- package/dist/gpu-simple-graph/operations/convert-colors.d.ts +5 -1
- package/dist/gpu-simple-graph/operations/convert-colors.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operations/convert-colors.js +12 -7
- package/dist/gpu-simple-graph/operations/convert-colors.js.map +1 -1
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.cjs +16 -33
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.js +22 -35
- package/dist/gpu-simple-graph/operations/cpu/convert-colors.js.map +1 -1
- package/dist/gpu-simple-graph/operations/cpu/index.cjs.map +3 -3
- package/dist/gpu-simple-graph/operations/webgl/index.cjs.map +3 -3
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.cjs +31 -13
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.d.ts.map +1 -1
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.js +42 -13
- package/dist/gpu-simple-graph/operations/webgpu/convert-colors.js.map +1 -1
- package/dist/gpu-simple-graph/operations/webgpu/index.cjs.map +1 -1
- package/dist/gpu-sql/gpu-sql.cjs +98 -5
- package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
- package/dist/gpu-sql/gpu-sql.js +100 -5
- package/dist/gpu-sql/gpu-sql.js.map +1 -1
- package/dist/gpu-sql/index.cjs.map +2 -2
- package/dist/gpu-timeseries/index.cjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
- package/src/arrow/arrow-colors.ts +194 -33
- package/src/arrow/gpu/arrow-column-gpu-vector.ts +67 -14
- package/src/arrow/gpu/arrow-gpu-vector-adapters.ts +3 -1
- package/src/arrow/gpu/arrow-gpu-vector-conversion.ts +46 -4
- package/src/arrow/index.ts +2 -0
- package/src/geospatial/gpu-point-spatial-query.ts +2 -15
- package/src/gpu-core/gpu-command-graph-compiler.ts +25 -2
- package/src/gpu-core/gpu-command-graph-types.ts +20 -0
- package/src/gpu-core/gpu-command-graph.ts +11 -4
- package/src/gpu-core/gpu-dispatch-utils.ts +13 -1
- package/src/gpu-core/gpu-expression-operation.ts +1 -1
- package/src/gpu-core/gpu-grid-aggregation.ts +2 -5
- package/src/gpu-core/gpu-grid-binning.ts +2 -5
- package/src/gpu-core/gpu-grid-coordinate.ts +24 -0
- package/src/gpu-core/gpu-grid-index-internals.ts +2 -15
- package/src/gpu-core/gpu-grid-index-query.ts +2 -16
- package/src/gpu-core/gpu-scan.ts +59 -45
- package/src/gpu-core/gpu-segmented-reduction.ts +20 -10
- package/src/gpu-core/gpu-segmented-scan.ts +82 -17
- package/src/gpu-core/index.ts +21 -0
- package/src/gpu-data/color-conversion.ts +158 -0
- package/src/gpu-data/gpu-vector-wgsl-layout.ts +79 -0
- package/src/gpu-data/index.ts +10 -0
- package/src/gpu-dataframe/gpu-data-frame-query.ts +6 -26
- package/src/gpu-dataframe/gpu-expression.ts +135 -0
- package/src/gpu-dataframe/index.ts +11 -0
- package/src/gpu-dataframe/portable-expression.ts +117 -0
- package/src/gpu-graph-algorithms/gpu-graph-spatial-force-layout-internals.ts +2 -15
- package/src/gpu-physics/gpu-rigid-body-world.ts +8 -1
- package/src/gpu-physics/rigid-body-parallel-shaders.ts +32 -9
- package/src/gpu-physics/rigid-body-shaders.ts +3 -2
- package/src/gpu-simple-graph/index.ts +1 -0
- package/src/gpu-simple-graph/operation/gpu-data-evaluator.ts +2 -0
- package/src/gpu-simple-graph/operations/convert-colors.ts +22 -7
- package/src/gpu-simple-graph/operations/cpu/convert-colors.ts +31 -48
- package/src/gpu-simple-graph/operations/webgpu/convert-colors.ts +47 -13
- package/src/gpu-sql/gpu-sql.ts +106 -6
- package/src/index.ts +2 -0
package/src/gpu-sql/gpu-sql.ts
CHANGED
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
// SPDX-FileComment: Independently implemented for WebGPU; inspired by relational SQL semantics.
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
parseSQLExpression,
|
|
8
|
+
parseSQLSelectStatement,
|
|
9
|
+
SQLParseError,
|
|
10
|
+
type SQLSelectStatement
|
|
11
|
+
} from '@math.gl/expressions/sql';
|
|
12
|
+
import type {Expression} from '@math.gl/expressions';
|
|
8
13
|
import type {GPUCommandGraph} from '@luma.gl/graph/gpu-core';
|
|
9
14
|
import {GPUDataFrame} from '../gpu-dataframe/gpu-data-frame';
|
|
10
15
|
import {GPUDataFrameQuery} from '../gpu-dataframe/gpu-data-frame-query';
|
|
@@ -122,8 +127,7 @@ export class GPUSQLContext {
|
|
|
122
127
|
|
|
123
128
|
/** Parses and validates one immutable SELECT plan without touching registered GPU sources. */
|
|
124
129
|
query(source: string, options: GPUSQLQueryOptions = {}): GPUSQLQuery {
|
|
125
|
-
const
|
|
126
|
-
const statement = parser.parse();
|
|
130
|
+
const statement = parseGPUSQLStatement(source, options.parameters ?? {});
|
|
127
131
|
return new GPUSQLQuery(source, buildGPUSQLPlan(this.tables, statement));
|
|
128
132
|
}
|
|
129
133
|
}
|
|
@@ -309,13 +313,107 @@ function resolveGPUSQLExpression(
|
|
|
309
313
|
}
|
|
310
314
|
}
|
|
311
315
|
|
|
316
|
+
function parseGPUSQLStatement(
|
|
317
|
+
source: string,
|
|
318
|
+
parameters: GPUDataFrameQueryParameters
|
|
319
|
+
): GPUSQLStatement {
|
|
320
|
+
// Preserve GPUSQL's lexical limits and accepted input tokens.
|
|
321
|
+
const tokens = tokenizeGPUSQL(source);
|
|
322
|
+
let statement: SQLSelectStatement;
|
|
323
|
+
try {
|
|
324
|
+
statement = parseSQLSelectStatement(source, {
|
|
325
|
+
parseParameter: name => ({type: 'Identifier', name: `:${name}`})
|
|
326
|
+
});
|
|
327
|
+
} catch (error) {
|
|
328
|
+
// Older GPUSQL queries permit unquoted keyword-named columns, such as "limit".
|
|
329
|
+
if (!(error instanceof SQLParseError)) throw error;
|
|
330
|
+
return new GPUSQLParser(tokens, parameters).parse();
|
|
331
|
+
}
|
|
332
|
+
if (statement.offset !== undefined) throw new Error('GPUSQL does not support OFFSET');
|
|
333
|
+
if (statement.joins.length > 1) throw new Error('GPUSQL currently supports one JOIN');
|
|
334
|
+
if ((statement.groupBy?.length ?? 0) > 1) {
|
|
335
|
+
throw new Error('GPUSQL currently supports one GROUP BY column');
|
|
336
|
+
}
|
|
337
|
+
if ((statement.orderBy?.length ?? 0) > 1) {
|
|
338
|
+
throw new Error('GPUSQL currently supports one ORDER BY column');
|
|
339
|
+
}
|
|
340
|
+
if (statement.limit !== undefined && statement.limit > 0xffffffff) {
|
|
341
|
+
throw new Error('GPUSQL LIMIT must fit an unsigned 32-bit row count');
|
|
342
|
+
}
|
|
343
|
+
const items: GPUSQLSelectItem[] = statement.select?.map(({expression, alias}) => {
|
|
344
|
+
if (expression.type === 'CallExpression' && expression.callee.type === 'Identifier') {
|
|
345
|
+
const name = String(expression.callee['name']).toLowerCase();
|
|
346
|
+
const aggregate = name === 'avg' ? 'mean' : name;
|
|
347
|
+
switch (aggregate) {
|
|
348
|
+
case 'count':
|
|
349
|
+
case 'sum':
|
|
350
|
+
case 'min':
|
|
351
|
+
case 'max':
|
|
352
|
+
case 'mean': {
|
|
353
|
+
if (expression.arguments.length !== 1) {
|
|
354
|
+
throw new Error('GPUSQL aggregates require one argument');
|
|
355
|
+
}
|
|
356
|
+
const argument = readGPUSQLColumn(expression.arguments[0]);
|
|
357
|
+
if ((aggregate === 'count') !== (argument === '*')) {
|
|
358
|
+
throw new Error('GPUSQL only permits COUNT(*) as a wildcard aggregation');
|
|
359
|
+
}
|
|
360
|
+
return {aggregate, ...(argument !== '*' ? {aggregateColumn: argument} : {}), alias};
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return {expression: lowerSQLExpression(expression, parameters), alias};
|
|
365
|
+
}) ?? [{star: true}];
|
|
366
|
+
const join = statement.joins[0];
|
|
367
|
+
let loweredJoin: GPUSQLStatement['join'];
|
|
368
|
+
if (join) {
|
|
369
|
+
if (join.on.type !== 'BinaryExpression' || join.on.operator !== '==') {
|
|
370
|
+
throw new Error('GPUSQL JOIN requires equality between two columns');
|
|
371
|
+
}
|
|
372
|
+
loweredJoin = {
|
|
373
|
+
type: join.type,
|
|
374
|
+
table: join.table.name,
|
|
375
|
+
alias: join.table.alias,
|
|
376
|
+
left: readGPUSQLColumn(join.on.left),
|
|
377
|
+
right: readGPUSQLColumn(join.on.right)
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
const sort = statement.orderBy?.[0];
|
|
381
|
+
return {
|
|
382
|
+
items,
|
|
383
|
+
table: statement.from.name,
|
|
384
|
+
alias: statement.from.alias,
|
|
385
|
+
join: loweredJoin,
|
|
386
|
+
predicate: statement.where && lowerSQLExpression(statement.where, parameters),
|
|
387
|
+
groupBy: statement.groupBy?.[0] && readGPUSQLColumn(statement.groupBy[0]),
|
|
388
|
+
orderBy: sort && {
|
|
389
|
+
column: readGPUSQLColumn(sort.expression),
|
|
390
|
+
direction: sort.direction === 'desc' ? 'descending' : 'ascending',
|
|
391
|
+
nulls: sort.nulls
|
|
392
|
+
},
|
|
393
|
+
limit: statement.limit
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function readGPUSQLColumn(node: Extract<Expression, {type: 'BinaryExpression'}>['left']): string {
|
|
398
|
+
const expression = node as Expression;
|
|
399
|
+
if (expression.type === 'Identifier' && !expression.name.startsWith(':')) return expression.name;
|
|
400
|
+
if (expression.type === 'MemberExpression' && !expression.computed) {
|
|
401
|
+
const object = expression.object as Expression;
|
|
402
|
+
const property = expression.property as Expression;
|
|
403
|
+
if (object.type === 'Identifier' && property.type === 'Identifier') {
|
|
404
|
+
return `${object.name}.${property.name}`;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
throw new Error('GPUSQL expected a table or column identifier');
|
|
408
|
+
}
|
|
409
|
+
|
|
312
410
|
class GPUSQLParser {
|
|
313
411
|
private readonly tokens: readonly GPUSQLToken[];
|
|
314
412
|
private readonly parameters: GPUDataFrameQueryParameters;
|
|
315
413
|
private position = 0;
|
|
316
414
|
|
|
317
|
-
constructor(
|
|
318
|
-
this.tokens =
|
|
415
|
+
constructor(tokens: readonly GPUSQLToken[], parameters: GPUDataFrameQueryParameters) {
|
|
416
|
+
this.tokens = tokens;
|
|
319
417
|
this.parameters = parameters;
|
|
320
418
|
}
|
|
321
419
|
|
|
@@ -584,6 +682,8 @@ function lowerSQLExpression(
|
|
|
584
682
|
}
|
|
585
683
|
return parameter(name, parameters[name]).node;
|
|
586
684
|
}
|
|
685
|
+
case 'MemberExpression':
|
|
686
|
+
return column(readGPUSQLColumn(expression)).node;
|
|
587
687
|
case 'Literal': {
|
|
588
688
|
const value = expression.value;
|
|
589
689
|
if (
|
package/src/index.ts
CHANGED
|
@@ -53,6 +53,8 @@ export {
|
|
|
53
53
|
type GPUCommandGraphNodeConditionPreflight,
|
|
54
54
|
type GPUCommandGraphNodeEncodingStats,
|
|
55
55
|
type GPUCommandGraphNodePreflight,
|
|
56
|
+
type GPUCommandGraphCompileOptions,
|
|
57
|
+
type GPUCommandGraphKernelMetadata,
|
|
56
58
|
type GPUCommandGraphResourceSummary,
|
|
57
59
|
type GPUCommandGraphNodePublication,
|
|
58
60
|
type GPUCommandGraphNodeTiming,
|