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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (350) hide show
  1. package/GEOARROW-README.md +1 -1
  2. package/README.md +1 -1
  3. package/SCAN-README.md +1 -1
  4. package/SCHEMA-UTILS-README.md +1 -1
  5. package/dist/arrow-geometry/binary-geometry-to-wkb.cjs +2 -2
  6. package/dist/arrow-geometry/binary-geometry-to-wkb.cjs.map +2 -2
  7. package/dist/arrow-geometry/binary-geometry-to-wkb.js +1 -1
  8. package/dist/arrow-geometry/binary-geometry-to-wkb.js.map +1 -1
  9. package/dist/arrow-geometry/geojson-table.cjs +3 -3
  10. package/dist/arrow-geometry/geojson-table.cjs.map +2 -2
  11. package/dist/arrow-geometry/geojson-table.js +2 -2
  12. package/dist/arrow-geometry/geojson-table.js.map +1 -1
  13. package/dist/arrow-geometry/geometry-codecs.cjs +6 -6
  14. package/dist/arrow-geometry/geometry-codecs.cjs.map +2 -2
  15. package/dist/arrow-geometry/geometry-codecs.js +1 -1
  16. package/dist/arrow-geometry/geometry-codecs.js.map +1 -1
  17. package/dist/arrow-geometry/geometry-to-wkt.cjs +2 -2
  18. package/dist/arrow-geometry/geometry-to-wkt.cjs.map +2 -2
  19. package/dist/arrow-geometry/geometry-to-wkt.js +1 -1
  20. package/dist/arrow-geometry/geometry-to-wkt.js.map +1 -1
  21. package/dist/arrow-geometry/index.cjs +0 -11
  22. package/dist/arrow-geometry/index.cjs.map +2 -2
  23. package/dist/arrow-geometry/index.d.ts +0 -1
  24. package/dist/arrow-geometry/index.d.ts.map +1 -1
  25. package/dist/arrow-geometry/index.js +0 -1
  26. package/dist/arrow-geometry/index.js.map +1 -1
  27. package/dist/arrow-geometry/wkb-builder.cjs +3 -3
  28. package/dist/arrow-geometry/wkb-builder.cjs.map +2 -2
  29. package/dist/arrow-geometry/wkb-builder.d.ts +1 -1
  30. package/dist/arrow-geometry/wkb-builder.d.ts.map +1 -1
  31. package/dist/arrow-geometry/wkb-builder.js +1 -1
  32. package/dist/arrow-geometry/wkb-builder.js.map +1 -1
  33. package/dist/arrow-geometry/wkb-statistics.cjs +2 -2
  34. package/dist/arrow-geometry/wkb-statistics.cjs.map +2 -2
  35. package/dist/arrow-geometry/wkb-statistics.js +1 -1
  36. package/dist/arrow-geometry/wkb-statistics.js.map +1 -1
  37. package/dist/arrow-worker-transport.cjs +81 -0
  38. package/dist/arrow-worker-transport.cjs.map +6 -0
  39. package/dist/arrow-worker-transport.d.ts +9 -0
  40. package/dist/arrow-worker-transport.d.ts.map +1 -0
  41. package/dist/arrow-worker-transport.js +60 -0
  42. package/dist/arrow-worker-transport.js.map +1 -0
  43. package/dist/cluster-source.cjs +198 -585
  44. package/dist/cluster-source.cjs.map +3 -3
  45. package/dist/dist.dev.js +546 -54
  46. package/dist/dist.min.js +3 -3
  47. package/dist/federated-table-scan-source.cjs +272 -201
  48. package/dist/federated-table-scan-source.cjs.map +3 -3
  49. package/dist/geoarrow/binary-polygon-to-geoarrow.cjs +2 -2
  50. package/dist/geoarrow/binary-polygon-to-geoarrow.cjs.map +2 -2
  51. package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts +1 -1
  52. package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts.map +1 -1
  53. package/dist/geoarrow/binary-polygon-to-geoarrow.js +1 -1
  54. package/dist/geoarrow/binary-polygon-to-geoarrow.js.map +1 -1
  55. package/dist/geoarrow/geoarrow-bounds.cjs +7 -7
  56. package/dist/geoarrow/geoarrow-bounds.cjs.map +2 -2
  57. package/dist/geoarrow/geoarrow-bounds.js +3 -3
  58. package/dist/geoarrow/geoarrow-bounds.js.map +1 -1
  59. package/dist/geoarrow/geoarrow-capabilities.cjs +2 -2
  60. package/dist/geoarrow/geoarrow-capabilities.cjs.map +2 -2
  61. package/dist/geoarrow/geoarrow-capabilities.js +1 -1
  62. package/dist/geoarrow/geoarrow-capabilities.js.map +1 -1
  63. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs +8 -8
  64. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs.map +2 -2
  65. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js +2 -2
  66. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js.map +1 -1
  67. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts +2 -2
  68. package/dist/geoarrow/geoarrow-inspection.cjs +2 -2
  69. package/dist/geoarrow/geoarrow-inspection.cjs.map +2 -2
  70. package/dist/geoarrow/geoarrow-inspection.js +1 -1
  71. package/dist/geoarrow/geoarrow-inspection.js.map +1 -1
  72. package/dist/geoarrow/geoarrow-stream.cjs +1 -1
  73. package/dist/geoarrow/geoarrow-stream.cjs.map +2 -2
  74. package/dist/geoarrow/geoarrow-stream.js +1 -1
  75. package/dist/geoarrow/geoarrow-stream.js.map +1 -1
  76. package/dist/geoarrow/get-geoarrow-vertex-count.cjs +2 -2
  77. package/dist/geoarrow/get-geoarrow-vertex-count.cjs.map +2 -2
  78. package/dist/geoarrow/get-geoarrow-vertex-count.js +1 -1
  79. package/dist/geoarrow/get-geoarrow-vertex-count.js.map +1 -1
  80. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs +4 -4
  81. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs.map +2 -2
  82. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js +1 -1
  83. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js.map +1 -1
  84. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs +3 -3
  85. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs.map +2 -2
  86. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js +1 -1
  87. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js.map +1 -1
  88. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs +3 -3
  89. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs.map +2 -2
  90. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js +1 -1
  91. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js.map +1 -1
  92. package/dist/index.cjs +8 -11
  93. package/dist/index.cjs.map +3 -3
  94. package/dist/lib/init.js +1 -1
  95. package/dist/loader-utils/index.cjs +251 -33
  96. package/dist/loader-utils/index.cjs.map +3 -3
  97. package/dist/loader-utils/index.d.ts +8 -4
  98. package/dist/loader-utils/index.d.ts.map +1 -1
  99. package/dist/loader-utils/index.js +4 -2
  100. package/dist/loader-utils/index.js.map +1 -1
  101. package/dist/loader-utils/json-loader.js +1 -1
  102. package/dist/loader-utils/lib/files/http-file-transport.d.ts +4 -0
  103. package/dist/loader-utils/lib/files/http-file-transport.d.ts.map +1 -1
  104. package/dist/loader-utils/lib/files/http-file-transport.js +45 -1
  105. package/dist/loader-utils/lib/files/http-file-transport.js.map +1 -1
  106. package/dist/loader-utils/lib/files/http-file-types.d.ts +2 -0
  107. package/dist/loader-utils/lib/files/http-file-types.d.ts.map +1 -1
  108. package/dist/loader-utils/lib/files/read-range-response.d.ts +3 -0
  109. package/dist/loader-utils/lib/files/read-range-response.d.ts.map +1 -0
  110. package/dist/loader-utils/lib/files/read-range-response.js +62 -0
  111. package/dist/loader-utils/lib/files/read-range-response.js.map +1 -0
  112. package/dist/loader-utils/lib/log-utils/log.js +1 -1
  113. package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts +38 -0
  114. package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts.map +1 -0
  115. package/dist/loader-utils/lib/scan-utils/logical-table-query.js +96 -0
  116. package/dist/loader-utils/lib/scan-utils/logical-table-query.js.map +1 -0
  117. package/dist/loader-utils/lib/scan-utils/{experimental-scan-options.d.ts → query-options.d.ts} +5 -8
  118. package/dist/loader-utils/lib/scan-utils/query-options.d.ts.map +1 -0
  119. package/dist/loader-utils/lib/scan-utils/{experimental-scan-options.js → query-options.js} +1 -1
  120. package/dist/loader-utils/lib/scan-utils/query-options.js.map +1 -0
  121. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts +12 -17
  122. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts.map +1 -1
  123. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js +5 -5
  124. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js.map +1 -1
  125. package/dist/loader-utils/lib/scan-utils/table-query.d.ts +33 -3
  126. package/dist/loader-utils/lib/scan-utils/table-query.d.ts.map +1 -1
  127. package/dist/loader-utils/lib/scan-utils/table-query.js.map +1 -1
  128. package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts +2 -2
  129. package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts.map +1 -1
  130. package/dist/loader-utils/lib/scan-utils/table-scan-batch.js +11 -3
  131. package/dist/loader-utils/lib/scan-utils/table-scan-batch.js.map +1 -1
  132. package/dist/loader-utils/lib/sources/data-source.d.ts +4 -0
  133. package/dist/loader-utils/lib/sources/data-source.d.ts.map +1 -1
  134. package/dist/loader-utils/lib/sources/data-source.js +50 -1
  135. package/dist/loader-utils/lib/sources/data-source.js.map +1 -1
  136. package/dist/loader-utils/lib/sources/table-source-collection.d.ts +30 -0
  137. package/dist/loader-utils/lib/sources/table-source-collection.d.ts.map +1 -0
  138. package/dist/loader-utils/lib/sources/table-source-collection.js +5 -0
  139. package/dist/loader-utils/lib/sources/table-source-collection.js.map +1 -0
  140. package/dist/loader-utils/loader-types.d.ts +5 -5
  141. package/dist/loader-utils/loader-types.d.ts.map +1 -1
  142. package/dist/null-loader.js +1 -1
  143. package/dist/null-worker-node.js +244 -11
  144. package/dist/null-worker.js +239 -11
  145. package/dist/scan/arrow-execution/filter-arrow-table.cjs +254 -0
  146. package/dist/scan/arrow-execution/filter-arrow-table.cjs.map +7 -0
  147. package/dist/scan/arrow-execution/filter-arrow-table.d.ts +16 -0
  148. package/dist/scan/arrow-execution/filter-arrow-table.d.ts.map +1 -0
  149. package/dist/scan/arrow-execution/filter-arrow-table.js +222 -0
  150. package/dist/scan/arrow-execution/filter-arrow-table.js.map +1 -0
  151. package/dist/scan/arrow-execution/project-arrow-table.cjs +70 -0
  152. package/dist/scan/arrow-execution/project-arrow-table.cjs.map +7 -0
  153. package/dist/scan/arrow-execution/project-arrow-table.d.ts +8 -0
  154. package/dist/scan/arrow-execution/project-arrow-table.d.ts.map +1 -0
  155. package/dist/scan/arrow-execution/project-arrow-table.js +39 -0
  156. package/dist/scan/arrow-execution/project-arrow-table.js.map +1 -0
  157. package/dist/scan/arrow-execution.cjs +34 -0
  158. package/dist/scan/arrow-execution.cjs.map +7 -0
  159. package/dist/scan/arrow-execution.d.ts +4 -0
  160. package/dist/scan/arrow-execution.d.ts.map +1 -0
  161. package/dist/scan/arrow-execution.js +6 -0
  162. package/dist/scan/arrow-execution.js.map +1 -0
  163. package/dist/scan/arrow-query.cjs.map +1 -1
  164. package/dist/scan/arrow-query.d.ts +1 -1
  165. package/dist/scan/arrow-query.d.ts.map +1 -1
  166. package/dist/scan/catalog-query-source.cjs +122 -0
  167. package/dist/scan/catalog-query-source.cjs.map +7 -0
  168. package/dist/scan/catalog-query-source.d.ts +6 -0
  169. package/dist/scan/catalog-query-source.d.ts.map +1 -0
  170. package/dist/scan/catalog-query-source.js +115 -0
  171. package/dist/scan/catalog-query-source.js.map +1 -0
  172. package/dist/scan/federated-table-scan-source.cjs +4 -4
  173. package/dist/scan/federated-table-scan-source.cjs.map +2 -2
  174. package/dist/scan/federated-table-scan-source.d.ts +1 -1
  175. package/dist/scan/federated-table-scan-source.d.ts.map +1 -1
  176. package/dist/scan/federated-table-scan-source.js +4 -4
  177. package/dist/scan/federated-table-scan-source.js.map +1 -1
  178. package/dist/scan/index.cjs +188 -4
  179. package/dist/scan/index.cjs.map +4 -4
  180. package/dist/scan/index.d.ts +9 -2
  181. package/dist/scan/index.d.ts.map +1 -1
  182. package/dist/scan/index.js +4 -0
  183. package/dist/scan/index.js.map +1 -1
  184. package/dist/scan/parse-sql-predicate.cjs +3 -3
  185. package/dist/scan/parse-sql-predicate.cjs.map +2 -2
  186. package/dist/scan/parse-sql-predicate.d.ts +5 -2
  187. package/dist/scan/parse-sql-predicate.d.ts.map +1 -1
  188. package/dist/scan/parse-sql-predicate.js +3 -10
  189. package/dist/scan/parse-sql-predicate.js.map +1 -1
  190. package/dist/scan/parse-sql-query.cjs +70 -0
  191. package/dist/scan/parse-sql-query.cjs.map +7 -0
  192. package/dist/scan/parse-sql-query.d.ts +5 -0
  193. package/dist/scan/parse-sql-query.d.ts.map +1 -0
  194. package/dist/scan/parse-sql-query.js +49 -0
  195. package/dist/scan/parse-sql-query.js.map +1 -0
  196. package/dist/scan/parse-sql-select.cjs +215 -0
  197. package/dist/scan/parse-sql-select.cjs.map +7 -0
  198. package/dist/scan/parse-sql-select.d.ts +38 -0
  199. package/dist/scan/parse-sql-select.d.ts.map +1 -0
  200. package/dist/scan/parse-sql-select.js +208 -0
  201. package/dist/scan/parse-sql-select.js.map +1 -0
  202. package/dist/scan/query-arrow-table-in-batches.cjs +65 -0
  203. package/dist/scan/query-arrow-table-in-batches.cjs.map +7 -0
  204. package/dist/scan/query-arrow-table-in-batches.d.ts +8 -0
  205. package/dist/scan/query-arrow-table-in-batches.d.ts.map +1 -0
  206. package/dist/scan/query-arrow-table-in-batches.js +44 -0
  207. package/dist/scan/query-arrow-table-in-batches.js.map +1 -0
  208. package/dist/scan/query-arrow-table.cjs +52 -179
  209. package/dist/scan/query-arrow-table.cjs.map +3 -3
  210. package/dist/scan/query-arrow-table.d.ts +4 -37
  211. package/dist/scan/query-arrow-table.d.ts.map +1 -1
  212. package/dist/scan/query-arrow-table.js +37 -188
  213. package/dist/scan/query-arrow-table.js.map +1 -1
  214. package/dist/scan/query.cjs +257 -0
  215. package/dist/scan/query.cjs.map +7 -0
  216. package/dist/scan/query.d.ts +44 -0
  217. package/dist/scan/query.d.ts.map +1 -0
  218. package/dist/scan/query.js +246 -0
  219. package/dist/scan/query.js.map +1 -0
  220. package/dist/scan/resolve-query-source.cjs +59 -0
  221. package/dist/scan/resolve-query-source.cjs.map +7 -0
  222. package/dist/scan/resolve-query-source.d.ts +6 -0
  223. package/dist/scan/resolve-query-source.d.ts.map +1 -0
  224. package/dist/scan/resolve-query-source.js +37 -0
  225. package/dist/scan/resolve-query-source.js.map +1 -0
  226. package/dist/scan/sql-catalog.cjs +110 -0
  227. package/dist/scan/sql-catalog.cjs.map +7 -0
  228. package/dist/scan/sql-catalog.d.ts +47 -0
  229. package/dist/scan/sql-catalog.d.ts.map +1 -0
  230. package/dist/scan/sql-catalog.js +97 -0
  231. package/dist/scan/sql-catalog.js.map +1 -0
  232. package/dist/scan/table-query.cjs.map +2 -2
  233. package/dist/scan/table-query.d.ts +4 -1
  234. package/dist/scan/table-query.d.ts.map +1 -1
  235. package/dist/scan/table-query.js.map +1 -1
  236. package/dist/schema/geometry/geoarrow.d.ts +3 -6
  237. package/dist/schema/geometry/geoarrow.d.ts.map +1 -1
  238. package/dist/vector-table-scan-source.cjs +281 -193
  239. package/dist/vector-table-scan-source.cjs.map +3 -3
  240. package/dist/worker-utils/index.cjs +20 -26
  241. package/dist/worker-utils/index.cjs.map +3 -3
  242. package/dist/worker-utils/index.d.ts +0 -3
  243. package/dist/worker-utils/index.d.ts.map +1 -1
  244. package/dist/worker-utils/index.js +0 -3
  245. package/dist/worker-utils/index.js.map +1 -1
  246. package/dist/worker-utils/lib/env-utils/version.js +1 -1
  247. package/dist/worker-utils/lib/library-utils/library-utils.js +1 -1
  248. package/dist/worker-utils/lib/library-utils/library-utils.js.map +1 -1
  249. package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts +1 -1
  250. package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts.map +1 -1
  251. package/dist/worker-utils/lib/worker-api/process-on-worker.js +1 -1
  252. package/dist/worker-utils/lib/worker-api/process-on-worker.js.map +1 -1
  253. package/dist/worker-utils/lib/worker-api/task-runtime.d.ts +1 -1
  254. package/dist/worker-utils/lib/worker-api/task-runtime.d.ts.map +1 -1
  255. package/dist/worker-utils/lib/worker-api/task-runtime.js +1 -1
  256. package/dist/worker-utils/lib/worker-api/task-runtime.js.map +1 -1
  257. package/dist/worker-utils/null-worker-node.js +243 -10
  258. package/dist/worker-utils/null-worker-node.js.map +4 -4
  259. package/dist/worker-utils/null-worker.js +238 -10
  260. package/dist/worker-utils/null-worker.js.map +4 -4
  261. package/dist/worker-utils/types.d.ts +1 -1
  262. package/dist/worker-utils/types.d.ts.map +1 -1
  263. package/package.json +23 -11
  264. package/src/arrow-geometry/binary-geometry-to-wkb.ts +1 -1
  265. package/src/arrow-geometry/geojson-table.ts +2 -2
  266. package/src/arrow-geometry/geometry-codecs.ts +2 -2
  267. package/src/arrow-geometry/geometry-to-wkt.ts +2 -2
  268. package/src/arrow-geometry/index.ts +0 -9
  269. package/src/arrow-geometry/wkb-builder.ts +2 -2
  270. package/src/arrow-geometry/wkb-statistics.ts +2 -2
  271. package/src/arrow-worker-transport.ts +87 -0
  272. package/src/geoarrow/binary-polygon-to-geoarrow.ts +2 -2
  273. package/src/geoarrow/geoarrow-bounds.ts +3 -3
  274. package/src/geoarrow/geoarrow-capabilities.ts +1 -1
  275. package/src/geoarrow/geoarrow-converter/convert-geoarrow-geometry.ts +3 -3
  276. package/src/geoarrow/geoarrow-inspection.ts +2 -2
  277. package/src/geoarrow/geoarrow-stream.ts +1 -1
  278. package/src/geoarrow/get-geoarrow-vertex-count.ts +1 -1
  279. package/src/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.ts +1 -1
  280. package/src/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.ts +2 -2
  281. package/src/geoarrow/lib/kernels/encode-geoarrow-box.ts +1 -1
  282. package/src/loader-utils/index.ts +31 -7
  283. package/src/loader-utils/lib/files/http-file-transport.ts +65 -1
  284. package/src/loader-utils/lib/files/http-file-types.ts +2 -0
  285. package/src/loader-utils/lib/files/read-range-response.ts +66 -0
  286. package/src/loader-utils/lib/scan-utils/logical-table-query.ts +164 -0
  287. package/src/loader-utils/lib/scan-utils/query-options.ts +44 -0
  288. package/src/loader-utils/lib/scan-utils/scan-query-metadata.ts +17 -26
  289. package/src/loader-utils/lib/scan-utils/table-query.ts +49 -8
  290. package/src/loader-utils/lib/scan-utils/table-scan-batch.ts +25 -9
  291. package/src/loader-utils/lib/sources/data-source.ts +54 -1
  292. package/src/loader-utils/lib/sources/table-source-collection.ts +38 -0
  293. package/src/loader-utils/loader-types.ts +5 -5
  294. package/src/scan/arrow-execution/filter-arrow-table.ts +293 -0
  295. package/src/scan/arrow-execution/project-arrow-table.ts +53 -0
  296. package/src/scan/arrow-execution.ts +7 -0
  297. package/src/scan/arrow-query.ts +3 -0
  298. package/src/scan/catalog-query-source.ts +132 -0
  299. package/src/scan/federated-table-scan-source.ts +19 -19
  300. package/src/scan/index.ts +28 -4
  301. package/src/scan/parse-sql-predicate.ts +9 -3
  302. package/src/scan/parse-sql-query.ts +53 -0
  303. package/src/scan/parse-sql-select.ts +220 -0
  304. package/src/scan/query-arrow-table-in-batches.ts +58 -0
  305. package/src/scan/query-arrow-table.ts +60 -237
  306. package/src/scan/query.ts +339 -0
  307. package/src/scan/resolve-query-source.ts +47 -0
  308. package/src/scan/sql-catalog.ts +167 -0
  309. package/src/scan/table-query.ts +6 -1
  310. package/src/schema/geometry/geoarrow.ts +8 -19
  311. package/src/worker-utils/index.ts +0 -16
  312. package/src/worker-utils/lib/library-utils/library-utils.ts +1 -1
  313. package/src/worker-utils/lib/worker-api/create-worker.ts +1 -1
  314. package/src/worker-utils/lib/worker-api/process-on-worker.ts +1 -6
  315. package/src/worker-utils/lib/worker-api/task-runtime.ts +1 -1
  316. package/src/worker-utils/types.ts +1 -1
  317. package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs +0 -477
  318. package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs.map +0 -7
  319. package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts +0 -29
  320. package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts.map +0 -1
  321. package/dist/arrow-geometry/arrow-geoarrow-adapter.js +0 -434
  322. package/dist/arrow-geometry/arrow-geoarrow-adapter.js.map +0 -1
  323. package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs +0 -39
  324. package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs.map +0 -7
  325. package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts +0 -2
  326. package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts.map +0 -1
  327. package/dist/geoarrow/lib/arrow-geoarrow-adapter.js +0 -5
  328. package/dist/geoarrow/lib/arrow-geoarrow-adapter.js.map +0 -1
  329. package/dist/loader-utils/lib/scan-utils/experimental-scan-options.d.ts.map +0 -1
  330. package/dist/loader-utils/lib/scan-utils/experimental-scan-options.js.map +0 -1
  331. package/dist/schema-utils/arrow-transport.cjs +0 -691
  332. package/dist/schema-utils/arrow-transport.cjs.map +0 -6
  333. package/dist/schema-utils/arrow-transport.d.ts +0 -4
  334. package/dist/schema-utils/arrow-transport.d.ts.map +0 -1
  335. package/dist/schema-utils/arrow-transport.js +0 -7
  336. package/dist/schema-utils/arrow-transport.js.map +0 -1
  337. package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts +0 -76
  338. package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts.map +0 -1
  339. package/dist/schema-utils/lib/arrow/arrow-table-transport.js +0 -182
  340. package/dist/schema-utils/lib/arrow/arrow-table-transport.js.map +0 -1
  341. package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts +0 -33
  342. package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts.map +0 -1
  343. package/dist/schema-utils/lib/arrow/split-arrow-buffers.js +0 -134
  344. package/dist/schema-utils/lib/arrow/split-arrow-buffers.js.map +0 -1
  345. package/src/arrow-geometry/arrow-geoarrow-adapter.ts +0 -568
  346. package/src/geoarrow/lib/arrow-geoarrow-adapter.ts +0 -12
  347. package/src/loader-utils/lib/scan-utils/experimental-scan-options.ts +0 -46
  348. package/src/schema-utils/arrow-transport.ts +0 -7
  349. package/src/schema-utils/lib/arrow/arrow-table-transport.ts +0 -282
  350. package/src/schema-utils/lib/arrow/split-arrow-buffers.ts +0 -247
@@ -1,691 +0,0 @@
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/schema-utils/arrow-transport.ts
31
- var arrow_transport_exports = {};
32
- __export(arrow_transport_exports, {
33
- dehydrateArrowTable: () => dehydrateArrowTable,
34
- deserializeArrowTableFromIPC: () => deserializeArrowTableFromIPC,
35
- deserializeArrowWorkerResult: () => deserializeArrowWorkerResult,
36
- deserializeArrowWorkerTable: () => deserializeArrowWorkerTable,
37
- hydrateArrowTable: () => hydrateArrowTable,
38
- serializeArrowTableToIPC: () => serializeArrowTableToIPC,
39
- serializeArrowWorkerResult: () => serializeArrowWorkerResult,
40
- serializeArrowWorkerTable: () => serializeArrowWorkerTable,
41
- splitArrowBuffers: () => splitArrowBuffers,
42
- splitArrowTableBuffers: () => splitArrowTableBuffers
43
- });
44
- module.exports = __toCommonJS(arrow_transport_exports);
45
-
46
- // src/schema-utils/lib/arrow/arrow-table-transport.ts
47
- var arrow3 = __toESM(require("apache-arrow"), 1);
48
-
49
- // src/schema-utils/lib/schema/convert-arrow-schema.ts
50
- var arrow = __toESM(require("apache-arrow"), 1);
51
- function serializeArrowSchema(arrowSchema) {
52
- return {
53
- fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
54
- metadata: serializeArrowMetadata(arrowSchema.metadata)
55
- };
56
- }
57
- function deserializeArrowSchema(schema, options) {
58
- return new arrow.Schema(
59
- schema.fields.map((field) => deserializeArrowField(field, options)),
60
- deserializeArrowMetadata(schema.metadata)
61
- );
62
- }
63
- function serializeArrowMetadata(arrowMetadata) {
64
- return Object.fromEntries(arrowMetadata);
65
- }
66
- function deserializeArrowMetadata(metadata) {
67
- return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
68
- }
69
- function serializeArrowField(field) {
70
- return {
71
- name: field.name,
72
- type: serializeArrowType(field.type),
73
- nullable: field.nullable,
74
- metadata: serializeArrowMetadata(field.metadata)
75
- };
76
- }
77
- function deserializeArrowField(field, options) {
78
- return new arrow.Field(
79
- field.name,
80
- deserializeArrowType(field.type, options),
81
- field.nullable,
82
- deserializeArrowMetadata(field.metadata)
83
- );
84
- }
85
- function serializeArrowType(arrowType) {
86
- if (isArrowViewType(arrowType, "BinaryView")) {
87
- return "binary-view";
88
- }
89
- if (isArrowViewType(arrowType, "Utf8View")) {
90
- return "utf8-view";
91
- }
92
- if (isOptionalArrowType(arrowType, "LargeList")) {
93
- const largeListType = arrowType;
94
- return {
95
- type: "large-list",
96
- children: [serializeArrowField(largeListType.valueField)]
97
- };
98
- }
99
- switch (arrowType.constructor) {
100
- case arrow.Null:
101
- return "null";
102
- case arrow.Binary:
103
- return "binary";
104
- case arrow.FixedSizeBinary:
105
- return {
106
- type: "fixed-size-binary",
107
- byteWidth: arrowType.byteWidth
108
- };
109
- case arrow.Bool:
110
- return "bool";
111
- case arrow.Int:
112
- const intType = arrowType;
113
- return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
114
- case arrow.Int8:
115
- return "int8";
116
- case arrow.Int16:
117
- return "int16";
118
- case arrow.Int32:
119
- return "int32";
120
- case arrow.Int64:
121
- return "int64";
122
- case arrow.Uint8:
123
- return "uint8";
124
- case arrow.Uint16:
125
- return "uint16";
126
- case arrow.Uint32:
127
- return "uint32";
128
- case arrow.Uint64:
129
- return "uint64";
130
- case arrow.Float:
131
- const precision = arrowType.precision;
132
- switch (precision) {
133
- case arrow.Precision.HALF:
134
- return "float16";
135
- case arrow.Precision.SINGLE:
136
- return "float32";
137
- case arrow.Precision.DOUBLE:
138
- return "float64";
139
- default:
140
- return "float16";
141
- }
142
- case arrow.Float16:
143
- return "float16";
144
- case arrow.Float32:
145
- return "float32";
146
- case arrow.Float64:
147
- return "float64";
148
- case arrow.Utf8:
149
- return "utf8";
150
- case arrow.Decimal:
151
- const decimal = arrowType;
152
- return {
153
- type: "decimal",
154
- bitWidth: decimal.bitWidth,
155
- precision: decimal.precision,
156
- scale: decimal.scale
157
- };
158
- case arrow.Date_:
159
- const dateUnit = arrowType.unit;
160
- return dateUnit === arrow.DateUnit.DAY ? "date-day" : "date-millisecond";
161
- case arrow.DateDay:
162
- return "date-day";
163
- case arrow.DateMillisecond:
164
- return "date-millisecond";
165
- case arrow.Time:
166
- const timeUnit = arrowType.unit;
167
- switch (timeUnit) {
168
- case arrow.TimeUnit.SECOND:
169
- return "time-second";
170
- case arrow.TimeUnit.MILLISECOND:
171
- return "time-millisecond";
172
- case arrow.TimeUnit.MICROSECOND:
173
- return "time-microsecond";
174
- case arrow.TimeUnit.NANOSECOND:
175
- return "time-nanosecond";
176
- default:
177
- return "time-second";
178
- }
179
- case arrow.TimeMillisecond:
180
- return "time-millisecond";
181
- case arrow.TimeSecond:
182
- return "time-second";
183
- case arrow.TimeMicrosecond:
184
- return "time-microsecond";
185
- case arrow.TimeNanosecond:
186
- return "time-nanosecond";
187
- case arrow.Timestamp:
188
- const timeStampUnit = arrowType.unit;
189
- switch (timeStampUnit) {
190
- case arrow.TimeUnit.SECOND:
191
- return "timestamp-second";
192
- case arrow.TimeUnit.MILLISECOND:
193
- return "timestamp-millisecond";
194
- case arrow.TimeUnit.MICROSECOND:
195
- return "timestamp-microsecond";
196
- case arrow.TimeUnit.NANOSECOND:
197
- return "timestamp-nanosecond";
198
- default:
199
- return "timestamp-second";
200
- }
201
- case arrow.TimestampSecond:
202
- return "timestamp-second";
203
- case arrow.TimestampMillisecond:
204
- return "timestamp-millisecond";
205
- case arrow.TimestampMicrosecond:
206
- return "timestamp-microsecond";
207
- case arrow.TimestampNanosecond:
208
- return "timestamp-nanosecond";
209
- case arrow.Interval:
210
- const intervalUnit = arrowType.unit;
211
- switch (intervalUnit) {
212
- case arrow.IntervalUnit.DAY_TIME:
213
- return "interval-daytime";
214
- case arrow.IntervalUnit.YEAR_MONTH:
215
- return "interval-yearmonth";
216
- default:
217
- return "interval-daytime";
218
- }
219
- case arrow.IntervalDayTime:
220
- return "interval-daytime";
221
- case arrow.IntervalYearMonth:
222
- return "interval-yearmonth";
223
- case arrow.Map_:
224
- const mapType = arrowType;
225
- return {
226
- type: "map",
227
- keysSorted: mapType.keysSorted,
228
- children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
229
- };
230
- case arrow.List:
231
- const listType = arrowType;
232
- const listField = listType.valueField;
233
- return {
234
- type: "list",
235
- children: [serializeArrowField(listField)]
236
- };
237
- case arrow.FixedSizeList:
238
- const fixedSizeList = arrowType;
239
- return {
240
- type: "fixed-size-list",
241
- listSize: fixedSizeList.listSize,
242
- children: [serializeArrowField(fixedSizeList.children[0])]
243
- };
244
- case arrow.Struct:
245
- const structType = arrowType;
246
- return {
247
- type: "struct",
248
- children: structType.children.map((arrowField) => serializeArrowField(arrowField))
249
- };
250
- case arrow.SparseUnion:
251
- case arrow.DenseUnion:
252
- const unionType = arrowType;
253
- return {
254
- type: unionType instanceof arrow.DenseUnion ? "dense-union" : "sparse-union",
255
- typeIds: unionType.typeIds,
256
- children: unionType.children.map((arrowField) => serializeArrowField(arrowField)),
257
- typeIdToChildIndex: { ...unionType.typeIdToChildIndex }
258
- };
259
- case arrow.Dictionary:
260
- const dictionaryType = arrowType;
261
- return {
262
- type: "dictionary",
263
- id: dictionaryType.id,
264
- indices: serializeArrowDictionaryKeyType(dictionaryType.indices),
265
- dictionary: serializeArrowType(dictionaryType.dictionary),
266
- isOrdered: dictionaryType.isOrdered
267
- };
268
- default:
269
- throw new Error(`arrow type not supported: ${arrowType.constructor.name}`);
270
- }
271
- }
272
- function deserializeArrowType(dataType, options) {
273
- if (typeof dataType === "object") {
274
- switch (dataType.type) {
275
- case "decimal":
276
- return new arrow.Decimal(dataType.scale, dataType.precision, dataType.bitWidth);
277
- case "map": {
278
- const children = dataType.children.map(
279
- (arrowField) => deserializeArrowField(arrowField, options)
280
- );
281
- return new arrow.Map_(children[0], dataType.keysSorted);
282
- }
283
- case "list": {
284
- const field = deserializeArrowField(dataType.children[0], options);
285
- return new arrow.List(field);
286
- }
287
- case "large-list": {
288
- const field = deserializeArrowField(dataType.children[0], options);
289
- const LargeList = getOptionalArrowConstructor("LargeList");
290
- if (!LargeList) {
291
- throw new Error(
292
- "LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
293
- );
294
- }
295
- return new LargeList(field);
296
- }
297
- case "fixed-size-list": {
298
- const child = deserializeArrowField(dataType.children[0], options);
299
- return new arrow.FixedSizeList(dataType.listSize, child);
300
- }
301
- case "fixed-size-binary":
302
- return new arrow.FixedSizeBinary(dataType.byteWidth);
303
- case "struct": {
304
- const children = dataType.children.map(
305
- (arrowField) => deserializeArrowField(arrowField, options)
306
- );
307
- return new arrow.Struct(children);
308
- }
309
- case "sparse-union":
310
- case "dense-union": {
311
- const children = dataType.children.map(
312
- (arrowField) => deserializeArrowField(arrowField, options)
313
- );
314
- return dataType.type === "dense-union" ? new arrow.DenseUnion(dataType.typeIds, children) : new arrow.SparseUnion(dataType.typeIds, children);
315
- }
316
- case "dictionary": {
317
- return new arrow.Dictionary(
318
- deserializeArrowType(dataType.dictionary, options),
319
- deserializeArrowDictionaryKeyType(dataType.indices),
320
- dataType.id,
321
- dataType.isOrdered
322
- );
323
- }
324
- default:
325
- throw new Error("array type not supported");
326
- }
327
- }
328
- switch (dataType) {
329
- case "null":
330
- return new arrow.Null();
331
- case "binary":
332
- return makeVariableWidthArrowType("BinaryView", new arrow.Binary(), options);
333
- case "binary-view":
334
- return makeRequiredArrowViewType("BinaryView");
335
- case "bool":
336
- return new arrow.Bool();
337
- case "int8":
338
- return new arrow.Int8();
339
- case "int16":
340
- return new arrow.Int16();
341
- case "int32":
342
- return new arrow.Int32();
343
- case "int64":
344
- return new arrow.Int64();
345
- case "uint8":
346
- return new arrow.Uint8();
347
- case "uint16":
348
- return new arrow.Uint16();
349
- case "uint32":
350
- return new arrow.Uint32();
351
- case "uint64":
352
- return new arrow.Uint64();
353
- case "float16":
354
- return new arrow.Float16();
355
- case "float32":
356
- return new arrow.Float32();
357
- case "float64":
358
- return new arrow.Float64();
359
- case "utf8":
360
- return makeVariableWidthArrowType("Utf8View", new arrow.Utf8(), options);
361
- case "utf8-view":
362
- return makeRequiredArrowViewType("Utf8View");
363
- case "date-day":
364
- return new arrow.DateDay();
365
- case "date-millisecond":
366
- return new arrow.DateMillisecond();
367
- case "time-second":
368
- return new arrow.TimeSecond();
369
- case "time-millisecond":
370
- return new arrow.TimeMillisecond();
371
- case "time-microsecond":
372
- return new arrow.TimeMicrosecond();
373
- case "time-nanosecond":
374
- return new arrow.TimeNanosecond();
375
- case "timestamp-second":
376
- return new arrow.TimestampSecond();
377
- case "timestamp-millisecond":
378
- return new arrow.TimestampMillisecond();
379
- case "timestamp-microsecond":
380
- return new arrow.TimestampMicrosecond();
381
- case "timestamp-nanosecond":
382
- return new arrow.TimestampNanosecond();
383
- case "interval-daytime":
384
- return new arrow.IntervalDayTime();
385
- case "interval-yearmonth":
386
- return new arrow.IntervalYearMonth();
387
- default:
388
- throw new Error("array type not supported");
389
- }
390
- }
391
- function getOptionalArrowConstructor(typeName) {
392
- return arrow[typeName];
393
- }
394
- function isArrowViewType(arrowType, viewTypeName) {
395
- const constructor = getOptionalArrowConstructor(viewTypeName);
396
- if (constructor && arrowType instanceof constructor) {
397
- return true;
398
- }
399
- const guards = arrow.DataType;
400
- const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
401
- return Boolean(guard?.(arrowType));
402
- }
403
- function isOptionalArrowType(arrowType, typeName) {
404
- const constructor = getOptionalArrowConstructor(typeName);
405
- return Boolean(constructor && arrowType instanceof constructor);
406
- }
407
- function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
408
- const viewTypeMode = options?.viewTypes || "never";
409
- if (viewTypeMode === "never") {
410
- return fallbackType;
411
- }
412
- const constructor = getOptionalArrowConstructor(viewTypeName);
413
- if (constructor) {
414
- return new constructor();
415
- }
416
- if (viewTypeMode === "require") {
417
- throw new Error(
418
- `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
419
- );
420
- }
421
- return fallbackType;
422
- }
423
- function makeRequiredArrowViewType(viewTypeName) {
424
- const constructor = getOptionalArrowConstructor(viewTypeName);
425
- if (!constructor) {
426
- throw new Error(
427
- `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
428
- );
429
- }
430
- return new constructor();
431
- }
432
- function serializeArrowDictionaryKeyType(arrowType) {
433
- if (arrowType instanceof arrow.Int) {
434
- const prefix = arrowType.isSigned ? "int" : "uint";
435
- const keyType = `${prefix}${arrowType.bitWidth}`;
436
- if (isSchemaDictionaryKeyType(keyType)) {
437
- return keyType;
438
- }
439
- }
440
- switch (arrowType.constructor) {
441
- case arrow.Int8:
442
- return "int8";
443
- case arrow.Int16:
444
- return "int16";
445
- case arrow.Int32:
446
- return "int32";
447
- case arrow.Uint8:
448
- return "uint8";
449
- case arrow.Uint16:
450
- return "uint16";
451
- case arrow.Uint32:
452
- return "uint32";
453
- default:
454
- throw new Error(`arrow dictionary index type not supported: ${arrowType.constructor.name}`);
455
- }
456
- }
457
- function isSchemaDictionaryKeyType(keyType) {
458
- return ["int8", "int16", "int32", "uint8", "uint16", "uint32"].includes(keyType);
459
- }
460
- function deserializeArrowDictionaryKeyType(keyType) {
461
- switch (keyType) {
462
- case "int8":
463
- return new arrow.Int8();
464
- case "int16":
465
- return new arrow.Int16();
466
- case "int32":
467
- return new arrow.Int32();
468
- case "uint8":
469
- return new arrow.Uint8();
470
- case "uint16":
471
- return new arrow.Uint16();
472
- case "uint32":
473
- return new arrow.Uint32();
474
- default:
475
- throw new Error(`schema dictionary index type not supported: ${keyType}`);
476
- }
477
- }
478
-
479
- // src/schema-utils/lib/arrow/split-arrow-buffers.ts
480
- var arrow2 = __toESM(require("apache-arrow"), 1);
481
- function splitArrowBuffers(input, options = {}) {
482
- const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
483
- if (isArrowTable(input)) {
484
- return splitArrowTableBuffersInternal(input, context);
485
- }
486
- if (isArrowRecordBatch(input)) {
487
- return splitArrowRecordBatchBuffers(input, context);
488
- }
489
- if (isArrowVector(input)) {
490
- return splitArrowVectorBuffers(input, context);
491
- }
492
- return splitArrowDataBuffers(input, context);
493
- }
494
- function splitArrowTableBuffers(table, options) {
495
- return splitArrowBuffers(table, options);
496
- }
497
- function isArrowTable(input) {
498
- return "batches" in input;
499
- }
500
- function isArrowRecordBatch(input) {
501
- return "schema" in input && "data" in input && !Array.isArray(input.data);
502
- }
503
- function isArrowVector(input) {
504
- return "data" in input && Array.isArray(input.data);
505
- }
506
- function splitArrowTableBuffersInternal(table, options) {
507
- const recordBatches = table.batches.map(
508
- (recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
509
- );
510
- return new arrow2.Table(table.schema, recordBatches);
511
- }
512
- function splitArrowRecordBatchBuffers(recordBatch, options) {
513
- return new arrow2.RecordBatch(
514
- recordBatch.schema,
515
- splitArrowDataBuffers(recordBatch.data, options)
516
- );
517
- }
518
- function splitArrowDataBuffers(data, options) {
519
- const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
520
- const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
521
- const buffers = {
522
- [arrow2.BufferType.OFFSET]: splitArrowBuffer(data.buffers[arrow2.BufferType.OFFSET], options),
523
- [arrow2.BufferType.DATA]: splitArrowBuffer(data.buffers[arrow2.BufferType.DATA], options),
524
- [arrow2.BufferType.VALIDITY]: splitArrowBuffer(data.buffers[arrow2.BufferType.VALIDITY], options),
525
- [arrow2.BufferType.TYPE]: splitArrowBuffer(data.buffers[arrow2.BufferType.TYPE], options)
526
- };
527
- return new arrow2.Data(
528
- data.type,
529
- data.offset,
530
- data.length,
531
- // @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
532
- data._nullCount,
533
- buffers,
534
- children,
535
- dictionary
536
- );
537
- }
538
- function splitArrowVectorBuffers(vector, options) {
539
- return new arrow2.Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
540
- }
541
- function splitArrowBuffer(array, options) {
542
- if (!isArrowTypedArray(array)) {
543
- return array;
544
- }
545
- if (options.copy === "none") {
546
- return array;
547
- }
548
- if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
549
- return array;
550
- }
551
- let copy = options.copies.get(array);
552
- if (!copy) {
553
- copy = array.slice();
554
- options.copies.set(array, copy);
555
- }
556
- return copy;
557
- }
558
- function isArrowTypedArray(value) {
559
- return ArrayBuffer.isView(value) && !(value instanceof DataView);
560
- }
561
-
562
- // src/schema-utils/lib/arrow/arrow-table-transport.ts
563
- function dehydrateArrowTable(table, options) {
564
- const splitTable = splitArrowBuffers(table, options);
565
- return {
566
- shape: "arrow-table",
567
- transport: "arrow-js",
568
- schema: serializeArrowSchema(splitTable.schema),
569
- batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
570
- };
571
- }
572
- function hydrateArrowTable(table) {
573
- const schema = deserializeArrowSchema(table.schema);
574
- const recordBatches = table.batches.map(
575
- (recordBatch) => new arrow3.RecordBatch(schema, hydrateArrowData(recordBatch.data))
576
- );
577
- return new arrow3.Table(schema, recordBatches);
578
- }
579
- function serializeArrowTableToIPC(table) {
580
- return {
581
- shape: "arrow-table",
582
- transport: "arrow-ipc",
583
- data: arrow3.tableToIPC(table)
584
- };
585
- }
586
- function deserializeArrowTableFromIPC(table) {
587
- const data = isSerializedArrowTableIPC(table) ? table.data : table;
588
- return arrow3.tableFromIPC(data);
589
- }
590
- function serializeArrowWorkerTable(result) {
591
- if (!isArrowTableWrapper(result)) {
592
- throw new Error("Workers require Arrow table output");
593
- }
594
- const { data, ...metadata } = result;
595
- return {
596
- ...structuredClone(metadata),
597
- data: dehydrateArrowTable(data, { copy: "all" })
598
- };
599
- }
600
- function deserializeArrowWorkerTable(result) {
601
- if (!isDehydratedArrowTableWrapper(result)) {
602
- throw new Error("Workers require Arrow column transport");
603
- }
604
- return { ...result, data: hydrateArrowTable(result.data) };
605
- }
606
- function serializeArrowWorkerResult(result, options) {
607
- if (!isArrowTableWrapper(result)) {
608
- return result;
609
- }
610
- const workerOptions = options;
611
- const bufferCopyMode = workerOptions?.core?.workerTransferBufferCopy ?? workerOptions?.workerTransferBufferCopy;
612
- return {
613
- ...result,
614
- data: dehydrateArrowTable(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
615
- };
616
- }
617
- function deserializeArrowWorkerResult(result) {
618
- if (!isDehydratedArrowTableWrapper(result)) {
619
- return result;
620
- }
621
- return { ...result, data: hydrateArrowTable(result.data) };
622
- }
623
- function isArrowTableWrapper(value) {
624
- const table = value;
625
- return Boolean(
626
- table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
627
- );
628
- }
629
- function isDehydratedArrowTableWrapper(value) {
630
- const table = value;
631
- return Boolean(
632
- table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
633
- );
634
- }
635
- function dehydrateArrowRecordBatch(recordBatch) {
636
- return { data: dehydrateArrowData(recordBatch.data) };
637
- }
638
- function dehydrateArrowData(data) {
639
- return {
640
- type: serializeArrowType(data.type),
641
- offset: data.offset,
642
- length: data.length,
643
- // @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
644
- nullCount: data._nullCount,
645
- buffers: {
646
- [arrow3.BufferType.OFFSET]: data.buffers[arrow3.BufferType.OFFSET],
647
- [arrow3.BufferType.DATA]: data.buffers[arrow3.BufferType.DATA],
648
- [arrow3.BufferType.VALIDITY]: data.buffers[arrow3.BufferType.VALIDITY],
649
- [arrow3.BufferType.TYPE]: data.buffers[arrow3.BufferType.TYPE]
650
- },
651
- children: data.children.map((childData) => dehydrateArrowData(childData)),
652
- dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
653
- };
654
- }
655
- function dehydrateArrowVector(vector) {
656
- return { data: vector.data.map((data) => dehydrateArrowData(data)) };
657
- }
658
- function hydrateArrowData(data) {
659
- const children = data.children.map((childData) => hydrateArrowData(childData));
660
- const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
661
- return new arrow3.Data(
662
- deserializeArrowType(data.type),
663
- data.offset,
664
- data.length,
665
- data.nullCount,
666
- data.buffers,
667
- children,
668
- dictionary
669
- );
670
- }
671
- function hydrateArrowVector(vector) {
672
- return new arrow3.Vector(vector.data.map((data) => hydrateArrowData(data)));
673
- }
674
- function isSerializedArrowTableIPC(value) {
675
- return Boolean(
676
- value && typeof value === "object" && value.shape === "arrow-table" && value.transport === "arrow-ipc"
677
- );
678
- }
679
- // Annotate the CommonJS export names for ESM import in node:
680
- 0 && (module.exports = {
681
- dehydrateArrowTable,
682
- deserializeArrowTableFromIPC,
683
- deserializeArrowWorkerResult,
684
- deserializeArrowWorkerTable,
685
- hydrateArrowTable,
686
- serializeArrowTableToIPC,
687
- serializeArrowWorkerResult,
688
- serializeArrowWorkerTable,
689
- splitArrowBuffers,
690
- splitArrowTableBuffers
691
- });