@loaders.gl/core 5.0.0-beta.5 → 5.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/dist/cluster-source.cjs +45 -1
  2. package/dist/cluster-source.cjs.map +1 -1
  3. package/dist/dist.min.js +2 -2
  4. package/dist/federated-table-scan-source.cjs +272 -201
  5. package/dist/federated-table-scan-source.cjs.map +3 -3
  6. package/dist/index.cjs +1 -1
  7. package/dist/lib/init.js +1 -1
  8. package/dist/loader-utils/index.cjs +233 -12
  9. package/dist/loader-utils/index.cjs.map +2 -2
  10. package/dist/loader-utils/index.d.ts +8 -4
  11. package/dist/loader-utils/index.d.ts.map +1 -1
  12. package/dist/loader-utils/index.js +3 -1
  13. package/dist/loader-utils/index.js.map +1 -1
  14. package/dist/loader-utils/json-loader.js +1 -1
  15. package/dist/loader-utils/lib/files/http-file-transport.d.ts +4 -0
  16. package/dist/loader-utils/lib/files/http-file-transport.d.ts.map +1 -1
  17. package/dist/loader-utils/lib/files/http-file-transport.js +45 -1
  18. package/dist/loader-utils/lib/files/http-file-transport.js.map +1 -1
  19. package/dist/loader-utils/lib/files/http-file-types.d.ts +2 -0
  20. package/dist/loader-utils/lib/files/http-file-types.d.ts.map +1 -1
  21. package/dist/loader-utils/lib/files/read-range-response.d.ts +3 -0
  22. package/dist/loader-utils/lib/files/read-range-response.d.ts.map +1 -0
  23. package/dist/loader-utils/lib/files/read-range-response.js +62 -0
  24. package/dist/loader-utils/lib/files/read-range-response.js.map +1 -0
  25. package/dist/loader-utils/lib/log-utils/log.js +1 -1
  26. package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts +38 -0
  27. package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts.map +1 -0
  28. package/dist/loader-utils/lib/scan-utils/logical-table-query.js +96 -0
  29. package/dist/loader-utils/lib/scan-utils/logical-table-query.js.map +1 -0
  30. package/dist/loader-utils/lib/scan-utils/{experimental-scan-options.d.ts → query-options.d.ts} +5 -8
  31. package/dist/loader-utils/lib/scan-utils/query-options.d.ts.map +1 -0
  32. package/dist/loader-utils/lib/scan-utils/{experimental-scan-options.js → query-options.js} +1 -1
  33. package/dist/loader-utils/lib/scan-utils/query-options.js.map +1 -0
  34. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts +12 -17
  35. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts.map +1 -1
  36. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js +5 -5
  37. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js.map +1 -1
  38. package/dist/loader-utils/lib/scan-utils/table-query.d.ts +33 -3
  39. package/dist/loader-utils/lib/scan-utils/table-query.d.ts.map +1 -1
  40. package/dist/loader-utils/lib/scan-utils/table-query.js.map +1 -1
  41. package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts +2 -2
  42. package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts.map +1 -1
  43. package/dist/loader-utils/lib/scan-utils/table-scan-batch.js +11 -3
  44. package/dist/loader-utils/lib/scan-utils/table-scan-batch.js.map +1 -1
  45. package/dist/loader-utils/lib/sources/data-source.d.ts +4 -0
  46. package/dist/loader-utils/lib/sources/data-source.d.ts.map +1 -1
  47. package/dist/loader-utils/lib/sources/data-source.js +50 -1
  48. package/dist/loader-utils/lib/sources/data-source.js.map +1 -1
  49. package/dist/loader-utils/lib/sources/table-source-collection.d.ts +30 -0
  50. package/dist/loader-utils/lib/sources/table-source-collection.d.ts.map +1 -0
  51. package/dist/loader-utils/lib/sources/table-source-collection.js +5 -0
  52. package/dist/loader-utils/lib/sources/table-source-collection.js.map +1 -0
  53. package/dist/loader-utils/loader-types.d.ts +5 -5
  54. package/dist/loader-utils/loader-types.d.ts.map +1 -1
  55. package/dist/null-loader.js +1 -1
  56. package/dist/null-worker-node.js +1 -1
  57. package/dist/null-worker.js +1 -1
  58. package/dist/scan/arrow-execution/filter-arrow-table.cjs +254 -0
  59. package/dist/scan/arrow-execution/filter-arrow-table.cjs.map +7 -0
  60. package/dist/scan/arrow-execution/filter-arrow-table.d.ts +16 -0
  61. package/dist/scan/arrow-execution/filter-arrow-table.d.ts.map +1 -0
  62. package/dist/scan/arrow-execution/filter-arrow-table.js +222 -0
  63. package/dist/scan/arrow-execution/filter-arrow-table.js.map +1 -0
  64. package/dist/scan/arrow-execution/project-arrow-table.cjs +70 -0
  65. package/dist/scan/arrow-execution/project-arrow-table.cjs.map +7 -0
  66. package/dist/scan/arrow-execution/project-arrow-table.d.ts +8 -0
  67. package/dist/scan/arrow-execution/project-arrow-table.d.ts.map +1 -0
  68. package/dist/scan/arrow-execution/project-arrow-table.js +39 -0
  69. package/dist/scan/arrow-execution/project-arrow-table.js.map +1 -0
  70. package/dist/scan/arrow-execution.cjs +34 -0
  71. package/dist/scan/arrow-execution.cjs.map +7 -0
  72. package/dist/scan/arrow-execution.d.ts +4 -0
  73. package/dist/scan/arrow-execution.d.ts.map +1 -0
  74. package/dist/scan/arrow-execution.js +6 -0
  75. package/dist/scan/arrow-execution.js.map +1 -0
  76. package/dist/scan/arrow-query.cjs.map +1 -1
  77. package/dist/scan/arrow-query.d.ts +1 -1
  78. package/dist/scan/arrow-query.d.ts.map +1 -1
  79. package/dist/scan/catalog-query-source.cjs +122 -0
  80. package/dist/scan/catalog-query-source.cjs.map +7 -0
  81. package/dist/scan/catalog-query-source.d.ts +6 -0
  82. package/dist/scan/catalog-query-source.d.ts.map +1 -0
  83. package/dist/scan/catalog-query-source.js +115 -0
  84. package/dist/scan/catalog-query-source.js.map +1 -0
  85. package/dist/scan/federated-table-scan-source.cjs +4 -4
  86. package/dist/scan/federated-table-scan-source.cjs.map +2 -2
  87. package/dist/scan/federated-table-scan-source.d.ts +1 -1
  88. package/dist/scan/federated-table-scan-source.d.ts.map +1 -1
  89. package/dist/scan/federated-table-scan-source.js +4 -4
  90. package/dist/scan/federated-table-scan-source.js.map +1 -1
  91. package/dist/scan/index.cjs +188 -4
  92. package/dist/scan/index.cjs.map +4 -4
  93. package/dist/scan/index.d.ts +9 -2
  94. package/dist/scan/index.d.ts.map +1 -1
  95. package/dist/scan/index.js +4 -0
  96. package/dist/scan/index.js.map +1 -1
  97. package/dist/scan/parse-sql-predicate.cjs +3 -3
  98. package/dist/scan/parse-sql-predicate.cjs.map +2 -2
  99. package/dist/scan/parse-sql-predicate.d.ts +5 -2
  100. package/dist/scan/parse-sql-predicate.d.ts.map +1 -1
  101. package/dist/scan/parse-sql-predicate.js +3 -10
  102. package/dist/scan/parse-sql-predicate.js.map +1 -1
  103. package/dist/scan/parse-sql-query.cjs +70 -0
  104. package/dist/scan/parse-sql-query.cjs.map +7 -0
  105. package/dist/scan/parse-sql-query.d.ts +5 -0
  106. package/dist/scan/parse-sql-query.d.ts.map +1 -0
  107. package/dist/scan/parse-sql-query.js +49 -0
  108. package/dist/scan/parse-sql-query.js.map +1 -0
  109. package/dist/scan/parse-sql-select.cjs +215 -0
  110. package/dist/scan/parse-sql-select.cjs.map +7 -0
  111. package/dist/scan/parse-sql-select.d.ts +38 -0
  112. package/dist/scan/parse-sql-select.d.ts.map +1 -0
  113. package/dist/scan/parse-sql-select.js +208 -0
  114. package/dist/scan/parse-sql-select.js.map +1 -0
  115. package/dist/scan/query-arrow-table-in-batches.cjs +65 -0
  116. package/dist/scan/query-arrow-table-in-batches.cjs.map +7 -0
  117. package/dist/scan/query-arrow-table-in-batches.d.ts +8 -0
  118. package/dist/scan/query-arrow-table-in-batches.d.ts.map +1 -0
  119. package/dist/scan/query-arrow-table-in-batches.js +44 -0
  120. package/dist/scan/query-arrow-table-in-batches.js.map +1 -0
  121. package/dist/scan/query-arrow-table.cjs +52 -179
  122. package/dist/scan/query-arrow-table.cjs.map +3 -3
  123. package/dist/scan/query-arrow-table.d.ts +4 -37
  124. package/dist/scan/query-arrow-table.d.ts.map +1 -1
  125. package/dist/scan/query-arrow-table.js +37 -188
  126. package/dist/scan/query-arrow-table.js.map +1 -1
  127. package/dist/scan/query.cjs +257 -0
  128. package/dist/scan/query.cjs.map +7 -0
  129. package/dist/scan/query.d.ts +44 -0
  130. package/dist/scan/query.d.ts.map +1 -0
  131. package/dist/scan/query.js +246 -0
  132. package/dist/scan/query.js.map +1 -0
  133. package/dist/scan/resolve-query-source.cjs +59 -0
  134. package/dist/scan/resolve-query-source.cjs.map +7 -0
  135. package/dist/scan/resolve-query-source.d.ts +6 -0
  136. package/dist/scan/resolve-query-source.d.ts.map +1 -0
  137. package/dist/scan/resolve-query-source.js +37 -0
  138. package/dist/scan/resolve-query-source.js.map +1 -0
  139. package/dist/scan/sql-catalog.cjs +110 -0
  140. package/dist/scan/sql-catalog.cjs.map +7 -0
  141. package/dist/scan/sql-catalog.d.ts +47 -0
  142. package/dist/scan/sql-catalog.d.ts.map +1 -0
  143. package/dist/scan/sql-catalog.js +97 -0
  144. package/dist/scan/sql-catalog.js.map +1 -0
  145. package/dist/scan/table-query.cjs.map +2 -2
  146. package/dist/scan/table-query.d.ts +4 -1
  147. package/dist/scan/table-query.d.ts.map +1 -1
  148. package/dist/scan/table-query.js.map +1 -1
  149. package/dist/vector-table-scan-source.cjs +281 -193
  150. package/dist/vector-table-scan-source.cjs.map +3 -3
  151. package/dist/worker-utils/index.cjs +2 -1
  152. package/dist/worker-utils/index.cjs.map +1 -1
  153. package/dist/worker-utils/lib/env-utils/version.js +1 -1
  154. package/dist/worker-utils/lib/library-utils/library-utils.js +1 -1
  155. package/dist/worker-utils/lib/library-utils/library-utils.js.map +1 -1
  156. package/package.json +17 -7
  157. package/src/loader-utils/index.ts +30 -6
  158. package/src/loader-utils/lib/files/http-file-transport.ts +65 -1
  159. package/src/loader-utils/lib/files/http-file-types.ts +2 -0
  160. package/src/loader-utils/lib/files/read-range-response.ts +66 -0
  161. package/src/loader-utils/lib/scan-utils/logical-table-query.ts +164 -0
  162. package/src/loader-utils/lib/scan-utils/query-options.ts +44 -0
  163. package/src/loader-utils/lib/scan-utils/scan-query-metadata.ts +17 -26
  164. package/src/loader-utils/lib/scan-utils/table-query.ts +49 -8
  165. package/src/loader-utils/lib/scan-utils/table-scan-batch.ts +25 -9
  166. package/src/loader-utils/lib/sources/data-source.ts +54 -1
  167. package/src/loader-utils/lib/sources/table-source-collection.ts +38 -0
  168. package/src/loader-utils/loader-types.ts +5 -5
  169. package/src/scan/arrow-execution/filter-arrow-table.ts +293 -0
  170. package/src/scan/arrow-execution/project-arrow-table.ts +53 -0
  171. package/src/scan/arrow-execution.ts +7 -0
  172. package/src/scan/arrow-query.ts +3 -0
  173. package/src/scan/catalog-query-source.ts +132 -0
  174. package/src/scan/federated-table-scan-source.ts +19 -19
  175. package/src/scan/index.ts +28 -4
  176. package/src/scan/parse-sql-predicate.ts +9 -3
  177. package/src/scan/parse-sql-query.ts +53 -0
  178. package/src/scan/parse-sql-select.ts +220 -0
  179. package/src/scan/query-arrow-table-in-batches.ts +58 -0
  180. package/src/scan/query-arrow-table.ts +60 -237
  181. package/src/scan/query.ts +339 -0
  182. package/src/scan/resolve-query-source.ts +47 -0
  183. package/src/scan/sql-catalog.ts +167 -0
  184. package/src/scan/table-query.ts +6 -1
  185. package/src/worker-utils/lib/library-utils/library-utils.ts +1 -1
  186. package/dist/loader-utils/lib/scan-utils/experimental-scan-options.d.ts.map +0 -1
  187. package/dist/loader-utils/lib/scan-utils/experimental-scan-options.js.map +0 -1
  188. package/src/loader-utils/lib/scan-utils/experimental-scan-options.ts +0 -46
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/scan/arrow-execution/project-arrow-table.ts
31
+ var project_arrow_table_exports = {};
32
+ __export(project_arrow_table_exports, {
33
+ projectArrowTable: () => projectArrowTable
34
+ });
35
+ module.exports = __toCommonJS(project_arrow_table_exports);
36
+ var arrow = __toESM(require("apache-arrow"), 1);
37
+ function projectArrowTable(source, selections) {
38
+ const outputNames = /* @__PURE__ */ new Set();
39
+ const indices = [];
40
+ const fields = selections.map((selection) => {
41
+ const column = typeof selection === "string" ? selection : selection.column;
42
+ const name = typeof selection === "string" ? selection : selection.as === void 0 ? column : selection.as;
43
+ const index = source.schema.fields.findIndex((field) => field.name === column);
44
+ if (index < 0) throw new Error(`Arrow projection column not found: ${column}`);
45
+ if (typeof name !== "string" || typeof selection !== "string" && selection.as !== void 0 && !name.length || outputNames.has(name)) {
46
+ throw new Error(`Invalid or duplicate Arrow projection output name: ${name}`);
47
+ }
48
+ outputNames.add(name);
49
+ indices.push(index);
50
+ return source.schema.fields[index].clone({ name });
51
+ });
52
+ const schema = new arrow.Schema(fields, source.schema.metadata);
53
+ const batches = source.batches.map(
54
+ (batch) => new arrow.RecordBatch(
55
+ schema,
56
+ arrow.makeData({
57
+ type: new arrow.Struct(fields),
58
+ length: batch.numRows,
59
+ children: indices.map((index) => batch.data.children[index])
60
+ }),
61
+ batch.metadata
62
+ )
63
+ );
64
+ return new arrow.Table(schema, batches);
65
+ }
66
+ // Annotate the CommonJS export names for ESM import in node:
67
+ 0 && (module.exports = {
68
+ projectArrowTable
69
+ });
70
+ //# sourceMappingURL=project-arrow-table.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/scan/arrow-execution/project-arrow-table.ts"],
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport * as arrow from 'apache-arrow';\nimport type {TableSelection} from '@loaders.gl/core/loader-utils';\n\n/**\n * Projects and renames Arrow fields without copying column data buffers.\n * New schema and batch wrappers preserve source row order, batch boundaries, and metadata.\n */\nexport function projectArrowTable(\n source: arrow.Table,\n selections: readonly TableSelection[]\n): arrow.Table {\n const outputNames = new Set<string>();\n const indices: number[] = [];\n const fields = selections.map(selection => {\n const column = typeof selection === 'string' ? selection : selection.column;\n const name =\n typeof selection === 'string'\n ? selection\n : selection.as === undefined\n ? column\n : selection.as;\n const index = source.schema.fields.findIndex(field => field.name === column);\n if (index < 0) throw new Error(`Arrow projection column not found: ${column}`);\n if (\n typeof name !== 'string' ||\n (typeof selection !== 'string' && selection.as !== undefined && !name.length) ||\n outputNames.has(name)\n ) {\n throw new Error(`Invalid or duplicate Arrow projection output name: ${name}`);\n }\n outputNames.add(name);\n indices.push(index);\n return source.schema.fields[index].clone({name});\n });\n const schema = new arrow.Schema(fields, source.schema.metadata);\n const batches = source.batches.map(\n batch =>\n new arrow.RecordBatch(\n schema,\n arrow.makeData({\n type: new arrow.Struct(fields),\n length: batch.numRows,\n children: indices.map(index => batch.data.children[index])\n }),\n batch.metadata\n )\n );\n return new arrow.Table(schema, batches);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,YAAuB;AAOhB,SAAS,kBACd,QACA,YACa;AACb,QAAM,cAAc,oBAAI,IAAY;AACpC,QAAM,UAAoB,CAAC;AAC3B,QAAM,SAAS,WAAW,IAAI,eAAa;AACzC,UAAM,SAAS,OAAO,cAAc,WAAW,YAAY,UAAU;AACrE,UAAM,OACJ,OAAO,cAAc,WACjB,YACA,UAAU,OAAO,SACf,SACA,UAAU;AAClB,UAAM,QAAQ,OAAO,OAAO,OAAO,UAAU,WAAS,MAAM,SAAS,MAAM;AAC3E,QAAI,QAAQ,EAAG,OAAM,IAAI,MAAM,sCAAsC,MAAM,EAAE;AAC7E,QACE,OAAO,SAAS,YACf,OAAO,cAAc,YAAY,UAAU,OAAO,UAAa,CAAC,KAAK,UACtE,YAAY,IAAI,IAAI,GACpB;AACA,YAAM,IAAI,MAAM,sDAAsD,IAAI,EAAE;AAAA,IAC9E;AACA,gBAAY,IAAI,IAAI;AACpB,YAAQ,KAAK,KAAK;AAClB,WAAO,OAAO,OAAO,OAAO,KAAK,EAAE,MAAM,EAAC,KAAI,CAAC;AAAA,EACjD,CAAC;AACD,QAAM,SAAS,IAAU,aAAO,QAAQ,OAAO,OAAO,QAAQ;AAC9D,QAAM,UAAU,OAAO,QAAQ;AAAA,IAC7B,WACE,IAAU;AAAA,MACR;AAAA,MACM,eAAS;AAAA,QACb,MAAM,IAAU,aAAO,MAAM;AAAA,QAC7B,QAAQ,MAAM;AAAA,QACd,UAAU,QAAQ,IAAI,WAAS,MAAM,KAAK,SAAS,KAAK,CAAC;AAAA,MAC3D,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAAA,EACJ;AACA,SAAO,IAAU,YAAM,QAAQ,OAAO;AACxC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ import * as arrow from 'apache-arrow';
2
+ import type { TableSelection } from '@loaders.gl/core/loader-utils';
3
+ /**
4
+ * Projects and renames Arrow fields without copying column data buffers.
5
+ * New schema and batch wrappers preserve source row order, batch boundaries, and metadata.
6
+ */
7
+ export declare function projectArrowTable(source: arrow.Table, selections: readonly TableSelection[]): arrow.Table;
8
+ //# sourceMappingURL=project-arrow-table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-arrow-table.d.ts","sourceRoot":"","sources":["../../../src/scan/arrow-execution/project-arrow-table.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAElE;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,KAAK,CAAC,KAAK,EACnB,UAAU,EAAE,SAAS,cAAc,EAAE,GACpC,KAAK,CAAC,KAAK,CAsCb"}
@@ -0,0 +1,39 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ import * as arrow from 'apache-arrow';
5
+ /**
6
+ * Projects and renames Arrow fields without copying column data buffers.
7
+ * New schema and batch wrappers preserve source row order, batch boundaries, and metadata.
8
+ */
9
+ export function projectArrowTable(source, selections) {
10
+ const outputNames = new Set();
11
+ const indices = [];
12
+ const fields = selections.map(selection => {
13
+ const column = typeof selection === 'string' ? selection : selection.column;
14
+ const name = typeof selection === 'string'
15
+ ? selection
16
+ : selection.as === undefined
17
+ ? column
18
+ : selection.as;
19
+ const index = source.schema.fields.findIndex(field => field.name === column);
20
+ if (index < 0)
21
+ throw new Error(`Arrow projection column not found: ${column}`);
22
+ if (typeof name !== 'string' ||
23
+ (typeof selection !== 'string' && selection.as !== undefined && !name.length) ||
24
+ outputNames.has(name)) {
25
+ throw new Error(`Invalid or duplicate Arrow projection output name: ${name}`);
26
+ }
27
+ outputNames.add(name);
28
+ indices.push(index);
29
+ return source.schema.fields[index].clone({ name });
30
+ });
31
+ const schema = new arrow.Schema(fields, source.schema.metadata);
32
+ const batches = source.batches.map(batch => new arrow.RecordBatch(schema, arrow.makeData({
33
+ type: new arrow.Struct(fields),
34
+ length: batch.numRows,
35
+ children: indices.map(index => batch.data.children[index])
36
+ }), batch.metadata));
37
+ return new arrow.Table(schema, batches);
38
+ }
39
+ //# sourceMappingURL=project-arrow-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-arrow-table.js","sourceRoot":"","sources":["../../../src/scan/arrow-execution/project-arrow-table.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAmB,EACnB,UAAqC;IAErC,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IACtC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;QACxC,MAAM,MAAM,GAAG,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC;QAC5E,MAAM,IAAI,GACR,OAAO,SAAS,KAAK,QAAQ;YAC3B,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,SAAS,CAAC,EAAE,KAAK,SAAS;gBAC1B,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;QAC7E,IAAI,KAAK,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,MAAM,EAAE,CAAC,CAAC;QAC/E,IACE,OAAO,IAAI,KAAK,QAAQ;YACxB,CAAC,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,EAAE,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAC7E,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EACrB,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,sDAAsD,IAAI,EAAE,CAAC,CAAC;QAChF,CAAC;QACD,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAChC,KAAK,CAAC,EAAE,CACN,IAAI,KAAK,CAAC,WAAW,CACnB,MAAM,EACN,KAAK,CAAC,QAAQ,CAAC;QACb,IAAI,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;QAC9B,MAAM,EAAE,KAAK,CAAC,OAAO;QACrB,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;KAC3D,CAAC,EACF,KAAK,CAAC,QAAQ,CACf,CACJ,CAAC;IACF,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/scan/arrow-execution.ts
21
+ var arrow_execution_exports = {};
22
+ __export(arrow_execution_exports, {
23
+ filterArrowTable: () => import_filter_arrow_table.filterArrowTable,
24
+ projectArrowTable: () => import_project_arrow_table.projectArrowTable
25
+ });
26
+ module.exports = __toCommonJS(arrow_execution_exports);
27
+ var import_project_arrow_table = require("./arrow-execution/project-arrow-table.cjs");
28
+ var import_filter_arrow_table = require("./arrow-execution/filter-arrow-table.cjs");
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ filterArrowTable,
32
+ projectArrowTable
33
+ });
34
+ //# sourceMappingURL=arrow-execution.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/scan/arrow-execution.ts"],
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {projectArrowTable} from './arrow-execution/project-arrow-table';\nexport {filterArrowTable} from './arrow-execution/filter-arrow-table';\nexport type {ArrowFilterOptions} from './arrow-execution/filter-arrow-table';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,iCAAgC;AAChC,gCAA+B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,4 @@
1
+ export { projectArrowTable } from "./arrow-execution/project-arrow-table.js";
2
+ export { filterArrowTable } from "./arrow-execution/filter-arrow-table.js";
3
+ export type { ArrowFilterOptions } from "./arrow-execution/filter-arrow-table.js";
4
+ //# sourceMappingURL=arrow-execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrow-execution.d.ts","sourceRoot":"","sources":["../../src/scan/arrow-execution.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,iBAAiB,EAAC,iDAA8C;AACxE,OAAO,EAAC,gBAAgB,EAAC,gDAA6C;AACtE,YAAY,EAAC,kBAAkB,EAAC,gDAA6C"}
@@ -0,0 +1,6 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ export { projectArrowTable } from "./arrow-execution/project-arrow-table.js";
5
+ export { filterArrowTable } from "./arrow-execution/filter-arrow-table.js";
6
+ //# sourceMappingURL=arrow-execution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrow-execution.js","sourceRoot":"","sources":["../../src/scan/arrow-execution.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,iBAAiB,EAAC,iDAA8C;AACxE,OAAO,EAAC,gBAAgB,EAAC,gDAA6C"}
@@ -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, queryArrowTable} from './query-arrow-table';\nexport {getSQLPredicateColumnNames, planTableQuery} from './table-query';\n\nexport type {\n TableQueryFilterStep,\n TableQueryLimitStep,\n TableQueryOptions,\n TableQueryPlan,\n TableQueryPlanStep,\n TableQueryProjectStep,\n TableQueryScanStep\n} from './table-query';\nexport type {ArrowQueryOptions} from './query-arrow-table';\n"],
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {ARROW_TABLE_QUERY_CAPABILITIES, queryArrowTable} from './query-arrow-table';\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
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,+BAA8D;AAC9D,yBAAyD;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  export { ARROW_TABLE_QUERY_CAPABILITIES, queryArrowTable } from "./query-arrow-table.js";
2
2
  export { getSQLPredicateColumnNames, planTableQuery } from "./table-query.js";
3
- export type { TableQueryFilterStep, TableQueryLimitStep, TableQueryOptions, TableQueryPlan, TableQueryPlanStep, TableQueryProjectStep, TableQueryScanStep } from "./table-query.js";
3
+ export type { TableQueryFilterStep, TableQueryLimitStep, TableQuery, TableSelection, TableQueryExecutionOptions, TableQueryOptions, TableQueryPlan, TableQueryPlanStep, TableQueryProjectStep, TableQueryScanStep } from "./table-query.js";
4
4
  export type { ArrowQueryOptions } from "./query-arrow-table.js";
5
5
  //# sourceMappingURL=arrow-query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"arrow-query.d.ts","sourceRoot":"","sources":["../../src/scan/arrow-query.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,8BAA8B,EAAE,eAAe,EAAC,+BAA4B;AACpF,OAAO,EAAC,0BAA0B,EAAE,cAAc,EAAC,yBAAsB;AAEzE,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,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,eAAe,EAAC,+BAA4B;AACpF,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"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/scan/catalog-query-source.ts
21
+ var catalog_query_source_exports = {};
22
+ __export(catalog_query_source_exports, {
23
+ createCatalogQuerySource: () => createCatalogQuerySource
24
+ });
25
+ module.exports = __toCommonJS(catalog_query_source_exports);
26
+ var import_loader_utils = require("@loaders.gl/core/loader-utils");
27
+ var import_schema_utils = require("@loaders.gl/core/schema-utils");
28
+ var import_sql_catalog = require("./sql-catalog.cjs");
29
+ function createCatalogQuerySource(request, sources) {
30
+ const allowed = request.command === "showSources" ? ["command"] : ["command", "from"];
31
+ if (!["showSources", "showTables", "describe"].includes(request.command) || Object.keys(request).some((key) => !allowed.includes(key)))
32
+ throw new Error("Unsupported catalog query.");
33
+ if (request.command === "showTables" && request.from !== void 0 && (typeof request.from !== "string" || !request.from.trim()))
34
+ throw new Error("SHOW TABLES requires a non-empty source name.");
35
+ if (request.command === "describe" && request.from === void 0)
36
+ throw new Error("DESCRIBE requires a table reference.");
37
+ const catalog = (0, import_sql_catalog.createSQLCatalog)(sources);
38
+ const fields = request.command === "showSources" ? ["source_name"] : request.command === "showTables" ? ["source_name", "table_name", "table_reference", "queryable"] : [
39
+ "source_name",
40
+ "table_name",
41
+ "column_name",
42
+ "ordinal_position",
43
+ "data_type",
44
+ "is_nullable",
45
+ "metadata"
46
+ ];
47
+ const schema = {
48
+ fields: fields.map((name) => ({
49
+ name,
50
+ type: name === "ordinal_position" ? "int32" : name === "queryable" || name === "is_nullable" ? "bool" : "utf8",
51
+ nullable: false
52
+ })),
53
+ metadata: { catalog: request.command }
54
+ };
55
+ return {
56
+ async getQueryMetadata(options = {}) {
57
+ options.signal?.throwIfAborted();
58
+ return (0, import_loader_utils.createScanQueryMetadata)({
59
+ sourceType: "catalog",
60
+ queryType: "table",
61
+ schema,
62
+ execution: { status: "supported", method: "read" },
63
+ capabilities: {
64
+ table: {
65
+ projection: "unsupported",
66
+ predicate: "unsupported",
67
+ limit: "unsupported",
68
+ streaming: true,
69
+ cancellation: true
70
+ }
71
+ }
72
+ });
73
+ },
74
+ async *read(options = {}) {
75
+ const metadataOptions = { signal: options.signal };
76
+ options.signal?.throwIfAborted();
77
+ if (request.command === "showSources") {
78
+ const data = catalog.getSources().map((source) => ({ source_name: source.name }));
79
+ if (data.length)
80
+ yield { shape: "object-row-table", schema, data, length: data.length, batchType: "data" };
81
+ } else if (request.command === "showTables") {
82
+ const names = request.from === void 0 ? catalog.getSources().map((source) => source.name) : [request.from];
83
+ for (const name of names) {
84
+ const tables = await catalog.getTables(name, metadataOptions);
85
+ const data = tables.map((table) => ({
86
+ source_name: table.sourceName,
87
+ table_name: table.name,
88
+ table_reference: formatReference(table.reference),
89
+ queryable: table.queryable
90
+ }));
91
+ if (data.length)
92
+ yield { shape: "object-row-table", schema, data, length: data.length, batchType: "data" };
93
+ }
94
+ } else {
95
+ const tableSchema = await catalog.getSchema(request.from, metadataOptions);
96
+ const arrowSchema = (0, import_schema_utils.convertSchemaToArrow)(tableSchema);
97
+ const sourceName = typeof request.from === "string" ? request.from : request.from.source;
98
+ const tableName = typeof request.from === "string" ? request.from : request.from.table;
99
+ const data = tableSchema.fields.map((field, index) => ({
100
+ source_name: sourceName,
101
+ table_name: tableName,
102
+ column_name: field.name,
103
+ ordinal_position: index + 1,
104
+ data_type: arrowSchema.fields[index].type.toString(),
105
+ is_nullable: arrowSchema.fields[index].nullable,
106
+ metadata: JSON.stringify(field.metadata || {})
107
+ }));
108
+ if (data.length)
109
+ yield { shape: "object-row-table", schema, data, length: data.length, batchType: "data" };
110
+ }
111
+ }
112
+ };
113
+ }
114
+ function formatReference(reference) {
115
+ const quote = (name) => `"${name.replaceAll('"', '""')}"`;
116
+ return typeof reference === "string" ? quote(reference) : `${quote(reference.source)}.${quote(reference.table)}`;
117
+ }
118
+ // Annotate the CommonJS export names for ESM import in node:
119
+ 0 && (module.exports = {
120
+ createCatalogQuerySource
121
+ });
122
+ //# sourceMappingURL=catalog-query-source.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/scan/catalog-query-source.ts"],
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Schema, ObjectRowTableBatch} from '@loaders.gl/core/schema';\nimport type {\n DataSource,\n DataSourceOptions,\n TableReference,\n TableScanSource\n} from '@loaders.gl/core/loader-utils';\nimport {createScanQueryMetadata} from '@loaders.gl/core/loader-utils';\nimport {convertSchemaToArrow} from '@loaders.gl/core/schema-utils';\nimport {createSQLCatalog, type SQLCatalogQuery} from './sql-catalog';\n\n/** Turns a logical metadata command into an ordinary schema-bearing table source. */\nexport function createCatalogQuerySource(\n request: SQLCatalogQuery,\n sources: readonly DataSource<unknown, DataSourceOptions>[] | undefined\n): TableScanSource<ObjectRowTableBatch> {\n const allowed = request.command === 'showSources' ? ['command'] : ['command', 'from'];\n if (\n !['showSources', 'showTables', 'describe'].includes(request.command) ||\n Object.keys(request).some(key => !allowed.includes(key))\n )\n throw new Error('Unsupported catalog query.');\n if (\n request.command === 'showTables' &&\n request.from !== undefined &&\n (typeof request.from !== 'string' || !request.from.trim())\n )\n throw new Error('SHOW TABLES requires a non-empty source name.');\n if (request.command === 'describe' && request.from === undefined)\n throw new Error('DESCRIBE requires a table reference.');\n const catalog = createSQLCatalog(sources!);\n const fields =\n request.command === 'showSources'\n ? ['source_name']\n : request.command === 'showTables'\n ? ['source_name', 'table_name', 'table_reference', 'queryable']\n : [\n 'source_name',\n 'table_name',\n 'column_name',\n 'ordinal_position',\n 'data_type',\n 'is_nullable',\n 'metadata'\n ];\n const schema: Schema = {\n fields: fields.map(name => ({\n name,\n type:\n name === 'ordinal_position'\n ? 'int32'\n : name === 'queryable' || name === 'is_nullable'\n ? 'bool'\n : 'utf8',\n nullable: false\n })),\n metadata: {catalog: request.command}\n };\n return {\n async getQueryMetadata(options = {}) {\n options.signal?.throwIfAborted();\n return createScanQueryMetadata({\n sourceType: 'catalog',\n queryType: 'table',\n schema,\n execution: {status: 'supported', method: 'read'},\n capabilities: {\n table: {\n projection: 'unsupported',\n predicate: 'unsupported',\n limit: 'unsupported',\n streaming: true,\n cancellation: true\n }\n }\n });\n },\n async *read(options = {}) {\n const metadataOptions = {signal: options.signal};\n options.signal?.throwIfAborted();\n if (request.command === 'showSources') {\n const data = catalog.getSources().map(source => ({source_name: source.name}));\n if (data.length)\n yield {shape: 'object-row-table', schema, data, length: data.length, batchType: 'data'};\n } else if (request.command === 'showTables') {\n const names =\n request.from === undefined\n ? catalog.getSources().map(source => source.name)\n : [request.from];\n for (const name of names) {\n const tables = await catalog.getTables(name, metadataOptions);\n const data = tables.map(table => ({\n source_name: table.sourceName,\n table_name: table.name,\n table_reference: formatReference(table.reference),\n queryable: table.queryable\n }));\n if (data.length)\n yield {shape: 'object-row-table', schema, data, length: data.length, batchType: 'data'};\n }\n } else {\n const tableSchema = await catalog.getSchema(request.from, metadataOptions);\n const arrowSchema = convertSchemaToArrow(tableSchema);\n const sourceName = typeof request.from === 'string' ? request.from : request.from.source;\n const tableName = typeof request.from === 'string' ? request.from : request.from.table;\n const data = tableSchema.fields.map((field, index) => ({\n source_name: sourceName,\n table_name: tableName,\n column_name: field.name,\n ordinal_position: index + 1,\n data_type: arrowSchema.fields[index].type.toString(),\n is_nullable: arrowSchema.fields[index].nullable,\n metadata: JSON.stringify(field.metadata || {})\n }));\n if (data.length)\n yield {shape: 'object-row-table', schema, data, length: data.length, batchType: 'data'};\n }\n }\n };\n}\n\n/** Renders actual references as safely quoted SQL for schema explorers. */\nfunction formatReference(reference: TableReference): string {\n const quote = (name: string) => `\"${name.replaceAll('\"', '\"\"')}\"`;\n return typeof reference === 'string'\n ? quote(reference)\n : `${quote(reference.source)}.${quote(reference.table)}`;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,0BAAsC;AACtC,0BAAmC;AACnC,yBAAqD;AAG9C,SAAS,yBACd,SACA,SACsC;AACtC,QAAM,UAAU,QAAQ,YAAY,gBAAgB,CAAC,SAAS,IAAI,CAAC,WAAW,MAAM;AACpF,MACE,CAAC,CAAC,eAAe,cAAc,UAAU,EAAE,SAAS,QAAQ,OAAO,KACnE,OAAO,KAAK,OAAO,EAAE,KAAK,SAAO,CAAC,QAAQ,SAAS,GAAG,CAAC;AAEvD,UAAM,IAAI,MAAM,4BAA4B;AAC9C,MACE,QAAQ,YAAY,gBACpB,QAAQ,SAAS,WAChB,OAAO,QAAQ,SAAS,YAAY,CAAC,QAAQ,KAAK,KAAK;AAExD,UAAM,IAAI,MAAM,+CAA+C;AACjE,MAAI,QAAQ,YAAY,cAAc,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K,WAAW,KAAK,IAAI,CAAC;AAC9D,SAAO,OAAO,cAAc,WACxB,MAAM,SAAS,IACf,GAAG,MAAM,UAAU,MAAM,CAAC,IAAI,MAAM,UAAU,KAAK,CAAC;AAC1D;",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ import type { ObjectRowTableBatch } from '@loaders.gl/core/schema';
2
+ import type { DataSource, DataSourceOptions, TableScanSource } from '@loaders.gl/core/loader-utils';
3
+ import { type SQLCatalogQuery } from "./sql-catalog.js";
4
+ /** Turns a logical metadata command into an ordinary schema-bearing table source. */
5
+ export declare function createCatalogQuerySource(request: SQLCatalogQuery, sources: readonly DataSource<unknown, DataSourceOptions>[] | undefined): TableScanSource<ObjectRowTableBatch>;
6
+ //# sourceMappingURL=catalog-query-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-query-source.d.ts","sourceRoot":"","sources":["../../src/scan/catalog-query-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAS,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AACzE,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EAEjB,eAAe,EAChB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAmB,KAAK,eAAe,EAAC,yBAAsB;AAErE,qFAAqF;AACrF,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,SAAS,UAAU,CAAC,OAAO,EAAE,iBAAiB,CAAC,EAAE,GAAG,SAAS,GACrE,eAAe,CAAC,mBAAmB,CAAC,CAwGtC"}
@@ -0,0 +1,115 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ import { createScanQueryMetadata } from '@loaders.gl/core/loader-utils';
5
+ import { convertSchemaToArrow } from '@loaders.gl/core/schema-utils';
6
+ import { createSQLCatalog } from "./sql-catalog.js";
7
+ /** Turns a logical metadata command into an ordinary schema-bearing table source. */
8
+ export function createCatalogQuerySource(request, sources) {
9
+ const allowed = request.command === 'showSources' ? ['command'] : ['command', 'from'];
10
+ if (!['showSources', 'showTables', 'describe'].includes(request.command) ||
11
+ Object.keys(request).some(key => !allowed.includes(key)))
12
+ throw new Error('Unsupported catalog query.');
13
+ if (request.command === 'showTables' &&
14
+ request.from !== undefined &&
15
+ (typeof request.from !== 'string' || !request.from.trim()))
16
+ throw new Error('SHOW TABLES requires a non-empty source name.');
17
+ if (request.command === 'describe' && request.from === undefined)
18
+ throw new Error('DESCRIBE requires a table reference.');
19
+ const catalog = createSQLCatalog(sources);
20
+ const fields = request.command === 'showSources'
21
+ ? ['source_name']
22
+ : request.command === 'showTables'
23
+ ? ['source_name', 'table_name', 'table_reference', 'queryable']
24
+ : [
25
+ 'source_name',
26
+ 'table_name',
27
+ 'column_name',
28
+ 'ordinal_position',
29
+ 'data_type',
30
+ 'is_nullable',
31
+ 'metadata'
32
+ ];
33
+ const schema = {
34
+ fields: fields.map(name => ({
35
+ name,
36
+ type: name === 'ordinal_position'
37
+ ? 'int32'
38
+ : name === 'queryable' || name === 'is_nullable'
39
+ ? 'bool'
40
+ : 'utf8',
41
+ nullable: false
42
+ })),
43
+ metadata: { catalog: request.command }
44
+ };
45
+ return {
46
+ async getQueryMetadata(options = {}) {
47
+ options.signal?.throwIfAborted();
48
+ return createScanQueryMetadata({
49
+ sourceType: 'catalog',
50
+ queryType: 'table',
51
+ schema,
52
+ execution: { status: 'supported', method: 'read' },
53
+ capabilities: {
54
+ table: {
55
+ projection: 'unsupported',
56
+ predicate: 'unsupported',
57
+ limit: 'unsupported',
58
+ streaming: true,
59
+ cancellation: true
60
+ }
61
+ }
62
+ });
63
+ },
64
+ async *read(options = {}) {
65
+ const metadataOptions = { signal: options.signal };
66
+ options.signal?.throwIfAborted();
67
+ if (request.command === 'showSources') {
68
+ const data = catalog.getSources().map(source => ({ source_name: source.name }));
69
+ if (data.length)
70
+ yield { shape: 'object-row-table', schema, data, length: data.length, batchType: 'data' };
71
+ }
72
+ else if (request.command === 'showTables') {
73
+ const names = request.from === undefined
74
+ ? catalog.getSources().map(source => source.name)
75
+ : [request.from];
76
+ for (const name of names) {
77
+ const tables = await catalog.getTables(name, metadataOptions);
78
+ const data = tables.map(table => ({
79
+ source_name: table.sourceName,
80
+ table_name: table.name,
81
+ table_reference: formatReference(table.reference),
82
+ queryable: table.queryable
83
+ }));
84
+ if (data.length)
85
+ yield { shape: 'object-row-table', schema, data, length: data.length, batchType: 'data' };
86
+ }
87
+ }
88
+ else {
89
+ const tableSchema = await catalog.getSchema(request.from, metadataOptions);
90
+ const arrowSchema = convertSchemaToArrow(tableSchema);
91
+ const sourceName = typeof request.from === 'string' ? request.from : request.from.source;
92
+ const tableName = typeof request.from === 'string' ? request.from : request.from.table;
93
+ const data = tableSchema.fields.map((field, index) => ({
94
+ source_name: sourceName,
95
+ table_name: tableName,
96
+ column_name: field.name,
97
+ ordinal_position: index + 1,
98
+ data_type: arrowSchema.fields[index].type.toString(),
99
+ is_nullable: arrowSchema.fields[index].nullable,
100
+ metadata: JSON.stringify(field.metadata || {})
101
+ }));
102
+ if (data.length)
103
+ yield { shape: 'object-row-table', schema, data, length: data.length, batchType: 'data' };
104
+ }
105
+ }
106
+ };
107
+ }
108
+ /** Renders actual references as safely quoted SQL for schema explorers. */
109
+ function formatReference(reference) {
110
+ const quote = (name) => `"${name.replaceAll('"', '""')}"`;
111
+ return typeof reference === 'string'
112
+ ? quote(reference)
113
+ : `${quote(reference.source)}.${quote(reference.table)}`;
114
+ }
115
+ //# sourceMappingURL=catalog-query-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-query-source.js","sourceRoot":"","sources":["../../src/scan/catalog-query-source.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AASpC,OAAO,EAAC,uBAAuB,EAAC,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAC,gB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CAAC,GAAG,CAAC;IAClE,OAAO,OAAO,SAAS,KAAK,QAAQ;QAClC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC;QAClB,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;AAC7D,CAAC"}
@@ -286,8 +286,8 @@ var FederatedTableScanSource = class {
286
286
  if (telemetry.status === "early-terminated" && !telemetry.earlyTerminationReason) {
287
287
  telemetry.earlyTerminationReason = "consumer-return";
288
288
  }
289
- (0, import_loader_utils.emitScanExecutionTelemetry)(
290
- options.onTelemetry,
289
+ (0, import_loader_utils.emitQueryComplete)(
290
+ options.onQueryComplete,
291
291
  Object.freeze({
292
292
  ...telemetry,
293
293
  batchesDecoded: telemetry.batchesRead,
@@ -479,7 +479,7 @@ function validateAndCloneOutputSchema(outputSchema, sources, inferredSchema, sch
479
479
  }
480
480
  return cloneSchema(outputSchema);
481
481
  }
482
- function createSourceReadOptions(source, requiredOutputColumns, remaining, options, onTelemetry) {
482
+ function createSourceReadOptions(source, requiredOutputColumns, remaining, options, onQueryComplete) {
483
483
  const sourceResidualPredicate = getSourceResidualPredicate(source);
484
484
  const requiredSourceColumns = requiredOutputColumns.map((outputName) => source.sourceNameByOutputName.get(outputName)).filter((sourceName) => Boolean(sourceName));
485
485
  if (sourceResidualPredicate) {
@@ -497,7 +497,7 @@ function createSourceReadOptions(source, requiredOutputColumns, remaining, optio
497
497
  predicate: sourceResidualPredicate ? void 0 : source.entry.query?.predicate,
498
498
  limit: sourceResidualPredicate ? void 0 : Number.isFinite(limit) ? limit : void 0,
499
499
  signal: options.signal,
500
- onTelemetry
500
+ onQueryComplete
501
501
  };
502
502
  }
503
503
  function getSourceResidualPredicate(source) {