@loaders.gl/core 5.0.1 → 5.0.3

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.
Files changed (78) hide show
  1. package/dist/api.cjs +15 -3
  2. package/dist/api.cjs.map +1 -1
  3. package/dist/dist.dev.js +16 -5
  4. package/dist/dist.min.js +3 -3
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/lib/api/encode-table.d.ts +5 -3
  8. package/dist/lib/api/encode-table.d.ts.map +1 -1
  9. package/dist/lib/api/encode-table.js +6 -1
  10. package/dist/lib/api/encode-table.js.map +1 -1
  11. package/dist/lib/init.js +1 -1
  12. package/dist/lib/loader-utils/native-arrow.d.ts.map +1 -1
  13. package/dist/lib/loader-utils/native-arrow.js +14 -3
  14. package/dist/lib/loader-utils/native-arrow.js.map +1 -1
  15. package/dist/loader-utils/index.cjs +30 -2
  16. package/dist/loader-utils/index.cjs.map +2 -2
  17. package/dist/loader-utils/index.d.ts +3 -2
  18. package/dist/loader-utils/index.d.ts.map +1 -1
  19. package/dist/loader-utils/index.js +2 -1
  20. package/dist/loader-utils/index.js.map +1 -1
  21. package/dist/loader-utils/json-loader-metadata.cjs +1 -1
  22. package/dist/loader-utils/json-loader-metadata.js +1 -1
  23. package/dist/loader-utils/json-loader.cjs +1 -1
  24. package/dist/loader-utils/lib/log-utils/log.js +1 -1
  25. package/dist/loader-utils/lib/scan-utils/columnar-predicate.d.ts +1 -1
  26. package/dist/loader-utils/lib/scan-utils/columnar-predicate.d.ts.map +1 -1
  27. package/dist/loader-utils/lib/scan-utils/columnar-predicate.js +1 -1
  28. package/dist/loader-utils/lib/scan-utils/columnar-predicate.js.map +1 -1
  29. package/dist/loader-utils/lib/sources/raster-source.d.ts +17 -1
  30. package/dist/loader-utils/lib/sources/raster-source.d.ts.map +1 -1
  31. package/dist/loader-utils/lib/sources/raster-source.js.map +1 -1
  32. package/dist/loader-utils/lib/sources/raster-tile.d.ts +7 -0
  33. package/dist/loader-utils/lib/sources/raster-tile.d.ts.map +1 -0
  34. package/dist/loader-utils/lib/sources/raster-tile.js +34 -0
  35. package/dist/loader-utils/lib/sources/raster-tile.js.map +1 -0
  36. package/dist/null-loader-metadata.cjs +1 -1
  37. package/dist/null-loader-metadata.js +1 -1
  38. package/dist/null-loader.cjs +1 -1
  39. package/dist/null-worker-node.js +1 -1
  40. package/dist/null-worker.js +1 -1
  41. package/dist/scan/arrow-query-worker-entry.cjs.map +2 -2
  42. package/dist/scan/arrow-query-worker.cjs.map +2 -2
  43. package/dist/scan/arrow-query.cjs +5 -0
  44. package/dist/scan/arrow-query.cjs.map +2 -2
  45. package/dist/scan/arrow-query.d.ts +2 -1
  46. package/dist/scan/arrow-query.d.ts.map +1 -1
  47. package/dist/scan/arrow-query.js +2 -1
  48. package/dist/scan/arrow-query.js.map +1 -1
  49. package/dist/scan/index.cjs +0 -18
  50. package/dist/scan/index.cjs.map +2 -2
  51. package/dist/scan/index.d.ts +2 -5
  52. package/dist/scan/index.d.ts.map +1 -1
  53. package/dist/scan/index.js +0 -4
  54. package/dist/scan/index.js.map +1 -1
  55. package/dist/scan/query-grouped-sql.cjs +1 -1
  56. package/dist/scan/query-grouped-sql.cjs.map +2 -2
  57. package/dist/scan/query-grouped-sql.d.ts.map +1 -1
  58. package/dist/scan/query-grouped-sql.js +1 -0
  59. package/dist/scan/query-grouped-sql.js.map +1 -1
  60. package/dist/scan/vector-table-scan-source.cjs.map +2 -2
  61. package/dist/schema-utils/index.cjs +22 -13
  62. package/dist/schema-utils/index.cjs.map +1 -1
  63. package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts.map +1 -1
  64. package/dist/schema-utils/lib/arrow/arrow-metadata.js +15 -3
  65. package/dist/schema-utils/lib/arrow/arrow-metadata.js.map +1 -1
  66. package/dist/worker-utils/index.cjs +2 -2
  67. package/dist/worker-utils/lib/env-utils/version.js +1 -1
  68. package/package.json +7 -7
  69. package/src/lib/api/encode-table.ts +11 -5
  70. package/src/lib/loader-utils/native-arrow.ts +16 -4
  71. package/src/loader-utils/index.ts +3 -0
  72. package/src/loader-utils/lib/scan-utils/columnar-predicate.ts +1 -0
  73. package/src/loader-utils/lib/sources/raster-source.ts +18 -1
  74. package/src/loader-utils/lib/sources/raster-tile.ts +46 -0
  75. package/src/scan/arrow-query.ts +3 -1
  76. package/src/scan/index.ts +2 -11
  77. package/src/scan/query-grouped-sql.ts +1 -0
  78. package/src/schema-utils/lib/arrow/arrow-metadata.ts +16 -10
@@ -21,8 +21,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var arrow_query_exports = {};
22
22
  __export(arrow_query_exports, {
23
23
  ARROW_TABLE_QUERY_CAPABILITIES: () => import_plan_arrow_table_query.ARROW_TABLE_QUERY_CAPABILITIES,
24
+ explainArrowTableQuery: () => import_plan_arrow_table_query.explainArrowTableQuery,
24
25
  getSQLPredicateColumnNames: () => import_table_query.getSQLPredicateColumnNames,
25
26
  planTableQuery: () => import_table_query.planTableQuery,
27
+ queryArrowSQL: () => import_query.queryArrowSQL,
26
28
  queryArrowTable: () => import_query_arrow_table.queryArrowTable,
27
29
  queryArrowTableInBatches: () => import_query_arrow_table_in_batches.queryArrowTableInBatches
28
30
  });
@@ -30,12 +32,15 @@ module.exports = __toCommonJS(arrow_query_exports);
30
32
  var import_plan_arrow_table_query = require("./plan-arrow-table-query.cjs");
31
33
  var import_query_arrow_table = require("./query-arrow-table.cjs");
32
34
  var import_query_arrow_table_in_batches = require("./query-arrow-table-in-batches.cjs");
35
+ var import_query = require("@math.gl/sql/query");
33
36
  var import_table_query = require("./table-query.cjs");
34
37
  // Annotate the CommonJS export names for ESM import in node:
35
38
  0 && (module.exports = {
36
39
  ARROW_TABLE_QUERY_CAPABILITIES,
40
+ explainArrowTableQuery,
37
41
  getSQLPredicateColumnNames,
38
42
  planTableQuery,
43
+ queryArrowSQL,
39
44
  queryArrowTable,
40
45
  queryArrowTableInBatches
41
46
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/scan/arrow-query.ts"],
4
- "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {ARROW_TABLE_QUERY_CAPABILITIES} from './plan-arrow-table-query';\nexport {queryArrowTable} from './query-arrow-table';\nexport {queryArrowTableInBatches} from './query-arrow-table-in-batches';\nexport {getSQLPredicateColumnNames, planTableQuery} from './table-query';\n\nexport type {\n TableQueryFilterStep,\n TableQueryLimitStep,\n TableQuery,\n TableSelection,\n TableQueryExecutionOptions,\n TableQueryOptions,\n TableQueryPlan,\n TableQueryPlanStep,\n TableQueryProjectStep,\n TableQueryScanStep\n} from './table-query';\nexport type {ArrowQueryOptions} from './query-arrow-table';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oCAA6C;AAC7C,+BAA8B;AAC9B,0CAAuC;AACvC,yBAAyD;",
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {ARROW_TABLE_QUERY_CAPABILITIES, explainArrowTableQuery} from './plan-arrow-table-query';\nexport {queryArrowTable} from './query-arrow-table';\nexport {queryArrowTableInBatches} from './query-arrow-table-in-batches';\nexport {queryArrowSQL, type ArrowSQLQueryOptions} from '@math.gl/sql/query';\n\nexport {getSQLPredicateColumnNames, planTableQuery} from './table-query';\n\nexport type {\n TableQueryFilterStep,\n TableQueryLimitStep,\n TableQuery,\n TableSelection,\n TableQueryExecutionOptions,\n TableQueryOptions,\n TableQueryPlan,\n TableQueryPlanStep,\n TableQueryProjectStep,\n TableQueryScanStep\n} from './table-query';\nexport type {ArrowQueryOptions} from './query-arrow-table';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oCAAqE;AACrE,+BAA8B;AAC9B,0CAAuC;AACvC,mBAAuD;AAEvD,yBAAyD;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,7 @@
1
- export { ARROW_TABLE_QUERY_CAPABILITIES } from "./plan-arrow-table-query.js";
1
+ export { ARROW_TABLE_QUERY_CAPABILITIES, explainArrowTableQuery } from "./plan-arrow-table-query.js";
2
2
  export { queryArrowTable } from "./query-arrow-table.js";
3
3
  export { queryArrowTableInBatches } from "./query-arrow-table-in-batches.js";
4
+ export { queryArrowSQL, type ArrowSQLQueryOptions } from '@math.gl/sql/query';
4
5
  export { getSQLPredicateColumnNames, planTableQuery } from "./table-query.js";
5
6
  export type { TableQueryFilterStep, TableQueryLimitStep, TableQuery, TableSelection, TableQueryExecutionOptions, TableQueryOptions, TableQueryPlan, TableQueryPlanStep, TableQueryProjectStep, TableQueryScanStep } from "./table-query.js";
6
7
  export type { ArrowQueryOptions } from "./query-arrow-table.js";
@@ -1 +1 @@
1
- {"version":3,"file":"arrow-query.d.ts","sourceRoot":"","sources":["../../src/scan/arrow-query.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,8BAA8B,EAAC,oCAAiC;AACxE,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,OAAO,EAAC,wBAAwB,EAAC,0CAAuC;AACxE,OAAO,EAAC,0BAA0B,EAAE,cAAc,EAAC,yBAAsB;AAEzE,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,0BAA0B,EAC1B,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EACnB,yBAAsB;AACvB,YAAY,EAAC,iBAAiB,EAAC,+BAA4B"}
1
+ {"version":3,"file":"arrow-query.d.ts","sourceRoot":"","sources":["../../src/scan/arrow-query.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,8BAA8B,EAAE,sBAAsB,EAAC,oCAAiC;AAChG,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,OAAO,EAAC,wBAAwB,EAAC,0CAAuC;AACxE,OAAO,EAAC,aAAa,EAAE,KAAK,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAE5E,OAAO,EAAC,0BAA0B,EAAE,cAAc,EAAC,yBAAsB;AAEzE,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,0BAA0B,EAC1B,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EACnB,yBAAsB;AACvB,YAAY,EAAC,iBAAiB,EAAC,+BAA4B"}
@@ -1,8 +1,9 @@
1
1
  // loaders.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
- export { ARROW_TABLE_QUERY_CAPABILITIES } from "./plan-arrow-table-query.js";
4
+ export { ARROW_TABLE_QUERY_CAPABILITIES, explainArrowTableQuery } from "./plan-arrow-table-query.js";
5
5
  export { queryArrowTable } from "./query-arrow-table.js";
6
6
  export { queryArrowTableInBatches } from "./query-arrow-table-in-batches.js";
7
+ export { queryArrowSQL } from '@math.gl/sql/query';
7
8
  export { getSQLPredicateColumnNames, planTableQuery } from "./table-query.js";
8
9
  //# sourceMappingURL=arrow-query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"arrow-query.js","sourceRoot":"","sources":["../../src/scan/arrow-query.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,8BAA8B,EAAC,oCAAiC;AACxE,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,OAAO,EAAC,wBAAwB,EAAC,0CAAuC;AACxE,OAAO,EAAC,0BAA0B,EAAE,cAAc,EAAC,yBAAsB"}
1
+ {"version":3,"file":"arrow-query.js","sourceRoot":"","sources":["../../src/scan/arrow-query.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,8BAA8B,EAAE,sBAAsB,EAAC,oCAAiC;AAChG,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,OAAO,EAAC,wBAAwB,EAAC,0CAAuC;AACxE,OAAO,EAAC,aAAa,EAA4B,MAAM,oBAAoB,CAAC;AAE5E,OAAO,EAAC,0BAA0B,EAAE,cAAc,EAAC,yBAAsB"}
@@ -20,7 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/scan/index.ts
21
21
  var scan_exports = {};
22
22
  __export(scan_exports, {
23
- ARROW_TABLE_QUERY_CAPABILITIES: () => import_plan_arrow_table_query.ARROW_TABLE_QUERY_CAPABILITIES,
24
23
  AddressedVectorTableScanSource: () => import_vector_table_scan_source.AddressedVectorTableScanSource,
25
24
  FEDERATED_TABLE_QUERY_CAPABILITIES: () => import_federated_table_scan_source.FEDERATED_TABLE_QUERY_CAPABILITIES,
26
25
  FederatedTableScanSource: () => import_federated_table_scan_source.FederatedTableScanSource,
@@ -28,14 +27,11 @@ __export(scan_exports, {
28
27
  VectorFeatureTableScanSource: () => import_vector_table_scan_source.VectorFeatureTableScanSource,
29
28
  VectorTileTableScanSource: () => import_vector_table_scan_source.VectorTileTableScanSource,
30
29
  bindSQLPredicate: () => import_bind_sql_predicate.bindSQLPredicate,
31
- createArrowQueryWorker: () => import_arrow_query_worker.createArrowQueryWorker,
32
30
  createQueryMetadata: () => import_loader_utils3.createQueryMetadata,
33
31
  createScanEngine: () => import_scan_engine.createScanEngine,
34
32
  createScanQueryMetadata: () => import_loader_utils2.createScanQueryMetadata,
35
33
  executeTableScanBatches: () => import_loader_utils.executeTableScanBatches,
36
- explainArrowTableQuery: () => import_plan_arrow_table_query.explainArrowTableQuery,
37
34
  explainTableQuery: () => import_table_query2.explainTableQuery,
38
- filterArrowTable: () => import_arrow_execution.filterArrowTable,
39
35
  filterTableBatch: () => import_loader_utils.filterTableBatch,
40
36
  getFederatedTableBatchProvenance: () => import_federated_table_scan_source.getFederatedTableBatchProvenance,
41
37
  getSQLPredicateColumnNames: () => import_table_query2.getSQLPredicateColumnNames,
@@ -47,12 +43,9 @@ __export(scan_exports, {
47
43
  planLogicalTableQuery: () => planLogicalTableQuery,
48
44
  planTableQuery: () => import_table_query2.planTableQuery,
49
45
  preloadQuery: () => import_query.preloadQuery,
50
- projectArrowTable: () => import_arrow_execution.projectArrowTable,
51
46
  projectTableBatch: () => import_loader_utils.projectTableBatch,
52
47
  projectTableSchema: () => import_loader_utils.projectTableSchema,
53
48
  query: () => import_query.query,
54
- queryArrowTable: () => import_query_arrow_table.queryArrowTable,
55
- queryArrowTableInWorker: () => import_arrow_query_worker.queryArrowTableInWorker,
56
49
  queryGroupedSQL: () => import_query_grouped_sql.queryGroupedSQL,
57
50
  queryInBatches: () => import_query.queryInBatches,
58
51
  queryProgressive: () => import_query.queryProgressive,
@@ -69,8 +62,6 @@ var import_parse_sql_predicate = require("./parse-sql-predicate.cjs");
69
62
  var import_loader_utils2 = require("@loaders.gl/core/loader-utils");
70
63
  var import_federated_table_scan_source = require("./federated-table-scan-source.cjs");
71
64
  var import_vector_table_scan_source = require("./vector-table-scan-source.cjs");
72
- var import_plan_arrow_table_query = require("./plan-arrow-table-query.cjs");
73
- var import_query_arrow_table = require("./query-arrow-table.cjs");
74
65
  var import_bind_sql_predicate = require("./bind-sql-predicate.cjs");
75
66
  var import_sql_predicate_schema = require("./sql-predicate-schema.cjs");
76
67
  var import_sql_predicate_types = require("./sql-predicate-types.cjs");
@@ -215,14 +206,11 @@ function validateTableReference(reference) {
215
206
  }
216
207
 
217
208
  // src/scan/index.ts
218
- var import_arrow_execution = require("./arrow-execution.cjs");
219
209
  var import_query_grouped_sql = require("./query-grouped-sql.cjs");
220
210
  var import_query = require("./query.cjs");
221
211
  var import_loader_utils3 = require("@loaders.gl/core/loader-utils");
222
- var import_arrow_query_worker = require("./arrow-query-worker.cjs");
223
212
  // Annotate the CommonJS export names for ESM import in node:
224
213
  0 && (module.exports = {
225
- ARROW_TABLE_QUERY_CAPABILITIES,
226
214
  AddressedVectorTableScanSource,
227
215
  FEDERATED_TABLE_QUERY_CAPABILITIES,
228
216
  FederatedTableScanSource,
@@ -230,14 +218,11 @@ var import_arrow_query_worker = require("./arrow-query-worker.cjs");
230
218
  VectorFeatureTableScanSource,
231
219
  VectorTileTableScanSource,
232
220
  bindSQLPredicate,
233
- createArrowQueryWorker,
234
221
  createQueryMetadata,
235
222
  createScanEngine,
236
223
  createScanQueryMetadata,
237
224
  executeTableScanBatches,
238
- explainArrowTableQuery,
239
225
  explainTableQuery,
240
- filterArrowTable,
241
226
  filterTableBatch,
242
227
  getFederatedTableBatchProvenance,
243
228
  getSQLPredicateColumnNames,
@@ -249,12 +234,9 @@ var import_arrow_query_worker = require("./arrow-query-worker.cjs");
249
234
  planLogicalTableQuery,
250
235
  planTableQuery,
251
236
  preloadQuery,
252
- projectArrowTable,
253
237
  projectTableBatch,
254
238
  projectTableSchema,
255
239
  query,
256
- queryArrowTable,
257
- queryArrowTableInWorker,
258
240
  queryGroupedSQL,
259
241
  queryInBatches,
260
242
  queryProgressive,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/scan/index.ts", "../../src/loader-utils/lib/scan-utils/columnar-predicate.ts", "../../src/loader-utils/lib/scan-utils/table-query.ts", "../../src/loader-utils/lib/scan-utils/logical-table-query.ts"],
4
- "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {createScanEngine, registerScanBackend} from './scan-engine';\n// The low-level executor lives in loader-utils so format packages can reuse it without importing\n// this optional module. It is re-exported here as the scan package's common batch adapter.\nexport {\n executeTableScanBatches,\n filterTableBatch,\n projectTableBatch,\n projectTableSchema,\n truncateTableBatch\n} from '@loaders.gl/core/loader-utils';\nexport type {TableScanBatchReader, TableScanBatchOperators} from '@loaders.gl/core/loader-utils';\nexport type {\n ScanBackend,\n ScanBackendLoader,\n ScanBackendName,\n ScanEngine,\n ScanEngineOptions\n} from './scan-engine';\n\n// Re-export the query vocabulary from one optional entry point for applications. Format adapters\n// should continue importing the lightweight contracts from @loaders.gl/core/loader-utils.\nexport {parseSQLPredicate} from './parse-sql-predicate';\nexport type {ArrowQueryOptions} from './query-arrow-table';\nexport type {SQLPredicate} from './sql-predicate-types';\nexport type {\n RelationalAggregate,\n RelationalExpression,\n RelationalOrderKey,\n TableQuery,\n TableReference,\n TableSourceCollection,\n TableSelection,\n TableQueryExecutionOptions,\n TableQueryOptions\n} from '@loaders.gl/core/loader-utils';\n\nexport {\n createScanQueryMetadata,\n intersectPointCloudBounds,\n selectPointCloudScanTiles,\n validatePointCloudQueryOptions\n} from '@loaders.gl/core/loader-utils';\nexport type {\n CreateScanQueryMetadataOptions,\n PointCloudQueryBounds,\n PointCloudQueryCapabilities,\n PointCloudQueryOptions,\n PointCloudScanChildrenLoader,\n PointCloudScanReadOptions,\n PointCloudScanSource,\n PointCloudScanTile,\n RasterQueryCapabilities,\n RasterQueryOptions,\n ScanBounds,\n ScanColumnMetadata,\n ScanColumnRole,\n ScanExecutionMethod,\n TableQueryExecutionSummary,\n TableQueryCompleteCallback,\n TableQueryExecutionStatus,\n TableQuerySourceExecutionSummary,\n ScanExecutionSupport,\n ScanQueryCapabilities,\n ScanQueryMetadata,\n ScanQueryMetadataOptions,\n ScanQueryMetadataProvider,\n ScanRasterLevel,\n ScanSourceStatistics,\n ScanSpatialMetadata,\n TableScanReadOptions,\n TableScanSource\n} from '@loaders.gl/core/loader-utils';\nexport type {ScanQuery} from './scan-query';\n\nexport {\n FEDERATED_TABLE_QUERY_CAPABILITIES,\n FederatedTableScanSource,\n getFederatedTableBatchProvenance\n} from './federated-table-scan-source';\nexport type {\n FederatedTableBatch,\n FederatedTableBatchProvenance,\n FederatedTableScanExplain,\n FederatedTableScanSourceOptions,\n FederatedTableSchemaPolicy,\n FederatedTableSourceEntry,\n FederatedTableSourceExplain\n} from './federated-table-scan-source';\n\nexport {\n AddressedVectorTableScanSource,\n VectorFeatureTableScanSource,\n VectorTileTableScanSource\n} from './vector-table-scan-source';\nexport type {\n VectorFeatureTableScanSourceOptions,\n VectorTableScanSourceOptions,\n VectorTileTableScanSourceOptions\n} from './vector-table-scan-source';\n\nexport {ARROW_TABLE_QUERY_CAPABILITIES, explainArrowTableQuery} from './plan-arrow-table-query';\nexport {queryArrowTable} from './query-arrow-table';\nexport {bindSQLPredicate} from './bind-sql-predicate';\nexport {\n isSQLPredicate,\n SQL_PREDICATE_JSON_SCHEMA,\n validateSQLPredicate\n} from './sql-predicate-schema';\nexport {isSQLPredicateParameter} from './sql-predicate-types';\nexport type {\n BoundSQLPredicate,\n SQLComparisonPredicate,\n SQLInPredicate,\n SQLLogicalPredicate,\n SQLNotPredicate,\n SQLNullPredicate,\n SQLPredicateParameter,\n SQLPredicateParameterValues,\n SQLPredicateParserOptions,\n SQLPredicateProperty,\n SQLPredicateScalar,\n SQLPredicateValue\n} from './sql-predicate-types';\nexport {explainTableQuery, getSQLPredicateColumnNames, planTableQuery} from './table-query';\nexport type {\n TableQueryPlan,\n TableQueryPlanStep,\n TableQueryFilterStep,\n TableQueryLimitStep,\n TableQueryProjectStep,\n TableQueryScanStep\n} from './table-query';\n\nexport {\n normalizeTableQuery,\n planLogicalTableQuery\n} from '../loader-utils/lib/scan-utils/logical-table-query';\nexport type {\n NormalizedTableSelection,\n NormalizedTableQuery,\n LogicalTableQueryProjectStep,\n LogicalTableQueryPlan\n} from '../loader-utils/lib/scan-utils/logical-table-query';\n\nexport {projectArrowTable, filterArrowTable} from './arrow-execution';\nexport type {ArrowFilterOptions} from './arrow-execution';\n\nexport {queryGroupedSQL} from './query-grouped-sql';\nexport {preloadQuery, query, queryInBatches, queryProgressive} from './query';\nexport type {\n ProgressiveAggregate,\n ProgressiveAggregateQuery,\n ProgressiveQueryOptions,\n ProgressiveQuerySnapshot\n} from './query-progressive';\nexport type {\n Query,\n QueryOptions,\n SQLQueryParser,\n TypedTableQuery,\n TypedColumnSelection,\n TypedColumnType\n} from './query';\n\nexport {createQueryMetadata} from '@loaders.gl/core/loader-utils';\nexport type {\n CreateQueryMetadataOptions,\n QueryMetadata,\n QueryMetadataOptions,\n QueryCapabilities,\n TableQuerySource,\n TableQueryReadOptions,\n TableQueryPushdownRequest,\n TableQueryPushdownPlan,\n TableQueryCapabilities,\n QueryPushdownCapabilityHints\n} from '@loaders.gl/core/loader-utils';\n\nexport {\n createArrowQueryWorker,\n queryArrowTableInWorker,\n type ArrowQueryWorkerOptions,\n type ArrowQueryWorkerSession\n} from './arrow-query-worker';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n compileColumnarPredicate,\n type ColumnarPredicate,\n type ColumnarPredicateReader\n} from '@math.gl/sql/columnar-predicate';\nimport type {ArrayType} from '@loaders.gl/core/schema';\n\nexport {\n bindColumnarPredicateParameters,\n copyColumnarPredicate,\n getColumnarPredicateColumns,\n getColumnarPredicateParameterNames,\n getColumnarPredicatePath,\n getColumnarPredicatePaths,\n isColumnarPredicateParameter,\n isColumnarPredicateValue,\n validateColumnarPredicate,\n type ColumnarComparisonPredicate,\n type ColumnarInPredicate,\n type ColumnarLogicalPredicate,\n type ColumnarNotPredicate,\n type ColumnarNullPredicate,\n type ColumnarPredicate,\n type ColumnarPredicateInputValue,\n type ColumnarPredicateParameter,\n type ColumnarPredicateParameterValues,\n type ColumnarPredicateProperty,\n type ColumnarPredicateValue,\n type ParameterizedColumnarPredicate\n} from '@math.gl/sql/columnar-predicate';\n\n/** Finds the source rows matching a bound portable predicate. */\nexport function filterColumnarRowIndices(\n predicate: ColumnarPredicate | undefined,\n columns: Record<string, ArrayType>,\n rowCount: number\n): number[] {\n if (!predicate) return Array.from({length: rowCount}, (_, index) => index);\n const evaluate = compileColumnarPredicate(predicate, path => bindColumnarReader(columns, path));\n const result: number[] = [];\n for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n if (evaluate(rowIndex) === true) result.push(rowIndex);\n }\n return result;\n}\n\n/** Gathers selected rows from format-neutral column arrays. */\nexport function gatherColumnarColumns(\n columns: Record<string, ArrayType>,\n rowIndices: readonly number[],\n selectedColumns?: ReadonlySet<string>\n): Record<string, ArrayType> {\n const result: Record<string, ArrayType> = {};\n for (const [name, column] of Object.entries(columns)) {\n if (!selectedColumns || selectedColumns.has(name)) {\n result[name] = rowIndices.map(rowIndex => (column as ArrayLike<unknown>)[rowIndex]);\n }\n }\n return result;\n}\n\n/** Binds a portable predicate path to one source column. */\nfunction bindColumnarReader(\n columns: Record<string, ArrayType>,\n [name, ...path]: readonly string[]\n): ColumnarPredicateReader {\n const column = columns[name];\n return rowIndex => {\n let value = column?.[rowIndex];\n for (const property of path) {\n if (value == null) return null;\n value = value[property];\n }\n return value as ReturnType<ColumnarPredicateReader>;\n };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n getColumnarPredicateColumns,\n validateColumnarPredicate,\n type ColumnarPredicate,\n type ColumnarPredicateProperty\n} from './columnar-predicate';\n\n/** One source column selected for logical output, optionally under a new name. */\nexport type TableSelection =\n | string\n | Readonly<{\n /** Source column name, resolved before aliases are applied. */\n column: string;\n /** Output field name. Defaults to the source column name. */\n as?: string;\n }>;\n\n/** Named source, or a named table exposed by a source. Strings are literal names, not dotted paths. */\nexport type TableReference =\n | string\n | Readonly<{\n /** Name of a registered data source. */\n source: string;\n /** Name of a table exposed by that source. */\n table: string;\n }>;\n\n/** Logical query description, independent of cancellation and execution observers. */\nexport type TableQuery<\n PredicateT extends ColumnarPredicate<unknown, ColumnarPredicateProperty> = ColumnarPredicate\n> = Readonly<{\n /** Optional named source or qualified table selected before planning. */\n from?: TableReference;\n /** Output columns in selection order. Omission selects all source columns. */\n select?: readonly TableSelection[];\n /** Predicate evaluated against source columns before output aliases are applied. */\n where?: PredicateT;\n /** Number of filtered rows skipped before applying the limit. */\n offset?: number;\n /** Maximum number of rows retained after filtering and offset. */\n limit?: number;\n}>;\n\n/** Controls one execution without becoming part of the logical query. */\nexport type TableQueryExecutionOptions = Readonly<{\n /** Cooperatively cancels source discovery and execution. */\n signal?: AbortSignal;\n /** Receives one terminal summary, including cancellation, failure, and early termination. */\n onQueryComplete?: import('./scan-query-metadata').TableQueryCompleteCallback;\n}>;\n\n/** Immutable, backend-neutral request for a scan, filter, projection, and limit. */\nexport type TableQueryOptions<\n PredicateT extends ColumnarPredicate<unknown, ColumnarPredicateProperty> = ColumnarPredicate\n> = Pick<TableQueryExecutionOptions, 'signal'> &\n Readonly<{\n /** Portable predicate applied before projection. */\n predicate?: PredicateT;\n /** Output columns in caller-specified order. Defaults to every source column. */\n columns?: readonly string[];\n /** Maximum number of rows retained after filtering and projection. */\n limit?: number;\n }>;\n\n/** Reads the minimum source columns required by the remaining table-query plan. */\nexport type TableQueryScanStep = Readonly<{\n /** Plan discriminator. */\n kind: 'scan';\n /** Source columns required for filtering and output. */\n columns: readonly string[];\n}>;\n\n/** Applies a portable predicate while all predicate columns remain available. */\nexport type TableQueryFilterStep<PredicateT = ColumnarPredicate> = Readonly<{\n /** Plan discriminator. */\n kind: 'filter';\n /** Predicate evaluated using three-valued Boolean semantics. */\n predicate: PredicateT;\n}>;\n\n/** Narrows the result to requested output columns. */\nexport type TableQueryProjectStep = Readonly<{\n /** Plan discriminator. */\n kind: 'project';\n /** Output columns in caller-specified order. */\n columns: readonly string[];\n}>;\n\n/** Retains the first rows in source order after filtering and projection. */\nexport type TableQueryLimitStep = Readonly<{\n /** Plan discriminator. */\n kind: 'limit';\n /** Maximum number of retained rows. */\n limit: number;\n}>;\n\n/** One immutable operation in a normalized table-query plan. */\nexport type TableQueryPlanStep<PredicateT = ColumnarPredicate> =\n | TableQueryScanStep\n | TableQueryFilterStep<PredicateT>\n | TableQueryProjectStep\n | TableQueryLimitStep;\n\n/** Immutable logical query plan shared by CPU, SQL, and GPU backends. */\nexport type TableQueryPlan<PredicateT = ColumnarPredicate> =\n readonly TableQueryPlanStep<PredicateT>[];\n\n/** Capability levels for an individual portable table-query operator. */\nexport type TableQueryOperatorSupport =\n | 'unsupported'\n | 'residual'\n | 'pushdown'\n | 'pushdown+residual';\n\n/** Optimization and correctness capabilities advertised by a table-query backend. */\nexport type TableQueryCapabilities = Readonly<{\n /** Whether output projection can avoid reading unrequested columns. */\n projection: TableQueryOperatorSupport;\n /** Whether predicates are unsupported, residual, pushed down, or both pushed and residual. */\n predicate: TableQueryOperatorSupport;\n /** Whether limits are unsupported, applied after execution, or stop physical work early. */\n limit: TableQueryOperatorSupport;\n /** Whether exact CAST semantics can execute at the source; conversions require negotiation. */\n cast?: TableQueryOperatorSupport;\n /** Whether the source can skip filtered rows before its limit. */\n offset?: TableQueryOperatorSupport;\n /** Whether the backend can stream bounded result batches. */\n streaming: boolean;\n /** Whether active and queued physical work observes cancellation. */\n cancellation: boolean;\n /** Whether scalar expressions can be evaluated before projection. */\n expressions?: TableQueryOperatorSupport;\n /** Whether output rows can be ordered before the global limit. */\n orderBy?: TableQueryOperatorSupport;\n /** Whether grouped aggregate output is supported. */\n aggregates?: TableQueryOperatorSupport;\n}>;\n\n/**\n * Produces the canonical scan, filter, project, and limit sequence for a table query.\n *\n * Predicate columns are retained by the scan even if callers omit them from the output projection.\n * This makes SQL `WHERE` semantics independent of a backend's internal API call order.\n */\nexport function planTableQuery<\n ValueT,\n PropertyT extends ColumnarPredicateProperty,\n PredicateT extends ColumnarPredicate<ValueT, PropertyT>\n>(\n sourceColumnNames: readonly string[],\n options: TableQueryOptions<PredicateT> = {}\n): TableQueryPlan<PredicateT> {\n validateTableQueryOptions(sourceColumnNames, options);\n\n const outputColumnNames = options.columns ? [...options.columns] : [...sourceColumnNames];\n const predicateColumnNames = options.predicate\n ? getColumnarPredicateColumns(options.predicate)\n : [];\n const requiredColumnNames = new Set([...outputColumnNames, ...predicateColumnNames]);\n const scanColumnNames = sourceColumnNames.filter(columnName =>\n requiredColumnNames.has(columnName)\n );\n const steps: TableQueryPlanStep<PredicateT>[] = [\n Object.freeze({kind: 'scan' as const, columns: Object.freeze(scanColumnNames)})\n ];\n\n if (options.predicate) {\n steps.push(Object.freeze({kind: 'filter' as const, predicate: options.predicate}));\n }\n steps.push(Object.freeze({kind: 'project' as const, columns: Object.freeze(outputColumnNames)}));\n if (options.limit !== undefined) {\n steps.push(Object.freeze({kind: 'limit' as const, limit: options.limit}));\n }\n return Object.freeze(steps);\n}\n\n/** Validates a portable table query against the columns exposed by one source. */\nexport function validateTableQueryOptions<\n ValueT,\n PropertyT extends ColumnarPredicateProperty,\n PredicateT extends ColumnarPredicate<ValueT, PropertyT>\n>(sourceColumnNames: readonly string[], options: TableQueryOptions<PredicateT>): void {\n const availableColumnNames = new Set(sourceColumnNames);\n const outputColumnNames = options.columns ?? sourceColumnNames;\n const seenColumnNames = new Set<string>();\n for (const columnName of outputColumnNames) {\n if (!availableColumnNames.has(columnName)) {\n throw new Error(`Table query column not found: ${columnName}`);\n }\n if (seenColumnNames.has(columnName)) {\n throw new Error(`Table query column was selected more than once: ${columnName}`);\n }\n seenColumnNames.add(columnName);\n }\n validateTableQueryLimit(options.limit);\n if (options.predicate) {\n validateColumnarPredicate(options.predicate, availableColumnNames);\n }\n}\n\n/** Validates a portable table-query limit independently of source-schema validation. */\nexport function validateTableQueryLimit(limit: number | undefined): void {\n if (limit !== undefined && (!Number.isSafeInteger(limit) || limit < 0)) {\n throw new Error('Table query limit must be a non-negative safe integer.');\n }\n}\n\n/** Validates a logical row offset before any batches are read. */\nexport function validateTableQueryOffset(offset: number | undefined): void {\n if (offset !== undefined && (!Number.isSafeInteger(offset) || offset < 0)) {\n throw new Error('Table query offset must be a non-negative safe integer.');\n }\n}\n\n/** Static format hints only; omission means unknown and never authorizes execution. */\nexport type QueryPushdownCapabilityHints = Readonly<{\n /** The format may support reading only selected columns. */\n projection?: boolean;\n /** The format may support predicate evaluation or pruning. */\n predicate?: boolean;\n /** An implementation may evaluate some CAST conversions. */\n cast?: boolean;\n /** An implementation may skip rows at the source. */\n offset?: boolean;\n /** An implementation may stop source work after a row limit. */\n limit?: boolean;\n}>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n validateColumnarPredicate,\n type ColumnarPredicate,\n type ColumnarPredicateProperty\n} from './columnar-predicate';\nimport {\n planTableQuery,\n validateTableQueryLimit,\n validateTableQueryOffset,\n type TableQuery,\n type TableReference,\n type TableQueryPlanStep\n} from './table-query';\n\n/** Explicit source-to-output mapping for one selected field. */\nexport type NormalizedTableSelection = Readonly<{\n /** Column read from the source. */\n column: string;\n /** Name of the returned field. */\n as: string;\n}>;\n\n/** Logical query with all output selections expanded into explicit mappings. */\nexport type NormalizedTableQuery<PredicateT = ColumnarPredicate> = Readonly<{\n /** Optional source reference preserved separately from physical scan operations. */\n from?: TableReference;\n /** Output mappings in caller-specified order. */\n select: readonly NormalizedTableSelection[];\n /** Predicate resolved against source names before aliases. */\n where?: PredicateT;\n /** Global number of filtered rows skipped before applying the limit. */\n offset?: number;\n /** Global post-filter row limit. */\n limit?: number;\n}>;\n\n/** Logical projection retaining source names separately from output names. */\nexport type LogicalTableQueryProjectStep = Readonly<{\n /** Plan discriminator. */\n kind: 'project';\n /** Output mappings applied after filtering. */\n select: readonly NormalizedTableSelection[];\n}>;\n\n/** Scan, filter, aliased projection, and limit operations in execution order. */\nexport type LogicalTableQueryPlan<PredicateT = ColumnarPredicate> = readonly (\n | Exclude<TableQueryPlanStep<PredicateT>, {kind: 'project'}>\n | Readonly<{kind: 'offset'; offset: number}>\n | LogicalTableQueryProjectStep\n)[];\n\n/** Validates logical query fields and expands selections without modifying caller input. */\nexport function normalizeTableQuery<\n PredicateT extends ColumnarPredicate<unknown, ColumnarPredicateProperty> = ColumnarPredicate\n>(\n sourceColumnNames: readonly string[],\n query: TableQuery<PredicateT> = {}\n): NormalizedTableQuery<PredicateT> {\n if (!query || typeof query !== 'object' || Array.isArray(query)) {\n throw new Error('Table query must be an object.');\n }\n for (const key of Object.keys(query)) {\n if (!['from', 'select', 'where', 'offset', 'limit'].includes(key)) {\n throw new Error(`Unsupported table query option: ${key}`);\n }\n }\n if (query.select !== undefined && (!Array.isArray(query.select) || query.select.length === 0)) {\n throw new Error('Table query select must be a non-empty array.');\n }\n validateTableReference(query.from);\n validateTableQueryOffset(query.offset);\n validateTableQueryLimit(query.limit);\n if (query.where !== undefined) {\n validateColumnarPredicate(query.where, new Set(sourceColumnNames));\n }\n const outputNames = new Set<string>();\n const select = (query.select ?? sourceColumnNames).map(selection => {\n if (\n typeof selection !== 'string' &&\n (!selection || typeof selection !== 'object' || Array.isArray(selection))\n ) {\n throw new Error('Table query selection must be a column name or {column, as}.');\n }\n if (\n typeof selection !== 'string' &&\n Object.keys(selection).some(key => key !== 'column' && key !== 'as')\n ) {\n throw new Error('Unsupported table query selection field.');\n }\n const column = typeof selection === 'string' ? selection : selection.column;\n const outputName =\n typeof selection === 'string'\n ? selection\n : selection.as === undefined\n ? column\n : selection.as;\n if (typeof column !== 'string' || !sourceColumnNames.includes(column)) {\n throw new Error(`Table query column not found: ${column}`);\n }\n if (typeof outputName !== 'string' || outputName.length === 0) {\n throw new Error('Table query output name must be a non-empty string.');\n }\n if (outputNames.has(outputName)) {\n throw new Error(`Duplicate table query output name: ${outputName}`);\n }\n outputNames.add(outputName);\n return Object.freeze({column, as: outputName});\n });\n // Reuse source-column and predicate validation; aliases never participate in WHERE resolution.\n planTableQuery(sourceColumnNames, {\n columns: [...new Set(select.map(selection => selection.column))],\n predicate: query.where,\n limit: query.limit\n });\n return Object.freeze({\n select: Object.freeze(select),\n ...(query.from === undefined\n ? {}\n : {from: typeof query.from === 'string' ? query.from : Object.freeze({...query.from})}),\n ...(query.where === undefined ? {} : {where: query.where}),\n ...(query.offset === undefined ? {} : {offset: query.offset}),\n ...(query.limit === undefined ? {} : {limit: query.limit})\n });\n}\n\n/** Builds a logical plan using the shared scan planner and an explicit aliased projection. */\nexport function planLogicalTableQuery<\n PredicateT extends ColumnarPredicate<unknown, ColumnarPredicateProperty> = ColumnarPredicate\n>(\n sourceColumnNames: readonly string[],\n query: TableQuery<PredicateT> = {}\n): LogicalTableQueryPlan<PredicateT> {\n const normalized = normalizeTableQuery(sourceColumnNames, query);\n const plan = planTableQuery(sourceColumnNames, {\n columns: [...new Set(normalized.select.map(selection => selection.column))],\n predicate: normalized.where,\n limit: normalized.limit\n });\n const steps: LogicalTableQueryPlan<PredicateT>[number][] = [];\n for (const step of plan) {\n if (step.kind === 'limit' && normalized.offset !== undefined)\n steps.push(Object.freeze({kind: 'offset', offset: normalized.offset}));\n steps.push(\n step.kind === 'project' ? Object.freeze({kind: 'project', select: normalized.select}) : step\n );\n }\n if (normalized.limit === undefined && normalized.offset !== undefined)\n steps.push(Object.freeze({kind: 'offset', offset: normalized.offset}));\n return Object.freeze(steps);\n}\n\n/** Validates identifiers without interpreting dots or rewriting quoted names. */\nexport function validateTableReference(\n reference: unknown\n): asserts reference is TableReference | undefined {\n if (reference === undefined) return;\n if (typeof reference === 'string' && reference.trim()) return;\n if (reference && typeof reference === 'object' && !Array.isArray(reference)) {\n const value = reference as Record<string, unknown>;\n if (\n Object.keys(value).every(key => key === 'source' || key === 'table') &&\n typeof value.source === 'string' &&\n value.source.trim() &&\n typeof value.table === 'string' &&\n value.table.trim()\n )\n return;\n }\n throw new Error('FROM must be a source name or {source, table} with non-empty names.');\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,yBAAoD;AAGpD,0BAMO;AAYP,iCAAgC;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AC3E,UAAM,QAAQ;AACd,QACE,OAAO,KAAK,KAAK,EAAE,MAAM,SAAO,QAAQ,YAAY,QAAQ,OAAO,KACnE,OAAO,MAAM,WAAW,YACxB,MAAM,OAAO,KAAK,KAClB,OAAO,MAAM,UAAU,YACvB,MAAM,MAAM,KAAK;AAEjB;AAAA,EACJ;AACA,QAAM,IAAI,MAAM,qEAAqE;AACvF;;;AHzBA,6BAAkD;AAGlD,+BAA8B;AAC9B,mBAAoE;AAgBpE,IAAAC,uBAAkC;AAclC,gCAKO;",
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {createScanEngine, registerScanBackend} from './scan-engine';\n// The low-level executor lives in loader-utils so format packages can reuse it without importing\n// this optional module. It is re-exported here as the scan package's common batch adapter.\nexport {\n executeTableScanBatches,\n filterTableBatch,\n projectTableBatch,\n projectTableSchema,\n truncateTableBatch\n} from '@loaders.gl/core/loader-utils';\nexport type {TableScanBatchReader, TableScanBatchOperators} from '@loaders.gl/core/loader-utils';\nexport type {\n ScanBackend,\n ScanBackendLoader,\n ScanBackendName,\n ScanEngine,\n ScanEngineOptions\n} from './scan-engine';\n\n// Re-export the query vocabulary from one optional entry point for applications. Format adapters\n// should continue importing the lightweight contracts from @loaders.gl/core/loader-utils.\nexport {parseSQLPredicate} from './parse-sql-predicate';\nexport type {ArrowFilterOptions} from './arrow-execution';\nexport type {ArrowQueryOptions} from './query-arrow-table';\nexport type {SQLPredicate} from './sql-predicate-types';\nexport type {\n RelationalAggregate,\n RelationalExpression,\n RelationalOrderKey,\n TableQuery,\n TableReference,\n TableSourceCollection,\n TableSelection,\n TableQueryExecutionOptions,\n TableQueryOptions\n} from '@loaders.gl/core/loader-utils';\n\nexport {\n createScanQueryMetadata,\n intersectPointCloudBounds,\n selectPointCloudScanTiles,\n validatePointCloudQueryOptions\n} from '@loaders.gl/core/loader-utils';\nexport type {\n CreateScanQueryMetadataOptions,\n PointCloudQueryBounds,\n PointCloudQueryCapabilities,\n PointCloudQueryOptions,\n PointCloudScanChildrenLoader,\n PointCloudScanReadOptions,\n PointCloudScanSource,\n PointCloudScanTile,\n RasterQueryCapabilities,\n RasterQueryOptions,\n ScanBounds,\n ScanColumnMetadata,\n ScanColumnRole,\n ScanExecutionMethod,\n TableQueryExecutionSummary,\n TableQueryCompleteCallback,\n TableQueryExecutionStatus,\n TableQuerySourceExecutionSummary,\n ScanExecutionSupport,\n ScanQueryCapabilities,\n ScanQueryMetadata,\n ScanQueryMetadataOptions,\n ScanQueryMetadataProvider,\n ScanRasterLevel,\n ScanSourceStatistics,\n ScanSpatialMetadata,\n TableScanReadOptions,\n TableScanSource\n} from '@loaders.gl/core/loader-utils';\nexport type {ScanQuery} from './scan-query';\n\nexport {\n FEDERATED_TABLE_QUERY_CAPABILITIES,\n FederatedTableScanSource,\n getFederatedTableBatchProvenance\n} from './federated-table-scan-source';\nexport type {\n FederatedTableBatch,\n FederatedTableBatchProvenance,\n FederatedTableScanExplain,\n FederatedTableScanSourceOptions,\n FederatedTableSchemaPolicy,\n FederatedTableSourceEntry,\n FederatedTableSourceExplain\n} from './federated-table-scan-source';\n\nexport {\n AddressedVectorTableScanSource,\n VectorFeatureTableScanSource,\n VectorTileTableScanSource\n} from './vector-table-scan-source';\nexport type {\n VectorFeatureTableScanSourceOptions,\n VectorTableScanSourceOptions,\n VectorTileTableScanSourceOptions\n} from './vector-table-scan-source';\n\nexport {bindSQLPredicate} from './bind-sql-predicate';\nexport {\n isSQLPredicate,\n SQL_PREDICATE_JSON_SCHEMA,\n validateSQLPredicate\n} from './sql-predicate-schema';\nexport {isSQLPredicateParameter} from './sql-predicate-types';\nexport type {\n BoundSQLPredicate,\n SQLComparisonPredicate,\n SQLInPredicate,\n SQLLogicalPredicate,\n SQLNotPredicate,\n SQLNullPredicate,\n SQLPredicateParameter,\n SQLPredicateParameterValues,\n SQLPredicateParserOptions,\n SQLPredicateProperty,\n SQLPredicateScalar,\n SQLPredicateValue\n} from './sql-predicate-types';\nexport {explainTableQuery, getSQLPredicateColumnNames, planTableQuery} from './table-query';\nexport type {\n TableQueryPlan,\n TableQueryPlanStep,\n TableQueryFilterStep,\n TableQueryLimitStep,\n TableQueryProjectStep,\n TableQueryScanStep\n} from './table-query';\n\nexport {\n normalizeTableQuery,\n planLogicalTableQuery\n} from '../loader-utils/lib/scan-utils/logical-table-query';\nexport type {\n NormalizedTableSelection,\n NormalizedTableQuery,\n LogicalTableQueryProjectStep,\n LogicalTableQueryPlan\n} from '../loader-utils/lib/scan-utils/logical-table-query';\n\nexport {queryGroupedSQL} from './query-grouped-sql';\nexport {preloadQuery, query, queryInBatches, queryProgressive} from './query';\nexport type {\n ProgressiveAggregate,\n ProgressiveAggregateQuery,\n ProgressiveQueryOptions,\n ProgressiveQuerySnapshot\n} from './query-progressive';\nexport type {\n Query,\n QueryOptions,\n SQLQueryParser,\n TypedTableQuery,\n TypedColumnSelection,\n TypedColumnType\n} from './query';\n\nexport {createQueryMetadata} from '@loaders.gl/core/loader-utils';\nexport type {\n CreateQueryMetadataOptions,\n QueryMetadata,\n QueryMetadataOptions,\n QueryCapabilities,\n TableQuerySource,\n TableQueryReadOptions,\n TableQueryPushdownRequest,\n TableQueryPushdownPlan,\n TableQueryCapabilities,\n QueryPushdownCapabilityHints\n} from '@loaders.gl/core/loader-utils';\n\nexport type {ArrowQueryWorkerOptions, ArrowQueryWorkerSession} from './arrow-query-worker';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n compileColumnarPredicate,\n type ColumnarPredicate,\n type ColumnarPredicateReader\n} from '@math.gl/sql/columnar-predicate';\nimport type {ArrayType} from '@loaders.gl/core/schema';\n\nexport {\n bindColumnarPredicateParameters,\n copyColumnarPredicate,\n compileColumnarPredicate,\n getColumnarPredicateColumns,\n getColumnarPredicateParameterNames,\n getColumnarPredicatePath,\n getColumnarPredicatePaths,\n isColumnarPredicateParameter,\n isColumnarPredicateValue,\n validateColumnarPredicate,\n type ColumnarComparisonPredicate,\n type ColumnarInPredicate,\n type ColumnarLogicalPredicate,\n type ColumnarNotPredicate,\n type ColumnarNullPredicate,\n type ColumnarPredicate,\n type ColumnarPredicateInputValue,\n type ColumnarPredicateParameter,\n type ColumnarPredicateParameterValues,\n type ColumnarPredicateProperty,\n type ColumnarPredicateValue,\n type ParameterizedColumnarPredicate\n} from '@math.gl/sql/columnar-predicate';\n\n/** Finds the source rows matching a bound portable predicate. */\nexport function filterColumnarRowIndices(\n predicate: ColumnarPredicate | undefined,\n columns: Record<string, ArrayType>,\n rowCount: number\n): number[] {\n if (!predicate) return Array.from({length: rowCount}, (_, index) => index);\n const evaluate = compileColumnarPredicate(predicate, path => bindColumnarReader(columns, path));\n const result: number[] = [];\n for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n if (evaluate(rowIndex) === true) result.push(rowIndex);\n }\n return result;\n}\n\n/** Gathers selected rows from format-neutral column arrays. */\nexport function gatherColumnarColumns(\n columns: Record<string, ArrayType>,\n rowIndices: readonly number[],\n selectedColumns?: ReadonlySet<string>\n): Record<string, ArrayType> {\n const result: Record<string, ArrayType> = {};\n for (const [name, column] of Object.entries(columns)) {\n if (!selectedColumns || selectedColumns.has(name)) {\n result[name] = rowIndices.map(rowIndex => (column as ArrayLike<unknown>)[rowIndex]);\n }\n }\n return result;\n}\n\n/** Binds a portable predicate path to one source column. */\nfunction bindColumnarReader(\n columns: Record<string, ArrayType>,\n [name, ...path]: readonly string[]\n): ColumnarPredicateReader {\n const column = columns[name];\n return rowIndex => {\n let value = column?.[rowIndex];\n for (const property of path) {\n if (value == null) return null;\n value = value[property];\n }\n return value as ReturnType<ColumnarPredicateReader>;\n };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n getColumnarPredicateColumns,\n validateColumnarPredicate,\n type ColumnarPredicate,\n type ColumnarPredicateProperty\n} from './columnar-predicate';\n\n/** One source column selected for logical output, optionally under a new name. */\nexport type TableSelection =\n | string\n | Readonly<{\n /** Source column name, resolved before aliases are applied. */\n column: string;\n /** Output field name. Defaults to the source column name. */\n as?: string;\n }>;\n\n/** Named source, or a named table exposed by a source. Strings are literal names, not dotted paths. */\nexport type TableReference =\n | string\n | Readonly<{\n /** Name of a registered data source. */\n source: string;\n /** Name of a table exposed by that source. */\n table: string;\n }>;\n\n/** Logical query description, independent of cancellation and execution observers. */\nexport type TableQuery<\n PredicateT extends ColumnarPredicate<unknown, ColumnarPredicateProperty> = ColumnarPredicate\n> = Readonly<{\n /** Optional named source or qualified table selected before planning. */\n from?: TableReference;\n /** Output columns in selection order. Omission selects all source columns. */\n select?: readonly TableSelection[];\n /** Predicate evaluated against source columns before output aliases are applied. */\n where?: PredicateT;\n /** Number of filtered rows skipped before applying the limit. */\n offset?: number;\n /** Maximum number of rows retained after filtering and offset. */\n limit?: number;\n}>;\n\n/** Controls one execution without becoming part of the logical query. */\nexport type TableQueryExecutionOptions = Readonly<{\n /** Cooperatively cancels source discovery and execution. */\n signal?: AbortSignal;\n /** Receives one terminal summary, including cancellation, failure, and early termination. */\n onQueryComplete?: import('./scan-query-metadata').TableQueryCompleteCallback;\n}>;\n\n/** Immutable, backend-neutral request for a scan, filter, projection, and limit. */\nexport type TableQueryOptions<\n PredicateT extends ColumnarPredicate<unknown, ColumnarPredicateProperty> = ColumnarPredicate\n> = Pick<TableQueryExecutionOptions, 'signal'> &\n Readonly<{\n /** Portable predicate applied before projection. */\n predicate?: PredicateT;\n /** Output columns in caller-specified order. Defaults to every source column. */\n columns?: readonly string[];\n /** Maximum number of rows retained after filtering and projection. */\n limit?: number;\n }>;\n\n/** Reads the minimum source columns required by the remaining table-query plan. */\nexport type TableQueryScanStep = Readonly<{\n /** Plan discriminator. */\n kind: 'scan';\n /** Source columns required for filtering and output. */\n columns: readonly string[];\n}>;\n\n/** Applies a portable predicate while all predicate columns remain available. */\nexport type TableQueryFilterStep<PredicateT = ColumnarPredicate> = Readonly<{\n /** Plan discriminator. */\n kind: 'filter';\n /** Predicate evaluated using three-valued Boolean semantics. */\n predicate: PredicateT;\n}>;\n\n/** Narrows the result to requested output columns. */\nexport type TableQueryProjectStep = Readonly<{\n /** Plan discriminator. */\n kind: 'project';\n /** Output columns in caller-specified order. */\n columns: readonly string[];\n}>;\n\n/** Retains the first rows in source order after filtering and projection. */\nexport type TableQueryLimitStep = Readonly<{\n /** Plan discriminator. */\n kind: 'limit';\n /** Maximum number of retained rows. */\n limit: number;\n}>;\n\n/** One immutable operation in a normalized table-query plan. */\nexport type TableQueryPlanStep<PredicateT = ColumnarPredicate> =\n | TableQueryScanStep\n | TableQueryFilterStep<PredicateT>\n | TableQueryProjectStep\n | TableQueryLimitStep;\n\n/** Immutable logical query plan shared by CPU, SQL, and GPU backends. */\nexport type TableQueryPlan<PredicateT = ColumnarPredicate> =\n readonly TableQueryPlanStep<PredicateT>[];\n\n/** Capability levels for an individual portable table-query operator. */\nexport type TableQueryOperatorSupport =\n | 'unsupported'\n | 'residual'\n | 'pushdown'\n | 'pushdown+residual';\n\n/** Optimization and correctness capabilities advertised by a table-query backend. */\nexport type TableQueryCapabilities = Readonly<{\n /** Whether output projection can avoid reading unrequested columns. */\n projection: TableQueryOperatorSupport;\n /** Whether predicates are unsupported, residual, pushed down, or both pushed and residual. */\n predicate: TableQueryOperatorSupport;\n /** Whether limits are unsupported, applied after execution, or stop physical work early. */\n limit: TableQueryOperatorSupport;\n /** Whether exact CAST semantics can execute at the source; conversions require negotiation. */\n cast?: TableQueryOperatorSupport;\n /** Whether the source can skip filtered rows before its limit. */\n offset?: TableQueryOperatorSupport;\n /** Whether the backend can stream bounded result batches. */\n streaming: boolean;\n /** Whether active and queued physical work observes cancellation. */\n cancellation: boolean;\n /** Whether scalar expressions can be evaluated before projection. */\n expressions?: TableQueryOperatorSupport;\n /** Whether output rows can be ordered before the global limit. */\n orderBy?: TableQueryOperatorSupport;\n /** Whether grouped aggregate output is supported. */\n aggregates?: TableQueryOperatorSupport;\n}>;\n\n/**\n * Produces the canonical scan, filter, project, and limit sequence for a table query.\n *\n * Predicate columns are retained by the scan even if callers omit them from the output projection.\n * This makes SQL `WHERE` semantics independent of a backend's internal API call order.\n */\nexport function planTableQuery<\n ValueT,\n PropertyT extends ColumnarPredicateProperty,\n PredicateT extends ColumnarPredicate<ValueT, PropertyT>\n>(\n sourceColumnNames: readonly string[],\n options: TableQueryOptions<PredicateT> = {}\n): TableQueryPlan<PredicateT> {\n validateTableQueryOptions(sourceColumnNames, options);\n\n const outputColumnNames = options.columns ? [...options.columns] : [...sourceColumnNames];\n const predicateColumnNames = options.predicate\n ? getColumnarPredicateColumns(options.predicate)\n : [];\n const requiredColumnNames = new Set([...outputColumnNames, ...predicateColumnNames]);\n const scanColumnNames = sourceColumnNames.filter(columnName =>\n requiredColumnNames.has(columnName)\n );\n const steps: TableQueryPlanStep<PredicateT>[] = [\n Object.freeze({kind: 'scan' as const, columns: Object.freeze(scanColumnNames)})\n ];\n\n if (options.predicate) {\n steps.push(Object.freeze({kind: 'filter' as const, predicate: options.predicate}));\n }\n steps.push(Object.freeze({kind: 'project' as const, columns: Object.freeze(outputColumnNames)}));\n if (options.limit !== undefined) {\n steps.push(Object.freeze({kind: 'limit' as const, limit: options.limit}));\n }\n return Object.freeze(steps);\n}\n\n/** Validates a portable table query against the columns exposed by one source. */\nexport function validateTableQueryOptions<\n ValueT,\n PropertyT extends ColumnarPredicateProperty,\n PredicateT extends ColumnarPredicate<ValueT, PropertyT>\n>(sourceColumnNames: readonly string[], options: TableQueryOptions<PredicateT>): void {\n const availableColumnNames = new Set(sourceColumnNames);\n const outputColumnNames = options.columns ?? sourceColumnNames;\n const seenColumnNames = new Set<string>();\n for (const columnName of outputColumnNames) {\n if (!availableColumnNames.has(columnName)) {\n throw new Error(`Table query column not found: ${columnName}`);\n }\n if (seenColumnNames.has(columnName)) {\n throw new Error(`Table query column was selected more than once: ${columnName}`);\n }\n seenColumnNames.add(columnName);\n }\n validateTableQueryLimit(options.limit);\n if (options.predicate) {\n validateColumnarPredicate(options.predicate, availableColumnNames);\n }\n}\n\n/** Validates a portable table-query limit independently of source-schema validation. */\nexport function validateTableQueryLimit(limit: number | undefined): void {\n if (limit !== undefined && (!Number.isSafeInteger(limit) || limit < 0)) {\n throw new Error('Table query limit must be a non-negative safe integer.');\n }\n}\n\n/** Validates a logical row offset before any batches are read. */\nexport function validateTableQueryOffset(offset: number | undefined): void {\n if (offset !== undefined && (!Number.isSafeInteger(offset) || offset < 0)) {\n throw new Error('Table query offset must be a non-negative safe integer.');\n }\n}\n\n/** Static format hints only; omission means unknown and never authorizes execution. */\nexport type QueryPushdownCapabilityHints = Readonly<{\n /** The format may support reading only selected columns. */\n projection?: boolean;\n /** The format may support predicate evaluation or pruning. */\n predicate?: boolean;\n /** An implementation may evaluate some CAST conversions. */\n cast?: boolean;\n /** An implementation may skip rows at the source. */\n offset?: boolean;\n /** An implementation may stop source work after a row limit. */\n limit?: boolean;\n}>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n validateColumnarPredicate,\n type ColumnarPredicate,\n type ColumnarPredicateProperty\n} from './columnar-predicate';\nimport {\n planTableQuery,\n validateTableQueryLimit,\n validateTableQueryOffset,\n type TableQuery,\n type TableReference,\n type TableQueryPlanStep\n} from './table-query';\n\n/** Explicit source-to-output mapping for one selected field. */\nexport type NormalizedTableSelection = Readonly<{\n /** Column read from the source. */\n column: string;\n /** Name of the returned field. */\n as: string;\n}>;\n\n/** Logical query with all output selections expanded into explicit mappings. */\nexport type NormalizedTableQuery<PredicateT = ColumnarPredicate> = Readonly<{\n /** Optional source reference preserved separately from physical scan operations. */\n from?: TableReference;\n /** Output mappings in caller-specified order. */\n select: readonly NormalizedTableSelection[];\n /** Predicate resolved against source names before aliases. */\n where?: PredicateT;\n /** Global number of filtered rows skipped before applying the limit. */\n offset?: number;\n /** Global post-filter row limit. */\n limit?: number;\n}>;\n\n/** Logical projection retaining source names separately from output names. */\nexport type LogicalTableQueryProjectStep = Readonly<{\n /** Plan discriminator. */\n kind: 'project';\n /** Output mappings applied after filtering. */\n select: readonly NormalizedTableSelection[];\n}>;\n\n/** Scan, filter, aliased projection, and limit operations in execution order. */\nexport type LogicalTableQueryPlan<PredicateT = ColumnarPredicate> = readonly (\n | Exclude<TableQueryPlanStep<PredicateT>, {kind: 'project'}>\n | Readonly<{kind: 'offset'; offset: number}>\n | LogicalTableQueryProjectStep\n)[];\n\n/** Validates logical query fields and expands selections without modifying caller input. */\nexport function normalizeTableQuery<\n PredicateT extends ColumnarPredicate<unknown, ColumnarPredicateProperty> = ColumnarPredicate\n>(\n sourceColumnNames: readonly string[],\n query: TableQuery<PredicateT> = {}\n): NormalizedTableQuery<PredicateT> {\n if (!query || typeof query !== 'object' || Array.isArray(query)) {\n throw new Error('Table query must be an object.');\n }\n for (const key of Object.keys(query)) {\n if (!['from', 'select', 'where', 'offset', 'limit'].includes(key)) {\n throw new Error(`Unsupported table query option: ${key}`);\n }\n }\n if (query.select !== undefined && (!Array.isArray(query.select) || query.select.length === 0)) {\n throw new Error('Table query select must be a non-empty array.');\n }\n validateTableReference(query.from);\n validateTableQueryOffset(query.offset);\n validateTableQueryLimit(query.limit);\n if (query.where !== undefined) {\n validateColumnarPredicate(query.where, new Set(sourceColumnNames));\n }\n const outputNames = new Set<string>();\n const select = (query.select ?? sourceColumnNames).map(selection => {\n if (\n typeof selection !== 'string' &&\n (!selection || typeof selection !== 'object' || Array.isArray(selection))\n ) {\n throw new Error('Table query selection must be a column name or {column, as}.');\n }\n if (\n typeof selection !== 'string' &&\n Object.keys(selection).some(key => key !== 'column' && key !== 'as')\n ) {\n throw new Error('Unsupported table query selection field.');\n }\n const column = typeof selection === 'string' ? selection : selection.column;\n const outputName =\n typeof selection === 'string'\n ? selection\n : selection.as === undefined\n ? column\n : selection.as;\n if (typeof column !== 'string' || !sourceColumnNames.includes(column)) {\n throw new Error(`Table query column not found: ${column}`);\n }\n if (typeof outputName !== 'string' || outputName.length === 0) {\n throw new Error('Table query output name must be a non-empty string.');\n }\n if (outputNames.has(outputName)) {\n throw new Error(`Duplicate table query output name: ${outputName}`);\n }\n outputNames.add(outputName);\n return Object.freeze({column, as: outputName});\n });\n // Reuse source-column and predicate validation; aliases never participate in WHERE resolution.\n planTableQuery(sourceColumnNames, {\n columns: [...new Set(select.map(selection => selection.column))],\n predicate: query.where,\n limit: query.limit\n });\n return Object.freeze({\n select: Object.freeze(select),\n ...(query.from === undefined\n ? {}\n : {from: typeof query.from === 'string' ? query.from : Object.freeze({...query.from})}),\n ...(query.where === undefined ? {} : {where: query.where}),\n ...(query.offset === undefined ? {} : {offset: query.offset}),\n ...(query.limit === undefined ? {} : {limit: query.limit})\n });\n}\n\n/** Builds a logical plan using the shared scan planner and an explicit aliased projection. */\nexport function planLogicalTableQuery<\n PredicateT extends ColumnarPredicate<unknown, ColumnarPredicateProperty> = ColumnarPredicate\n>(\n sourceColumnNames: readonly string[],\n query: TableQuery<PredicateT> = {}\n): LogicalTableQueryPlan<PredicateT> {\n const normalized = normalizeTableQuery(sourceColumnNames, query);\n const plan = planTableQuery(sourceColumnNames, {\n columns: [...new Set(normalized.select.map(selection => selection.column))],\n predicate: normalized.where,\n limit: normalized.limit\n });\n const steps: LogicalTableQueryPlan<PredicateT>[number][] = [];\n for (const step of plan) {\n if (step.kind === 'limit' && normalized.offset !== undefined)\n steps.push(Object.freeze({kind: 'offset', offset: normalized.offset}));\n steps.push(\n step.kind === 'project' ? Object.freeze({kind: 'project', select: normalized.select}) : step\n );\n }\n if (normalized.limit === undefined && normalized.offset !== undefined)\n steps.push(Object.freeze({kind: 'offset', offset: normalized.offset}));\n return Object.freeze(steps);\n}\n\n/** Validates identifiers without interpreting dots or rewriting quoted names. */\nexport function validateTableReference(\n reference: unknown\n): asserts reference is TableReference | undefined {\n if (reference === undefined) return;\n if (typeof reference === 'string' && reference.trim()) return;\n if (reference && typeof reference === 'object' && !Array.isArray(reference)) {\n const value = reference as Record<string, unknown>;\n if (\n Object.keys(value).every(key => key === 'source' || key === 'table') &&\n typeof value.source === 'string' &&\n value.source.trim() &&\n typeof value.table === 'string' &&\n value.table.trim()\n )\n return;\n }\n throw new Error('FROM must be a source name or {source, table} with non-empty names.');\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,yBAAoD;AAGpD,0BAMO;AAYP,iCAAgC;AAgBhC,IAAAA,uBAKO;AAiCP,yCAIO;AAWP,sCAIO;AAOP,gCAA+B;AAC/B,kCAIO;AACP,iCAAsC;AAetC,IAAAC,sBAA4E;;;AC1H5E,gCAIO;AAGP,IAAAC,6BAuBO;;;ACkHA,SAAS,eAKd,mBACA,UAAyC,CAAC,GACd;AAC5B,4BAA0B,mBAAmB,OAAO;AAEpD,QAAM,oBAAoB,QAAQ,UAAU,CAAC,GAAG,QAAQ,OAAO,IAAI,CAAC,GAAG,iBAAiB;AACxF,QAAM,uBAAuB,QAAQ,gBACjC,wDAA4B,QAAQ,SAAS,IAC7C,CAAC;AACL,QAAM,sBAAsB,oBAAI,IAAI,CAAC,GAAG,mBAAmB,GAAG,oBAAoB,CAAC;AACnF,QAAM,kBAAkB,kBAAkB;AAAA,IAAO,gBAC/C,oBAAoB,IAAI,UAAU;AAAA,EACpC;AACA,QAAM,QAA0C;AAAA,IAC9C,OAAO,OAAO,EAAC,MAAM,QAAiB,SAAS,OAAO,OAAO,eAAe,EAAC,CAAC;AAAA,EAChF;AAEA,MAAI,QAAQ,WAAW;AACrB,UAAM,KAAK,OAAO,OAAO,EAAC,MAAM,UAAmB,WAAW,QAAQ,UAAS,C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AAC;AACvE,UAAM;AAAA,MACJ,KAAK,SAAS,YAAY,OAAO,OAAO,EAAC,MAAM,WAAW,QAAQ,WAAW,OAAM,CAAC,IAAI;AAAA,IAC1F;AAAA,EACF;AACA,MAAI,WAAW,UAAU,UAAa,WAAW,WAAW;AAC1D,UAAM,KAAK,OAAO,OAAO,EAAC,MAAM,UAAU,QAAQ,WAAW,OAAM,CAAC,CAAC;AACvE,SAAO,OAAO,OAAO,KAAK;AAC5B;AAGO,SAAS,uBACd,WACiD;AACjD,MAAI,cAAc,OAAW;AAC7B,MAAI,OAAO,cAAc,YAAY,UAAU,KAAK,EAAG;AACvD,MAAI,aAAa,OAAO,cAAc,YAAY,CAAC,MAAM,QAAQ,SAAS,GAAG;AAC3E,UAAM,QAAQ;AACd,QACE,OAAO,KAAK,KAAK,EAAE,MAAM,SAAO,QAAQ,YAAY,QAAQ,OAAO,KACnE,OAAO,MAAM,WAAW,YACxB,MAAM,OAAO,KAAK,KAClB,OAAO,MAAM,UAAU,YACvB,MAAM,MAAM,KAAK;AAEjB;AAAA,EACJ;AACA,QAAM,IAAI,MAAM,qEAAqE;AACvF;;;AH1BA,+BAA8B;AAC9B,mBAAoE;AAgBpE,IAAAC,uBAAkC;",
6
6
  "names": ["import_loader_utils", "import_table_query", "import_columnar_predicate", "query", "import_loader_utils"]
7
7
  }
@@ -3,6 +3,7 @@ export { executeTableScanBatches, filterTableBatch, projectTableBatch, projectTa
3
3
  export type { TableScanBatchReader, TableScanBatchOperators } from '@loaders.gl/core/loader-utils';
4
4
  export type { ScanBackend, ScanBackendLoader, ScanBackendName, ScanEngine, ScanEngineOptions } from "./scan-engine.js";
5
5
  export { parseSQLPredicate } from "./parse-sql-predicate.js";
6
+ export type { ArrowFilterOptions } from "./arrow-execution.js";
6
7
  export type { ArrowQueryOptions } from "./query-arrow-table.js";
7
8
  export type { SQLPredicate } from "./sql-predicate-types.js";
8
9
  export type { RelationalAggregate, RelationalExpression, RelationalOrderKey, TableQuery, TableReference, TableSourceCollection, TableSelection, TableQueryExecutionOptions, TableQueryOptions } from '@loaders.gl/core/loader-utils';
@@ -13,8 +14,6 @@ export { FEDERATED_TABLE_QUERY_CAPABILITIES, FederatedTableScanSource, getFedera
13
14
  export type { FederatedTableBatch, FederatedTableBatchProvenance, FederatedTableScanExplain, FederatedTableScanSourceOptions, FederatedTableSchemaPolicy, FederatedTableSourceEntry, FederatedTableSourceExplain } from "./federated-table-scan-source.js";
14
15
  export { AddressedVectorTableScanSource, VectorFeatureTableScanSource, VectorTileTableScanSource } from "./vector-table-scan-source.js";
15
16
  export type { VectorFeatureTableScanSourceOptions, VectorTableScanSourceOptions, VectorTileTableScanSourceOptions } from "./vector-table-scan-source.js";
16
- export { ARROW_TABLE_QUERY_CAPABILITIES, explainArrowTableQuery } from "./plan-arrow-table-query.js";
17
- export { queryArrowTable } from "./query-arrow-table.js";
18
17
  export { bindSQLPredicate } from "./bind-sql-predicate.js";
19
18
  export { isSQLPredicate, SQL_PREDICATE_JSON_SCHEMA, validateSQLPredicate } from "./sql-predicate-schema.js";
20
19
  export { isSQLPredicateParameter } from "./sql-predicate-types.js";
@@ -23,13 +22,11 @@ export { explainTableQuery, getSQLPredicateColumnNames, planTableQuery } from ".
23
22
  export type { TableQueryPlan, TableQueryPlanStep, TableQueryFilterStep, TableQueryLimitStep, TableQueryProjectStep, TableQueryScanStep } from "./table-query.js";
24
23
  export { normalizeTableQuery, planLogicalTableQuery } from "../loader-utils/lib/scan-utils/logical-table-query.js";
25
24
  export type { NormalizedTableSelection, NormalizedTableQuery, LogicalTableQueryProjectStep, LogicalTableQueryPlan } from "../loader-utils/lib/scan-utils/logical-table-query.js";
26
- export { projectArrowTable, filterArrowTable } from "./arrow-execution.js";
27
- export type { ArrowFilterOptions } from "./arrow-execution.js";
28
25
  export { queryGroupedSQL } from "./query-grouped-sql.js";
29
26
  export { preloadQuery, query, queryInBatches, queryProgressive } from "./query.js";
30
27
  export type { ProgressiveAggregate, ProgressiveAggregateQuery, ProgressiveQueryOptions, ProgressiveQuerySnapshot } from "./query-progressive.js";
31
28
  export type { Query, QueryOptions, SQLQueryParser, TypedTableQuery, TypedColumnSelection, TypedColumnType } from "./query.js";
32
29
  export { createQueryMetadata } from '@loaders.gl/core/loader-utils';
33
30
  export type { CreateQueryMetadataOptions, QueryMetadata, QueryMetadataOptions, QueryCapabilities, TableQuerySource, TableQueryReadOptions, TableQueryPushdownRequest, TableQueryPushdownPlan, TableQueryCapabilities, QueryPushdownCapabilityHints } from '@loaders.gl/core/loader-utils';
34
- export { createArrowQueryWorker, queryArrowTableInWorker, type ArrowQueryWorkerOptions, type ArrowQueryWorkerSession } from "./arrow-query-worker.js";
31
+ export type { ArrowQueryWorkerOptions, ArrowQueryWorkerSession } from "./arrow-query-worker.js";
35
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scan/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,gBAAgB,EAAE,mBAAmB,EAAC,yBAAsB;AAGpE,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAC,oBAAoB,EAAE,uBAAuB,EAAC,MAAM,+BAA+B,CAAC;AACjG,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,iBAAiB,EAClB,yBAAsB;AAIvB,OAAO,EAAC,iBAAiB,EAAC,iCAA8B;AACxD,YAAY,EAAC,iBAAiB,EAAC,+BAA4B;AAC3D,YAAY,EAAC,YAAY,EAAC,iCAA8B;AACxD,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,0BAA0B,EAC1B,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,uBAAuB,EACvB,yBAA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eAAe,EAChB,mBAAgB;AAEjB,OAAO,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAC;AAClE,YAAY,EACV,0BAA0B,EAC1B,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,4BAA4B,EAC7B,MAAM,+BAA+B,CAAC;AAEvC,YAAY,EAAC,uBAAuB,EAAE,uBAAuB,EAAC,gCAA6B"}
@@ -11,16 +11,12 @@ export { parseSQLPredicate } from "./parse-sql-predicate.js";
11
11
  export { createScanQueryMetadata, intersectPointCloudBounds, selectPointCloudScanTiles, validatePointCloudQueryOptions } from '@loaders.gl/core/loader-utils';
12
12
  export { FEDERATED_TABLE_QUERY_CAPABILITIES, FederatedTableScanSource, getFederatedTableBatchProvenance } from "./federated-table-scan-source.js";
13
13
  export { AddressedVectorTableScanSource, VectorFeatureTableScanSource, VectorTileTableScanSource } from "./vector-table-scan-source.js";
14
- export { ARROW_TABLE_QUERY_CAPABILITIES, explainArrowTableQuery } from "./plan-arrow-table-query.js";
15
- export { queryArrowTable } from "./query-arrow-table.js";
16
14
  export { bindSQLPredicate } from "./bind-sql-predicate.js";
17
15
  export { isSQLPredicate, SQL_PREDICATE_JSON_SCHEMA, validateSQLPredicate } from "./sql-predicate-schema.js";
18
16
  export { isSQLPredicateParameter } from "./sql-predicate-types.js";
19
17
  export { explainTableQuery, getSQLPredicateColumnNames, planTableQuery } from "./table-query.js";
20
18
  export { normalizeTableQuery, planLogicalTableQuery } from "../loader-utils/lib/scan-utils/logical-table-query.js";
21
- export { projectArrowTable, filterArrowTable } from "./arrow-execution.js";
22
19
  export { queryGroupedSQL } from "./query-grouped-sql.js";
23
20
  export { preloadQuery, query, queryInBatches, queryProgressive } from "./query.js";
24
21
  export { createQueryMetadata } from '@loaders.gl/core/loader-utils';
25
- export { createArrowQueryWorker, queryArrowTableInWorker } from "./arrow-query-worker.js";
26
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scan/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,gBAAgB,EAAE,mBAAmB,EAAC,yBAAsB;AACpE,iGAAiG;AACjG,2FAA2F;AAC3F,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,+BAA+B,CAAC;AAUvC,iGAAiG;AACjG,0FAA0F;AAC1F,OAAO,EAAC,iBAAiB,EAAC,iCAA8B;AAexD,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,8BAA8B,EAC/B,MAAM,+BAA+B,CAAC;AAiCvC,OAAO,EACL,kCAAkC,EAClC,wBAAwB,EACxB,gCAAgC,EACjC,yCAAsC;AAWvC,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,yBAAyB,EAC1B,sCAAmC;AAOpC,OAAO,EAAC,8BAA8B,EAAE,sBAAsB,EAAC,oCAAiC;AAChG,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,OAAO,EAAC,gBAAgB,EAAC,gCAA6B;AACtD,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACrB,kCAA+B;AAChC,OAAO,EAAC,uBAAuB,EAAC,iCAA8B;AAe9D,OAAO,EAAC,iBAAiB,EAAE,0BAA0B,EAAE,cAAc,EAAC,yBAAsB;AAU5F,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACtB,8DAA2D;AAQ5D,OAAO,EAAC,iBAAiB,EAAE,gBAAgB,EAAC,6BAA0B;AAGtE,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,OAAO,EAAC,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAC,mBAAgB;AAgB9E,OAAO,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAC;AAclE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EAGxB,gCAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scan/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,gBAAgB,EAAE,mBAAmB,EAAC,yBAAsB;AACpE,iGAAiG;AACjG,2FAA2F;AAC3F,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,+BAA+B,CAAC;AAUvC,iGAAiG;AACjG,0FAA0F;AAC1F,OAAO,EAAC,iBAAiB,EAAC,iCAA8B;AAgBxD,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,8BAA8B,EAC/B,MAAM,+BAA+B,CAAC;AAiCvC,OAAO,EACL,kCAAkC,EAClC,wBAAwB,EACxB,gCAAgC,EACjC,yCAAsC;AAWvC,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,yBAAyB,EAC1B,sCAAmC;AAOpC,OAAO,EAAC,gBAAgB,EAAC,gCAA6B;AACtD,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACrB,kCAA+B;AAChC,OAAO,EAAC,uBAAuB,EAAC,iCAA8B;AAe9D,OAAO,EAAC,iBAAiB,EAAE,0BAA0B,EAAE,cAAc,EAAC,yBAAsB;AAU5F,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACtB,8DAA2D;AAQ5D,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,OAAO,EAAC,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAC,mBAAgB;AAgB9E,OAAO,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAC"}
@@ -28,7 +28,7 @@ var import_query = require("./query.cjs");
28
28
  async function queryGroupedSQL(sql, options) {
29
29
  const statement = (0, import_parser.parseSQLSelectStatement)(sql);
30
30
  const [key] = statement.groupBy ?? [];
31
- if (statement.groupBy?.length !== 1 || key?.type !== "Identifier" || statement.joins.length || statement.from.alias || statement.orderBy?.length || statement.limit !== void 0 || statement.offset !== void 0)
31
+ if (statement.groupBy?.length !== 1 || key?.type !== "Identifier" || statement.joins.length || statement.from.alias || statement.having || statement.orderBy?.length || statement.limit !== void 0 || statement.offset !== void 0)
32
32
  throw new Error("Expected a single-source, single-key GROUP BY query");
33
33
  const [group, ...items] = statement.select ?? [];
34
34
  if (group?.expression.type !== "Identifier" || group.expression.name !== key.name || group.alias)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/scan/query-grouped-sql.ts"],
4
- "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {parseSQLSelectStatement} from '@math.gl/sql/parser';\nimport type {Table} from 'apache-arrow';\nimport {queryProgressive, type QueryOptions} from './query';\nimport type {ProgressiveAggregate, ProgressiveAggregateQuery} from './query-progressive';\n\n/** Executes a single-key grouped SQL scan and returns its final replacement table. */\nexport async function queryGroupedSQL(sql: string, options: QueryOptions): Promise<Table> {\n const statement = parseSQLSelectStatement(sql);\n const [key] = statement.groupBy ?? [];\n if (\n statement.groupBy?.length !== 1 ||\n key?.type !== 'Identifier' ||\n statement.joins.length ||\n statement.from.alias ||\n statement.orderBy?.length ||\n statement.limit !== undefined ||\n statement.offset !== undefined\n )\n throw new Error('Expected a single-source, single-key GROUP BY query');\n\n const [group, ...items] = statement.select ?? [];\n if (group?.expression.type !== 'Identifier' || group.expression.name !== key.name || group.alias)\n throw new Error('Select the grouping column first, followed by named aggregates');\n\n const aggregates = items.map(({expression, alias}): ProgressiveAggregate => {\n if (\n expression.type !== 'CallExpression' ||\n expression.callee.type !== 'Identifier' ||\n typeof expression.callee.name !== 'string' ||\n expression.arguments.length !== 1 ||\n !alias\n )\n throw new Error('Expected an aggregate with one column and an output alias');\n const operation = expression.callee.name.toLowerCase();\n if (\n operation !== 'count' &&\n operation !== 'sum' &&\n operation !== 'avg' &&\n operation !== 'min' &&\n operation !== 'max'\n )\n throw new Error('Unsupported grouped aggregate: ' + operation);\n const argument = expression.arguments[0];\n if (argument.type !== 'Identifier' || typeof argument.name !== 'string')\n throw new Error('Expected an aggregate column');\n const wildcard = 'sqlWildcard' in argument && argument.sqlWildcard === true;\n return {function: operation, column: wildcard ? undefined : argument.name, as: alias};\n });\n const grouped: ProgressiveAggregateQuery = {\n from:\n options.source !== undefined && statement.from.name === 'data'\n ? undefined\n : statement.from.name,\n groupBy: key.name,\n aggregates,\n where: statement.where && {expression: statement.where}\n };\n for await (const snapshot of queryProgressive(grouped, {\n ...options,\n emitEveryBatches: Number.MAX_SAFE_INTEGER\n })) {\n if (snapshot.final) return snapshot.table;\n }\n throw new Error('Grouped scan ended without a final snapshot');\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oBAAsC;AAEtC,mBAAkD;AAIlD,eAAsB,gBAAgB,KAAa,SAAuC;AACxF,QAAM,gBAAY,uCAAwB,GAAG;AAC7C,QAAM,CAAC,GAAG,IAAI,UAAU,WAAW,CAAC;AACpC,MACE,UAAU,SAAS,WAAW,KAC9B,KAAK,SAAS,gBACd,UAAU,MAAM,UAChB,UAAU,KAAK,SACf,UAAU,SAAS,UACnB,UAAU,UAAU,UACpB,UAAU,WAAW;AAErB,UAAM,IAAI,MAAM,qDAAqD;AAEvE,QAAM,CAAC,OAAO,GAAG,KAAK,IAAI,UAAU,UAAU,CAAC;AAC/C,MAAI,OAAO,WAAW,SAAS,gBAAgB,MAAM,WAAW,SAAS,IAAI,QAAQ,MAAM;AACzF,UAAM,IAAI,MAAM,gEAAgE;AAElF,QAAM,aAAa,MAAM,IAAI,CAAC,EAAC,YAAY,MAAK,MAA4B;AAC1E,QACE,WAAW,SAAS,oBACpB,WAAW,OAAO,SAAS,gBAC3B,OAAO,WAAW,OAAO,SAAS,YAClC,WAAW,UAAU,WAAW,KAChC,CAAC;AAED,YAAM,IAAI,MAAM,2DAA2D;AAC7E,UAAM,YAAY,WAAW,OAAO,KAAK,YAAY;AACrD,QACE,cAAc,WACd,cAAc,SACd,cAAc,SACd,cAAc,SACd,cAAc;AAEd,YAAM,IAAI,MAAM,oCAAoC,SAAS;AAC/D,UAAM,WAAW,WAAW,UAAU,CAAC;AACvC,QAAI,SAAS,SAAS,gBAAgB,OAAO,SAAS,SAAS;AAC7D,YAAM,IAAI,MAAM,8BAA8B;AAChD,UAAM,WAAW,iBAAiB,YAAY,SAAS,gBAAgB;AACvE,WAAO,EAAC,UAAU,WAAW,QAAQ,WAAW,SAAY,SAAS,MAAM,IAAI,MAAK;AAAA,EACtF,CAAC;AACD,QAAM,UAAqC;AAAA,IACzC,MACE,QAAQ,WAAW,UAAa,UAAU,KAAK,SAAS,SACpD,SACA,UAAU,KAAK;AAAA,IACrB,SAAS,IAAI;AAAA,IACb;AAAA,IACA,OAAO,UAAU,SAAS,EAAC,YAAY,UAAU,MAAK;AAAA,EACxD;AACA,mBAAiB,gBAAY,+BAAiB,SAAS;AAAA,IACrD,GAAG;AAAA,IACH,kBAAkB,OAAO;AAAA,EAC3B,CAAC,GAAG;AACF,QAAI,SAAS,MAAO,QAAO,SAAS;AAAA,EACtC;AACA,QAAM,IAAI,MAAM,6CAA6C;AAC/D;",
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {parseSQLSelectStatement} from '@math.gl/sql/parser';\nimport type {Table} from 'apache-arrow';\nimport {queryProgressive, type QueryOptions} from './query';\nimport type {ProgressiveAggregate, ProgressiveAggregateQuery} from './query-progressive';\n\n/** Executes a single-key grouped SQL scan and returns its final replacement table. */\nexport async function queryGroupedSQL(sql: string, options: QueryOptions): Promise<Table> {\n const statement = parseSQLSelectStatement(sql);\n const [key] = statement.groupBy ?? [];\n if (\n statement.groupBy?.length !== 1 ||\n key?.type !== 'Identifier' ||\n statement.joins.length ||\n statement.from.alias ||\n statement.having ||\n statement.orderBy?.length ||\n statement.limit !== undefined ||\n statement.offset !== undefined\n )\n throw new Error('Expected a single-source, single-key GROUP BY query');\n\n const [group, ...items] = statement.select ?? [];\n if (group?.expression.type !== 'Identifier' || group.expression.name !== key.name || group.alias)\n throw new Error('Select the grouping column first, followed by named aggregates');\n\n const aggregates = items.map(({expression, alias}): ProgressiveAggregate => {\n if (\n expression.type !== 'CallExpression' ||\n expression.callee.type !== 'Identifier' ||\n typeof expression.callee.name !== 'string' ||\n expression.arguments.length !== 1 ||\n !alias\n )\n throw new Error('Expected an aggregate with one column and an output alias');\n const operation = expression.callee.name.toLowerCase();\n if (\n operation !== 'count' &&\n operation !== 'sum' &&\n operation !== 'avg' &&\n operation !== 'min' &&\n operation !== 'max'\n )\n throw new Error('Unsupported grouped aggregate: ' + operation);\n const argument = expression.arguments[0];\n if (argument.type !== 'Identifier' || typeof argument.name !== 'string')\n throw new Error('Expected an aggregate column');\n const wildcard = 'sqlWildcard' in argument && argument.sqlWildcard === true;\n return {function: operation, column: wildcard ? undefined : argument.name, as: alias};\n });\n const grouped: ProgressiveAggregateQuery = {\n from:\n options.source !== undefined && statement.from.name === 'data'\n ? undefined\n : statement.from.name,\n groupBy: key.name,\n aggregates,\n where: statement.where && {expression: statement.where}\n };\n for await (const snapshot of queryProgressive(grouped, {\n ...options,\n emitEveryBatches: Number.MAX_SAFE_INTEGER\n })) {\n if (snapshot.final) return snapshot.table;\n }\n throw new Error('Grouped scan ended without a final snapshot');\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oBAAsC;AAEtC,mBAAkD;AAIlD,eAAsB,gBAAgB,KAAa,SAAuC;AACxF,QAAM,gBAAY,uCAAwB,GAAG;AAC7C,QAAM,CAAC,GAAG,IAAI,UAAU,WAAW,CAAC;AACpC,MACE,UAAU,SAAS,W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GAAG;AACF,QAAI,SAAS,MAAO,QAAO,SAAS;AAAA,EACtC;AACA,QAAM,IAAI,MAAM,6CAA6C;AAC/D;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"query-grouped-sql.d.ts","sourceRoot":"","sources":["../../src/scan/query-grouped-sql.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAmB,KAAK,YAAY,EAAC,mBAAgB;AAG5D,sFAAsF;AACtF,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CA0DxF"}
1
+ {"version":3,"file":"query-grouped-sql.d.ts","sourceRoot":"","sources":["../../src/scan/query-grouped-sql.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAmB,KAAK,YAAY,EAAC,mBAAgB;AAG5D,sFAAsF;AACtF,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CA2DxF"}
@@ -11,6 +11,7 @@ export async function queryGroupedSQL(sql, options) {
11
11
  key?.type !== 'Identifier' ||
12
12
  statement.joins.length ||
13
13
  statement.from.alias ||
14
+ statement.having ||
14
15
  statement.orderBy?.length ||
15
16
  statement.limit !== undefined ||
16
17
  statement.offset !== undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"query-grouped-sql.js","sourceRoot":"","sources":["../../src/scan/query-grouped-sql.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,uBAAuB,EAAC,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAC,gBAAgB,EAAoB,mBAAgB;AAG5D,sFAAsF;AACtF,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAW,E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AAK,IAAI,EAAC,UAAU,EAAE,SAAS,CAAC,KAAK,EAAC;KACxD,CAAC;IACF,IAAI,KAAK,EAAE,MAAM,QAAQ,IAAI,gBAAgB,CAAC,OAAO,EAAE;QACrD,GAAG,OAAO;QACV,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;KAC1C,CAAC,EAAE,CAAC;QACH,IAAI,QAAQ,CAAC,KAAK;YAAE,OAAO,QAAQ,CAAC,KAAK,CAAC;IAC5C,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;AACjE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/scan/vector-table-scan-source.ts", "../../src/lib/loader-utils/native-arrow.ts"],
4
- "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {RecordBatch, Table} from 'apache-arrow';\nimport {makeArrowMetadataBatch} from '@loaders.gl/core/schema-utils';\nimport {isArrowTable} from '../lib/loader-utils/native-arrow';\nimport {convertArrowToSchema} from '@loaders.gl/core/schema-utils';\nimport type {\n GetFeaturesParameters,\n GetTileParameters,\n ScanQueryMetadata,\n ScanQueryMetadataOptions,\n ScanSpatialMetadata,\n TableQueryExplain,\n VectorSource,\n VectorTileSource\n} from '@loaders.gl/core/loader-utils';\nimport {createScanQueryMetadata} from '@loaders.gl/core/loader-utils';\nimport {ARROW_TABLE_QUERY_CAPABILITIES} from './table-query-capabilities';\nimport {explainArrowTableQuery, type ArrowQueryOptions} from './plan-arrow-table-query';\nimport {type SQLPredicate} from './sql-predicate-types';\n\n/** Shared display and provenance options for an addressed vector-table scan. */\nexport type VectorTableScanSourceOptions = Readonly<{\n /** Stable source type reported through query metadata. */\n sourceType?: string;\n /** Optional display name shown by metadata-driven query controls. */\n name?: string;\n /** Optional description of the addressed table view. */\n description?: string;\n}>;\n\n/** Options that bind one vector tile before portable table-query planning begins. */\nexport type VectorTileTableScanSourceOptions = VectorTableScanSourceOptions &\n Readonly<{\n /** Tile address and source-specific layer selection, deliberately outside `TableQuery`. */\n tile: Omit<GetTileParameters, 'signal'>;\n }>;\n\n/** Options that bind one bounded vector-service request before table-query planning begins. */\nexport type VectorFeatureTableScanSourceOptions = VectorTableScanSourceOptions &\n Readonly<{\n /** Layers, bounds, and output CRS, deliberately outside `TableQuery`. */\n request: Omit<GetFeaturesParameters, 'format' | 'signal'>;\n }>;\n\n/**\n * Base source for a physical vector selection that resolves to one Arrow feature table.\n *\n * The physical address is immutable and owned by a specialized adapter. Portable predicates,\n * projection, ordering, aggregates, and limits are applied only after that selection resolves.\n */\nexport abstract class AddressedVectorTableScanSource {\n /** Stable adapter type reported by `getQueryMetadata()`. */\n readonly sourceType: string;\n /** Optional display name shown by query controls. */\n readonly name?: string;\n /** Human-readable description of the bound physical selection. */\n readonly description: string;\n /** Spatial extent of the bound physical selection. */\n readonly spatial?: ScanSpatialMetadata;\n\n private tablePromise: Promise<Table> | null = null;\n\n /** Creates a table-scan view over one immutable physical selection. */\n protected constructor(\n options: VectorTableScanSourceOptions,\n defaults: Readonly<{\n sourceType: string;\n description: string;\n spatial?: ScanSpatialMetadata;\n }>\n ) {\n this.sourceType = options.sourceType || defaults.sourceType;\n this.name = options.name;\n this.description = options.description || defaults.description;\n this.spatial = defaults.spatial;\n }\n\n /** Loads the physically addressed data as one Arrow table. */\n protected abstract loadTable(signal?: AbortSignal): Promise<Table | null>;\n\n /** Discovers the addressed result schema and portable residual-query capabilities. */\n async getQueryMetadata(options: ScanQueryMetadataOptions = {}): Promise<ScanQueryMetadata> {\n const table = await this.getTable(options.signal);\n const schema = convertArrowToSchema(table.schema);\n return createScanQueryMetadata({\n sourceType: this.sourceType,\n queryType: 'table',\n execution: {status: 'supported', method: 'read'},\n name: this.name,\n description: this.description,\n schema,\n capabilities: {\n table: ARROW_TABLE_QUERY_CAPABILITIES,\n bounds: 'unsupported',\n levelOfDetail: 'unsupported'\n },\n columnRoles: inferVectorColumnRoles(schema.fields.map(field => field.name)),\n spatial: this.spatial,\n statistics: {rowCount: table.numRows}\n });\n }\n\n /** Applies the portable Arrow query to the addressed feature table. */\n async query(options: ArrowQueryOptions = {}): Promise<Table> {\n const table = await this.getTable(options.signal);\n const {queryArrowTable} = await import('./query-arrow-table');\n return queryArrowTable(table, options);\n }\n\n /** Explains the residual Arrow plan after resolving the addressed feature table. */\n async explain(options: ArrowQueryOptions = {}): Promise<TableQueryExplain<SQLPredicate>> {\n const table = await this.getTable(options.signal);\n return explainArrowTableQuery(table, options);\n }\n\n /** Emits the portable query result as one bounded Arrow batch. */\n async *read(options: ArrowQueryOptions = {}): AsyncIterableIterator<RecordBatch> {\n const data = await this.query(options);\n if (data.batches.length) yield* data.batches;\n else yield makeArrowMetadataBatch(data.schema);\n }\n\n /** Scans the addressed query result through the same batch contract as `read()`. */\n scan(options: ArrowQueryOptions = {}): AsyncIterableIterator<RecordBatch> {\n return this.read(options);\n }\n\n /** Resolves and caches the addressed table while allowing failed loads to be retried. */\n private async getTable(signal?: AbortSignal): Promise<Table> {\n throwIfAborted(signal);\n if (!this.tablePromise) {\n this.tablePromise = this.loadTable()\n .then(table => {\n if (!table) {\n throw new Error('The addressed vector selection did not return a feature table.');\n }\n return table;\n })\n .catch(error => {\n this.tablePromise = null;\n throw error;\n });\n }\n return await waitForPromise(this.tablePromise, signal);\n }\n}\n\n/**\n * Portable table-query view over one explicitly addressed vector tile.\n *\n * MVT and vector PMTiles sources participate when configured to return `shape: 'arrow'`.\n * Tile coordinates and layer selection remain source parameters rather than relational operators.\n */\nexport class VectorTileTableScanSource extends AddressedVectorTableScanSource {\n /** Specialized tile source that owns tile addressing and decoding. */\n readonly source: VectorTileSource;\n /** Immutable tile address bound to this table view. */\n readonly tile: Omit<GetTileParameters, 'signal'>;\n\n /** Creates a portable table view over one vector tile. */\n constructor(source: VectorTileSource, options: VectorTileTableScanSourceOptions) {\n const tile = Object.freeze({\n ...options.tile,\n layers: cloneAndFreezeLayers(options.tile.layers)\n });\n super(options, {\n sourceType: 'vector-tile-table',\n description: `Vector tile ${tile.z}/${tile.x}/${tile.y}`,\n spatial: {\n bounds: getWGS84TileBounds(tile),\n coordinateReferenceSystems: ['EPSG:4326']\n }\n });\n this.source = source;\n this.tile = tile;\n }\n\n /** Loads the bound vector tile using the source's requested Arrow output shape. */\n protected async loadTable(signal?: AbortSignal): Promise<Table | null> {\n const tile = await this.source.getVectorTile({...this.tile, signal});\n if (tile === null || isArrowTable(tile)) return tile;\n throw new Error(\n 'The addressed vector selection must return an Arrow table. Configure the source with shape \"arrow\".'\n );\n }\n}\n\n/**\n * Portable table-query view over one explicitly bounded vector-service request.\n *\n * WFS and ArcGIS feature sources participate through their existing Arrow feature output. Layers,\n * service bounds, and output CRS remain source parameters rather than relational operators.\n */\nexport class VectorFeatureTableScanSource extends AddressedVectorTableScanSource {\n /** Specialized vector source that owns service request construction and parsing. */\n readonly source: VectorSource;\n /** Immutable bounded feature request bound to this table view. */\n readonly request: Omit<GetFeaturesParameters, 'format' | 'signal'>;\n\n /** Creates a portable table view over one bounded vector-service request. */\n constructor(source: VectorSource, options: VectorFeatureTableScanSourceOptions) {\n const request = Object.freeze({\n ...options.request,\n layers: cloneAndFreezeLayers(options.request.layers),\n boundingBox: Object.freeze([\n Object.freeze([...options.request.boundingBox[0]]),\n Object.freeze([...options.request.boundingBox[1]])\n ]) as GetFeaturesParameters['boundingBox']\n });\n const boundsCrs = request.requestCrs || request.crs;\n const coordinateReferenceSystems = typeof boundsCrs === 'string' ? [boundsCrs] : undefined;\n super(options, {\n sourceType: 'vector-feature-table',\n description: `Vector feature request for ${normalizeLayers(request.layers).join(', ')}`,\n spatial: {\n bounds: {\n minimum: Object.freeze([...request.boundingBox[0]]),\n maximum: Object.freeze([...request.boundingBox[1]])\n },\n coordinateReferenceSystems\n }\n });\n this.source = source;\n this.request = request;\n }\n\n /** Loads the bound service request through the source's Arrow feature output. */\n protected async loadTable(signal?: AbortSignal): Promise<Table | null> {\n const data = await this.source.getFeatures({...this.request, format: 'arrow', signal});\n return isArrowTable(data) ? data : null;\n }\n}\n\n/** Returns the WGS84 extent of one XYZ tile address. */\nfunction getWGS84TileBounds(tile: Pick<GetTileParameters, 'x' | 'y' | 'z'>) {\n const scale = 2 ** tile.z;\n return {\n minimum: [(tile.x / scale) * 360 - 180, tileYToLatitude(tile.y + 1, scale)],\n maximum: [((tile.x + 1) / scale) * 360 - 180, tileYToLatitude(tile.y, scale)]\n };\n}\n\n/** Converts one XYZ tile row to its WGS84 latitude edge. */\nfunction tileYToLatitude(tileY: number, scale: number): number {\n return (Math.atan(Math.sinh(Math.PI * (1 - (2 * tileY) / scale))) * 180) / Math.PI;\n}\n\n/** Infers the small semantic-role set useful for vector feature query controls. */\nfunction inferVectorColumnRoles(columnNames: readonly string[]) {\n return Object.fromEntries(\n columnNames.map(columnName => [\n columnName,\n columnName.toLowerCase() === 'geometry' ? 'geometry' : 'attribute'\n ])\n ) as Readonly<Record<string, 'geometry' | 'attribute'>>;\n}\n\n/** Normalizes a single layer name to the service API's list shape. */\nfunction normalizeLayers(layers: string | string[]): string[] {\n return Array.isArray(layers) ? layers : [layers];\n}\n\n/** Clones and freezes a possibly plural layer selection for an immutable physical address. */\nfunction cloneAndFreezeLayers<LayersT extends string | string[] | undefined>(\n layers: LayersT\n): LayersT {\n return (Array.isArray(layers) ? Object.freeze([...layers]) : layers) as LayersT;\n}\n\n/** Waits for a shared cached load while preserving one caller's independent cancellation. */\nasync function waitForPromise<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T> {\n if (!signal) {\n return await promise;\n }\n throwIfAborted(signal);\n return await new Promise<T>((resolve, reject) => {\n const abort = () => reject(getAbortReason(signal));\n signal.addEventListener('abort', abort, {once: true});\n void promise.then(resolve, reject).finally(() => signal.removeEventListener('abort', abort));\n });\n}\n\n/** Throws before physical or residual work begins when cancellation was requested. */\nfunction throwIfAborted(signal?: AbortSignal): void {\n if (signal?.aborted) {\n throw getAbortReason(signal);\n }\n}\n\n/** Returns the caller's cancellation reason or a portable AbortError fallback. */\nfunction getAbortReason(signal: AbortSignal): unknown {\n return signal.reason || new DOMException('Request aborted', 'AbortError');\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type * as arrow from 'apache-arrow';\nimport type {Loader, StrictLoaderOptions} from '@loaders.gl/core/loader-utils';\n\n/** Finds the option namespace used by a loader for shape selection. */\nexport function getShapeOptionKey(loader: Loader): string | undefined {\n const keys = Object.keys(loader.options || {}).filter(key => {\n const value = loader.options?.[key];\n return key !== 'core' && value && typeof value === 'object' && 'shape' in value;\n });\n return keys.includes(loader.id) ? loader.id : keys.length === 1 ? keys[0] : undefined;\n}\n\n/** Checks for an Arrow stream and validates its metadata options. */\nexport function usesNativeArrowBatches(loader: Loader, options: StrictLoaderOptions): boolean {\n const key = getShapeOptionKey(loader);\n const scopedOptions = key && options[key];\n if (\n !scopedOptions ||\n typeof scopedOptions !== 'object' ||\n !('shape' in scopedOptions) ||\n scopedOptions.shape !== 'arrow'\n ) {\n return false;\n }\n if (options.core?.metadata) {\n throw new Error(\n 'shape: \"arrow\" carries metadata in the Arrow schema and does not support core.metadata envelopes'\n );\n }\n return true;\n}\n\n/** Yields every record batch, preserving order and iterator cancellation. */\nexport async function* normalizeNativeArrowBatches(\n batches: AsyncIterable<unknown> | Iterable<unknown>\n): AsyncIterable<arrow.RecordBatch> {\n for await (const batch of batches) {\n const batchType = (batch as {batchType?: string} | null)?.batchType;\n // JSON parsers can emit document metadata and partial/final document envelopes.\n if (\n batchType === 'metadata' ||\n batchType === 'partial-result' ||\n batchType === 'final-result'\n ) {\n continue;\n }\n if (isArrowRecordBatch(batch)) {\n yield batch;\n } else if (isArrowTable(batch)) {\n yield* batch.batches;\n } else {\n throw new Error('shape: \"arrow\" requires a native Arrow table or record batch');\n }\n }\n}\n\n/** Identifies native Arrow tables without loading Arrow in the core entry point. */\nexport function isArrowTable(value: unknown): value is arrow.Table {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'schema' in value &&\n 'batches' in value &&\n Array.isArray(value.batches) &&\n 'numRows' in value &&\n typeof value.numRows === 'number' &&\n 'getChildAt' in value &&\n typeof value.getChildAt === 'function'\n );\n}\n\n/** Identifies native record batches across Arrow package instances. */\nexport function isArrowRecordBatch(value: unknown): value is arrow.RecordBatch {\n return Boolean(\n value &&\n typeof value === 'object' &&\n (value as Record<symbol, unknown>)[Symbol.for('apache-arrow/RecordBatch')] === true\n );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,0BAAqC;;;ACwD9B,SAAS,aAAa,OAAsC;AACjE,SAAO;AAAA,IACL,SACE,OAAO,UAAU,YACjB,YAAY,SACZ,aAAa,SACb,MAAM,QAAQ,MAAM,OAAO,KAC3B,aAAa,SACb,OAAO,MAAM,YAAY,YACzB,gBAAgB,SAChB,OAAO,MAAM,eAAe;AAAA,EAChC;AACF;;;ADlEA,IAAAA,uBAAmC;AAWnC,0BAAsC;AACtC,sCAA6C;AAC7C,oCAA6D;AAiCtD,IAAe,iCAAf,MAA8C;AAAA;AAAA,EAE1C;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EAED,eAAsC;AAAA;AAAA,EAGpC,YACR,SACA,UAKA;AACA,SAAK,aAAa,QAAQ,cAAc,SAAS;AACjD,SAAK,OAAO,QAAQ;AACpB,SAAK,cAAc,QAAQ,eAAe,SAAS;AACnD,SAAK,UAAU,SAAS;AAAA,EAC1B;AAAA;AAAA,EAMA,MAAM,iBAAiB,UAAoC,CAAC,GAA+B;AACzF,UAAM,QAAQ,MAAM,KAAK,SAAS,QAAQ,MAAM;AAChD,UAAM,aAAS,2CAAqB,MAAM,MAAM;AAChD,eAAO,6CAAwB;AAAA,MAC7B,YAAY,KAAK;AAAA,MACjB,WAAW;AAAA,MACX,WAAW,EAAC,QAAQ,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ACF;AAGA,SAAS,gBAAgB,QAAqC;AAC5D,SAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AACjD;AAGA,SAAS,qBACP,QACS;AACT,SAAQ,MAAM,QAAQ,MAAM,IAAI,OAAO,OAAO,CAAC,GAAG,MAAM,CAAC,IAAI;AAC/D;AAGA,eAAe,eAAkB,SAAqB,QAAkC;AACtF,MAAI,CAAC,QAAQ;AACX,WAAO,MAAM;AAAA,EACf;AACA,iBAAe,MAAM;AACrB,SAAO,MAAM,IAAI,QAAW,CAAC,SAAS,WAAW;AAC/C,UAAM,QAAQ,MAAM,OAAO,eAAe,MAAM,CAAC;AACjD,WAAO,iBAAiB,SAAS,OAAO,EAAC,MAAM,KAAI,CAAC;AACpD,SAAK,QAAQ,KAAK,SAAS,MAAM,EAAE,QAAQ,MAAM,OAAO,oBAAoB,SAAS,KAAK,CAAC;AAAA,EAC7F,CAAC;AACH;AAGA,SAAS,eAAe,QAA4B;AAClD,MAAI,QAAQ,SAAS;AACnB,UAAM,eAAe,MAAM;AAAA,EAC7B;AACF;AAGA,SAAS,eAAe,QAA8B;AACpD,SAAO,OAAO,UAAU,IAAI,aAAa,mBAAmB,YAAY;AAC1E;",
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {RecordBatch, Table} from 'apache-arrow';\nimport {makeArrowMetadataBatch} from '@loaders.gl/core/schema-utils';\nimport {isArrowTable} from '../lib/loader-utils/native-arrow';\nimport {convertArrowToSchema} from '@loaders.gl/core/schema-utils';\nimport type {\n GetFeaturesParameters,\n GetTileParameters,\n ScanQueryMetadata,\n ScanQueryMetadataOptions,\n ScanSpatialMetadata,\n TableQueryExplain,\n VectorSource,\n VectorTileSource\n} from '@loaders.gl/core/loader-utils';\nimport {createScanQueryMetadata} from '@loaders.gl/core/loader-utils';\nimport {ARROW_TABLE_QUERY_CAPABILITIES} from './table-query-capabilities';\nimport {explainArrowTableQuery, type ArrowQueryOptions} from './plan-arrow-table-query';\nimport {type SQLPredicate} from './sql-predicate-types';\n\n/** Shared display and provenance options for an addressed vector-table scan. */\nexport type VectorTableScanSourceOptions = Readonly<{\n /** Stable source type reported through query metadata. */\n sourceType?: string;\n /** Optional display name shown by metadata-driven query controls. */\n name?: string;\n /** Optional description of the addressed table view. */\n description?: string;\n}>;\n\n/** Options that bind one vector tile before portable table-query planning begins. */\nexport type VectorTileTableScanSourceOptions = VectorTableScanSourceOptions &\n Readonly<{\n /** Tile address and source-specific layer selection, deliberately outside `TableQuery`. */\n tile: Omit<GetTileParameters, 'signal'>;\n }>;\n\n/** Options that bind one bounded vector-service request before table-query planning begins. */\nexport type VectorFeatureTableScanSourceOptions = VectorTableScanSourceOptions &\n Readonly<{\n /** Layers, bounds, and output CRS, deliberately outside `TableQuery`. */\n request: Omit<GetFeaturesParameters, 'format' | 'signal'>;\n }>;\n\n/**\n * Base source for a physical vector selection that resolves to one Arrow feature table.\n *\n * The physical address is immutable and owned by a specialized adapter. Portable predicates,\n * projection, ordering, aggregates, and limits are applied only after that selection resolves.\n */\nexport abstract class AddressedVectorTableScanSource {\n /** Stable adapter type reported by `getQueryMetadata()`. */\n readonly sourceType: string;\n /** Optional display name shown by query controls. */\n readonly name?: string;\n /** Human-readable description of the bound physical selection. */\n readonly description: string;\n /** Spatial extent of the bound physical selection. */\n readonly spatial?: ScanSpatialMetadata;\n\n private tablePromise: Promise<Table> | null = null;\n\n /** Creates a table-scan view over one immutable physical selection. */\n protected constructor(\n options: VectorTableScanSourceOptions,\n defaults: Readonly<{\n sourceType: string;\n description: string;\n spatial?: ScanSpatialMetadata;\n }>\n ) {\n this.sourceType = options.sourceType || defaults.sourceType;\n this.name = options.name;\n this.description = options.description || defaults.description;\n this.spatial = defaults.spatial;\n }\n\n /** Loads the physically addressed data as one Arrow table. */\n protected abstract loadTable(signal?: AbortSignal): Promise<Table | null>;\n\n /** Discovers the addressed result schema and portable residual-query capabilities. */\n async getQueryMetadata(options: ScanQueryMetadataOptions = {}): Promise<ScanQueryMetadata> {\n const table = await this.getTable(options.signal);\n const schema = convertArrowToSchema(table.schema);\n return createScanQueryMetadata({\n sourceType: this.sourceType,\n queryType: 'table',\n execution: {status: 'supported', method: 'read'},\n name: this.name,\n description: this.description,\n schema,\n capabilities: {\n table: ARROW_TABLE_QUERY_CAPABILITIES,\n bounds: 'unsupported',\n levelOfDetail: 'unsupported'\n },\n columnRoles: inferVectorColumnRoles(schema.fields.map(field => field.name)),\n spatial: this.spatial,\n statistics: {rowCount: table.numRows}\n });\n }\n\n /** Applies the portable Arrow query to the addressed feature table. */\n async query(options: ArrowQueryOptions = {}): Promise<Table> {\n const table = await this.getTable(options.signal);\n const {queryArrowTable} = await import('./query-arrow-table');\n return queryArrowTable(table, options);\n }\n\n /** Explains the residual Arrow plan after resolving the addressed feature table. */\n async explain(options: ArrowQueryOptions = {}): Promise<TableQueryExplain<SQLPredicate>> {\n const table = await this.getTable(options.signal);\n return explainArrowTableQuery(table, options);\n }\n\n /** Emits the portable query result as one bounded Arrow batch. */\n async *read(options: ArrowQueryOptions = {}): AsyncIterableIterator<RecordBatch> {\n const data = await this.query(options);\n if (data.batches.length) yield* data.batches;\n else yield makeArrowMetadataBatch(data.schema);\n }\n\n /** Scans the addressed query result through the same batch contract as `read()`. */\n scan(options: ArrowQueryOptions = {}): AsyncIterableIterator<RecordBatch> {\n return this.read(options);\n }\n\n /** Resolves and caches the addressed table while allowing failed loads to be retried. */\n private async getTable(signal?: AbortSignal): Promise<Table> {\n throwIfAborted(signal);\n if (!this.tablePromise) {\n this.tablePromise = this.loadTable()\n .then(table => {\n if (!table) {\n throw new Error('The addressed vector selection did not return a feature table.');\n }\n return table;\n })\n .catch(error => {\n this.tablePromise = null;\n throw error;\n });\n }\n return await waitForPromise(this.tablePromise, signal);\n }\n}\n\n/**\n * Portable table-query view over one explicitly addressed vector tile.\n *\n * MVT and vector PMTiles sources participate when configured to return `shape: 'arrow'`.\n * Tile coordinates and layer selection remain source parameters rather than relational operators.\n */\nexport class VectorTileTableScanSource extends AddressedVectorTableScanSource {\n /** Specialized tile source that owns tile addressing and decoding. */\n readonly source: VectorTileSource;\n /** Immutable tile address bound to this table view. */\n readonly tile: Omit<GetTileParameters, 'signal'>;\n\n /** Creates a portable table view over one vector tile. */\n constructor(source: VectorTileSource, options: VectorTileTableScanSourceOptions) {\n const tile = Object.freeze({\n ...options.tile,\n layers: cloneAndFreezeLayers(options.tile.layers)\n });\n super(options, {\n sourceType: 'vector-tile-table',\n description: `Vector tile ${tile.z}/${tile.x}/${tile.y}`,\n spatial: {\n bounds: getWGS84TileBounds(tile),\n coordinateReferenceSystems: ['EPSG:4326']\n }\n });\n this.source = source;\n this.tile = tile;\n }\n\n /** Loads the bound vector tile using the source's requested Arrow output shape. */\n protected async loadTable(signal?: AbortSignal): Promise<Table | null> {\n const tile = await this.source.getVectorTile({...this.tile, signal});\n if (tile === null || isArrowTable(tile)) return tile;\n throw new Error(\n 'The addressed vector selection must return an Arrow table. Configure the source with shape \"arrow\".'\n );\n }\n}\n\n/**\n * Portable table-query view over one explicitly bounded vector-service request.\n *\n * WFS and ArcGIS feature sources participate through their existing Arrow feature output. Layers,\n * service bounds, and output CRS remain source parameters rather than relational operators.\n */\nexport class VectorFeatureTableScanSource extends AddressedVectorTableScanSource {\n /** Specialized vector source that owns service request construction and parsing. */\n readonly source: VectorSource;\n /** Immutable bounded feature request bound to this table view. */\n readonly request: Omit<GetFeaturesParameters, 'format' | 'signal'>;\n\n /** Creates a portable table view over one bounded vector-service request. */\n constructor(source: VectorSource, options: VectorFeatureTableScanSourceOptions) {\n const request = Object.freeze({\n ...options.request,\n layers: cloneAndFreezeLayers(options.request.layers),\n boundingBox: Object.freeze([\n Object.freeze([...options.request.boundingBox[0]]),\n Object.freeze([...options.request.boundingBox[1]])\n ]) as GetFeaturesParameters['boundingBox']\n });\n const boundsCrs = request.requestCrs || request.crs;\n const coordinateReferenceSystems = typeof boundsCrs === 'string' ? [boundsCrs] : undefined;\n super(options, {\n sourceType: 'vector-feature-table',\n description: `Vector feature request for ${normalizeLayers(request.layers).join(', ')}`,\n spatial: {\n bounds: {\n minimum: Object.freeze([...request.boundingBox[0]]),\n maximum: Object.freeze([...request.boundingBox[1]])\n },\n coordinateReferenceSystems\n }\n });\n this.source = source;\n this.request = request;\n }\n\n /** Loads the bound service request through the source's Arrow feature output. */\n protected async loadTable(signal?: AbortSignal): Promise<Table | null> {\n const data = await this.source.getFeatures({...this.request, format: 'arrow', signal});\n return isArrowTable(data) ? data : null;\n }\n}\n\n/** Returns the WGS84 extent of one XYZ tile address. */\nfunction getWGS84TileBounds(tile: Pick<GetTileParameters, 'x' | 'y' | 'z'>) {\n const scale = 2 ** tile.z;\n return {\n minimum: [(tile.x / scale) * 360 - 180, tileYToLatitude(tile.y + 1, scale)],\n maximum: [((tile.x + 1) / scale) * 360 - 180, tileYToLatitude(tile.y, scale)]\n };\n}\n\n/** Converts one XYZ tile row to its WGS84 latitude edge. */\nfunction tileYToLatitude(tileY: number, scale: number): number {\n return (Math.atan(Math.sinh(Math.PI * (1 - (2 * tileY) / scale))) * 180) / Math.PI;\n}\n\n/** Infers the small semantic-role set useful for vector feature query controls. */\nfunction inferVectorColumnRoles(columnNames: readonly string[]) {\n return Object.fromEntries(\n columnNames.map(columnName => [\n columnName,\n columnName.toLowerCase() === 'geometry' ? 'geometry' : 'attribute'\n ])\n ) as Readonly<Record<string, 'geometry' | 'attribute'>>;\n}\n\n/** Normalizes a single layer name to the service API's list shape. */\nfunction normalizeLayers(layers: string | string[]): string[] {\n return Array.isArray(layers) ? layers : [layers];\n}\n\n/** Clones and freezes a possibly plural layer selection for an immutable physical address. */\nfunction cloneAndFreezeLayers<LayersT extends string | string[] | undefined>(\n layers: LayersT\n): LayersT {\n return (Array.isArray(layers) ? Object.freeze([...layers]) : layers) as LayersT;\n}\n\n/** Waits for a shared cached load while preserving one caller's independent cancellation. */\nasync function waitForPromise<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T> {\n if (!signal) {\n return await promise;\n }\n throwIfAborted(signal);\n return await new Promise<T>((resolve, reject) => {\n const abort = () => reject(getAbortReason(signal));\n signal.addEventListener('abort', abort, {once: true});\n void promise.then(resolve, reject).finally(() => signal.removeEventListener('abort', abort));\n });\n}\n\n/** Throws before physical or residual work begins when cancellation was requested. */\nfunction throwIfAborted(signal?: AbortSignal): void {\n if (signal?.aborted) {\n throw getAbortReason(signal);\n }\n}\n\n/** Returns the caller's cancellation reason or a portable AbortError fallback. */\nfunction getAbortReason(signal: AbortSignal): unknown {\n return signal.reason || new DOMException('Request aborted', 'AbortError');\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type * as arrow from 'apache-arrow';\nimport type {Loader, StrictLoaderOptions} from '@loaders.gl/core/loader-utils';\n\nconst ARROW_RECORD_BATCH_BRAND = Symbol.for('apache-arrow/RecordBatch');\n\n/** Finds the option namespace used by a loader for shape selection. */\nexport function getShapeOptionKey(loader: Loader): string | undefined {\n const keys = Object.keys(loader.options || {}).filter(key => {\n const value = loader.options?.[key];\n return key !== 'core' && value && typeof value === 'object' && 'shape' in value;\n });\n return keys.includes(loader.id) ? loader.id : keys.length === 1 ? keys[0] : undefined;\n}\n\n/** Checks for an Arrow stream and validates its metadata options. */\nexport function usesNativeArrowBatches(loader: Loader, options: StrictLoaderOptions): boolean {\n const key = getShapeOptionKey(loader);\n const scopedOptions = key && options[key];\n if (\n !scopedOptions ||\n typeof scopedOptions !== 'object' ||\n !('shape' in scopedOptions) ||\n scopedOptions.shape !== 'arrow'\n ) {\n return false;\n }\n if (options.core?.metadata) {\n throw new Error(\n 'shape: \"arrow\" carries metadata in the Arrow schema and does not support core.metadata envelopes'\n );\n }\n return true;\n}\n\n/** Yields every record batch, preserving order and iterator cancellation. */\nexport async function* normalizeNativeArrowBatches(\n batches: AsyncIterable<unknown> | Iterable<unknown>\n): AsyncIterable<arrow.RecordBatch> {\n for await (const batch of batches) {\n const batchType = (batch as {batchType?: string} | null)?.batchType;\n // JSON parsers can emit document metadata and partial/final document envelopes.\n if (\n batchType === 'metadata' ||\n batchType === 'partial-result' ||\n batchType === 'final-result'\n ) {\n continue;\n }\n if (isArrowRecordBatch(batch)) {\n yield batch;\n } else if (isArrowTable(batch)) {\n yield* batch.batches;\n } else {\n throw new Error('shape: \"arrow\" requires a native Arrow table or record batch');\n }\n }\n}\n\n/** Identifies native Arrow tables without loading Arrow in the core entry point. */\nexport function isArrowTable(value: unknown): value is arrow.Table {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'schema' in value &&\n 'batches' in value &&\n Array.isArray(value.batches) &&\n 'numRows' in value &&\n typeof value.numRows === 'number' &&\n 'getChildAt' in value &&\n typeof value.getChildAt === 'function'\n );\n}\n\n/** Identifies native record batches across Arrow package instances. */\nexport function isArrowRecordBatch(value: unknown): value is arrow.RecordBatch {\n if (!value || typeof value !== 'object') {\n return false;\n }\n if ((value as Record<symbol, unknown>)[ARROW_RECORD_BATCH_BRAND] === true) {\n return true;\n }\n // Earlier Arrow releases do not brand their record batches with the shared symbol.\n const batch = value as Partial<arrow.RecordBatch>;\n return (\n typeof batch.numRows === 'number' &&\n Array.isArray(batch.schema?.fields) &&\n Array.isArray(batch.data?.children) &&\n typeof batch.get === 'function' &&\n typeof batch.getChild === 'function'\n );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,0BAAqC;;;AC0D9B,SAAS,aAAa,OAAsC;AACjE,SAAO;AAAA,IACL,SACE,OAAO,UAAU,YACjB,YAAY,SACZ,aAAa,SACb,MAAM,QAAQ,MAAM,OAAO,KAC3B,aAAa,SACb,OAAO,MAAM,YAAY,YACzB,gBAAgB,SAChB,OAAO,MAAM,eAAe;AAAA,EAChC;AACF;;;ADpEA,IAAAA,uBAAmC;AAWnC,0BAAsC;AACtC,sCAA6C;AAC7C,oCA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