@loaders.gl/core 5.0.0-beta.10 → 5.0.0-beta.11

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 (313) hide show
  1. package/SCAN-README.md +2 -2
  2. package/dist/arrow-geometry/feature-collection-to-arrow.cjs +1 -5
  3. package/dist/arrow-geometry/feature-collection-to-arrow.cjs.map +2 -2
  4. package/dist/arrow-geometry/feature-collection-to-arrow.d.ts +4 -3
  5. package/dist/arrow-geometry/feature-collection-to-arrow.d.ts.map +1 -1
  6. package/dist/arrow-geometry/feature-collection-to-arrow.js +2 -6
  7. package/dist/arrow-geometry/feature-collection-to-arrow.js.map +1 -1
  8. package/dist/arrow-geometry/feature-table.cjs +2 -10
  9. package/dist/arrow-geometry/feature-table.cjs.map +2 -2
  10. package/dist/arrow-geometry/feature-table.d.ts +6 -5
  11. package/dist/arrow-geometry/feature-table.d.ts.map +1 -1
  12. package/dist/arrow-geometry/feature-table.js +5 -13
  13. package/dist/arrow-geometry/feature-table.js.map +1 -1
  14. package/dist/arrow-geometry/wkb-arrow-utils.cjs +1 -5
  15. package/dist/arrow-geometry/wkb-arrow-utils.cjs.map +2 -2
  16. package/dist/arrow-geometry/wkb-arrow-utils.d.ts +7 -7
  17. package/dist/arrow-geometry/wkb-arrow-utils.d.ts.map +1 -1
  18. package/dist/arrow-geometry/wkb-arrow-utils.js +4 -8
  19. package/dist/arrow-geometry/wkb-arrow-utils.js.map +1 -1
  20. package/dist/arrow-worker-transport.cjs +7 -75
  21. package/dist/arrow-worker-transport.cjs.map +1 -1
  22. package/dist/arrow-worker-transport.d.ts +3 -7
  23. package/dist/arrow-worker-transport.d.ts.map +1 -1
  24. package/dist/arrow-worker-transport.js +15 -89
  25. package/dist/arrow-worker-transport.js.map +1 -1
  26. package/dist/cluster-source.cjs +12 -12
  27. package/dist/cluster-source.cjs.map +1 -1
  28. package/dist/dist.dev.js +71 -60
  29. package/dist/dist.min.js +3 -3
  30. package/dist/federated-table-scan-source.cjs +87 -125
  31. package/dist/federated-table-scan-source.cjs.map +2 -2
  32. package/dist/geoarrow/clustering/cluster-source.cjs +12 -12
  33. package/dist/geoarrow/clustering/cluster-source.cjs.map +2 -2
  34. package/dist/geoarrow/clustering/cluster-source.d.ts +3 -2
  35. package/dist/geoarrow/clustering/cluster-source.d.ts.map +1 -1
  36. package/dist/geoarrow/clustering/cluster-source.js +12 -14
  37. package/dist/geoarrow/clustering/cluster-source.js.map +1 -1
  38. package/dist/geoarrow/convert-table-to-geoarrow.cjs +4 -12
  39. package/dist/geoarrow/convert-table-to-geoarrow.cjs.map +2 -2
  40. package/dist/geoarrow/convert-table-to-geoarrow.d.ts +5 -5
  41. package/dist/geoarrow/convert-table-to-geoarrow.d.ts.map +1 -1
  42. package/dist/geoarrow/convert-table-to-geoarrow.js +6 -14
  43. package/dist/geoarrow/convert-table-to-geoarrow.js.map +1 -1
  44. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.cjs +1 -1
  45. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.cjs.map +2 -2
  46. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.js +2 -2
  47. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.js.map +1 -1
  48. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.cjs +2 -3
  49. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.cjs.map +2 -2
  50. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts +3 -3
  51. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts.map +1 -1
  52. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.js +2 -3
  53. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.js.map +1 -1
  54. package/dist/geoarrow/geoarrow-stream.cjs +10 -11
  55. package/dist/geoarrow/geoarrow-stream.cjs.map +2 -2
  56. package/dist/geoarrow/geoarrow-stream.d.ts +2 -2
  57. package/dist/geoarrow/geoarrow-stream.d.ts.map +1 -1
  58. package/dist/geoarrow/geoarrow-stream.js +9 -12
  59. package/dist/geoarrow/geoarrow-stream.js.map +1 -1
  60. package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.cjs.map +1 -1
  61. package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.js +3 -3
  62. package/dist/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.js.map +1 -1
  63. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.cjs.map +2 -2
  64. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.d.ts +5 -2
  65. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.d.ts.map +1 -1
  66. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.js.map +1 -1
  67. package/dist/index.cjs +69 -54
  68. package/dist/index.cjs.map +3 -3
  69. package/dist/index.d.ts +1 -1
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +1 -1
  72. package/dist/index.js.map +1 -1
  73. package/dist/lib/api/load.d.ts.map +1 -1
  74. package/dist/lib/api/load.js +2 -4
  75. package/dist/lib/api/load.js.map +1 -1
  76. package/dist/lib/api/loader-options.d.ts +6 -0
  77. package/dist/lib/api/loader-options.d.ts.map +1 -1
  78. package/dist/lib/api/loader-options.js +48 -0
  79. package/dist/lib/api/loader-options.js.map +1 -1
  80. package/dist/lib/api/parse-file.d.ts.map +1 -1
  81. package/dist/lib/api/parse-file.js +2 -5
  82. package/dist/lib/api/parse-file.js.map +1 -1
  83. package/dist/lib/api/parse-in-batches.js +6 -10
  84. package/dist/lib/api/parse-in-batches.js.map +1 -1
  85. package/dist/lib/api/parse-sync.d.ts.map +1 -1
  86. package/dist/lib/api/parse-sync.js +2 -5
  87. package/dist/lib/api/parse-sync.js.map +1 -1
  88. package/dist/lib/api/parse.d.ts.map +1 -1
  89. package/dist/lib/api/parse.js +2 -5
  90. package/dist/lib/api/parse.js.map +1 -1
  91. package/dist/lib/init.js +1 -1
  92. package/dist/lib/loader-utils/native-arrow.d.ts +5 -8
  93. package/dist/lib/loader-utils/native-arrow.d.ts.map +1 -1
  94. package/dist/lib/loader-utils/native-arrow.js +13 -31
  95. package/dist/lib/loader-utils/native-arrow.js.map +1 -1
  96. package/dist/loader-utils/index.cjs +27 -22
  97. package/dist/loader-utils/index.cjs.map +1 -1
  98. package/dist/loader-utils/index.d.ts +1 -1
  99. package/dist/loader-utils/index.d.ts.map +1 -1
  100. package/dist/loader-utils/index.js +1 -1
  101. package/dist/loader-utils/index.js.map +1 -1
  102. package/dist/loader-utils/json-loader.js +1 -1
  103. package/dist/loader-utils/lib/log-utils/log.js +1 -1
  104. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts +6 -2
  105. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts.map +1 -1
  106. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js +1 -0
  107. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js.map +1 -1
  108. package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts +15 -12
  109. package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts.map +1 -1
  110. package/dist/loader-utils/lib/scan-utils/table-scan-batch.js +36 -22
  111. package/dist/loader-utils/lib/scan-utils/table-scan-batch.js.map +1 -1
  112. package/dist/loader-utils/lib/sources/table-source-collection.d.ts +2 -1
  113. package/dist/loader-utils/lib/sources/table-source-collection.d.ts.map +1 -1
  114. package/dist/loader-utils/lib/sources/vector-tile-source.d.ts +3 -3
  115. package/dist/loader-utils/lib/sources/vector-tile-source.d.ts.map +1 -1
  116. package/dist/loader-utils/loader-types.d.ts +3 -5
  117. package/dist/loader-utils/loader-types.d.ts.map +1 -1
  118. package/dist/null-loader.js +1 -1
  119. package/dist/null-worker-node.js +1 -1
  120. package/dist/null-worker.js +1 -1
  121. package/dist/scan/arrow-execution/expressions.cjs +4 -4
  122. package/dist/scan/arrow-execution/expressions.cjs.map +2 -2
  123. package/dist/scan/arrow-execution/expressions.d.ts +4 -4
  124. package/dist/scan/arrow-execution/expressions.d.ts.map +1 -1
  125. package/dist/scan/arrow-execution/expressions.js +4 -4
  126. package/dist/scan/arrow-execution/expressions.js.map +1 -1
  127. package/dist/scan/arrow-query-worker-entry.cjs +121 -0
  128. package/dist/scan/arrow-query-worker-entry.cjs.map +7 -0
  129. package/dist/scan/arrow-query-worker-entry.d.ts +2 -0
  130. package/dist/scan/arrow-query-worker-entry.d.ts.map +1 -0
  131. package/dist/scan/arrow-query-worker-entry.js +7 -0
  132. package/dist/scan/arrow-query-worker-entry.js.map +1 -0
  133. package/dist/scan/arrow-query-worker.cjs +197 -0
  134. package/dist/scan/arrow-query-worker.cjs.map +7 -0
  135. package/dist/scan/arrow-query-worker.d.ts +47 -0
  136. package/dist/scan/arrow-query-worker.d.ts.map +1 -0
  137. package/dist/scan/arrow-query-worker.js +101 -0
  138. package/dist/scan/arrow-query-worker.js.map +1 -0
  139. package/dist/scan/federated-table-scan-source.cjs +12 -13
  140. package/dist/scan/federated-table-scan-source.cjs.map +2 -2
  141. package/dist/scan/federated-table-scan-source.d.ts.map +1 -1
  142. package/dist/scan/federated-table-scan-source.js +14 -15
  143. package/dist/scan/federated-table-scan-source.js.map +1 -1
  144. package/dist/scan/index.cjs +5 -2
  145. package/dist/scan/index.cjs.map +2 -2
  146. package/dist/scan/index.d.ts +2 -1
  147. package/dist/scan/index.d.ts.map +1 -1
  148. package/dist/scan/index.js +2 -1
  149. package/dist/scan/index.js.map +1 -1
  150. package/dist/scan/parse-sql-predicate.cjs +2 -2
  151. package/dist/scan/parse-sql-predicate.cjs.map +2 -2
  152. package/dist/scan/parse-sql-predicate.js +1 -1
  153. package/dist/scan/parse-sql-predicate.js.map +1 -1
  154. package/dist/scan/query-pushdown.cjs +6 -6
  155. package/dist/scan/query-pushdown.cjs.map +2 -2
  156. package/dist/scan/query-pushdown.d.ts +1 -1
  157. package/dist/scan/query-pushdown.d.ts.map +1 -1
  158. package/dist/scan/query-pushdown.js +3 -6
  159. package/dist/scan/query-pushdown.js.map +1 -1
  160. package/dist/scan/query-scales.cjs +140 -0
  161. package/dist/scan/query-scales.cjs.map +7 -0
  162. package/dist/scan/query-scales.d.ts +35 -0
  163. package/dist/scan/query-scales.d.ts.map +1 -0
  164. package/dist/scan/query-scales.js +120 -0
  165. package/dist/scan/query-scales.js.map +1 -0
  166. package/dist/scan/query.cjs +49 -45
  167. package/dist/scan/query.cjs.map +2 -2
  168. package/dist/scan/query.d.ts +7 -4
  169. package/dist/scan/query.d.ts.map +1 -1
  170. package/dist/scan/query.js +35 -52
  171. package/dist/scan/query.js.map +1 -1
  172. package/dist/scan/vector-table-scan-source.cjs +19 -13
  173. package/dist/scan/vector-table-scan-source.cjs.map +3 -3
  174. package/dist/scan/vector-table-scan-source.d.ts +3 -4
  175. package/dist/scan/vector-table-scan-source.d.ts.map +1 -1
  176. package/dist/scan/vector-table-scan-source.js +11 -12
  177. package/dist/scan/vector-table-scan-source.js.map +1 -1
  178. package/dist/schema/categories/category-mesh.d.ts +3 -10
  179. package/dist/schema/categories/category-mesh.d.ts.map +1 -1
  180. package/dist/schema/categories/category-mesh.js.map +1 -1
  181. package/dist/schema/categories/category-table.d.ts +2 -19
  182. package/dist/schema/categories/category-table.d.ts.map +1 -1
  183. package/dist/schema/geometry/arrow-binary-features.d.ts +1 -1
  184. package/dist/schema/geometry/arrow-binary-features.d.ts.map +1 -1
  185. package/dist/schema/index.cjs.map +1 -1
  186. package/dist/schema/index.d.ts +2 -2
  187. package/dist/schema/index.d.ts.map +1 -1
  188. package/dist/schema/index.js.map +1 -1
  189. package/dist/schema/types/batch.d.ts +0 -4
  190. package/dist/schema/types/batch.d.ts.map +1 -1
  191. package/dist/schema-utils/index.cjs +419 -502
  192. package/dist/schema-utils/index.cjs.map +3 -3
  193. package/dist/schema-utils/index.d.ts +4 -5
  194. package/dist/schema-utils/index.d.ts.map +1 -1
  195. package/dist/schema-utils/index.js +4 -5
  196. package/dist/schema-utils/index.js.map +1 -1
  197. package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts +4 -5
  198. package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts.map +1 -1
  199. package/dist/schema-utils/lib/arrow/arrow-metadata.js +21 -18
  200. package/dist/schema-utils/lib/arrow/arrow-metadata.js.map +1 -1
  201. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts +6 -11
  202. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts.map +1 -1
  203. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js +8 -21
  204. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js.map +1 -1
  205. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts +4 -4
  206. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts.map +1 -1
  207. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js +13 -15
  208. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js.map +1 -1
  209. package/dist/schema-utils/lib/mesh/point-cloud-tiler.d.ts +2 -2
  210. package/dist/schema-utils/lib/mesh/point-cloud-tiler.d.ts.map +1 -1
  211. package/dist/schema-utils/lib/mesh/point-cloud-tiler.js +1 -1
  212. package/dist/schema-utils/lib/mesh/point-cloud-tiler.js.map +1 -1
  213. package/dist/schema-utils/lib/schema/deduce-table-schema.d.ts +2 -1
  214. package/dist/schema-utils/lib/schema/deduce-table-schema.d.ts.map +1 -1
  215. package/dist/schema-utils/lib/schema/deduce-table-schema.js +3 -1
  216. package/dist/schema-utils/lib/schema/deduce-table-schema.js.map +1 -1
  217. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.d.ts +6 -5
  218. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.d.ts.map +1 -1
  219. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.js +6 -5
  220. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.js.map +1 -1
  221. package/dist/schema-utils/lib/table/batches/convert-batches.d.ts.map +1 -1
  222. package/dist/schema-utils/lib/table/batches/convert-batches.js +5 -8
  223. package/dist/schema-utils/lib/table/batches/convert-batches.js.map +1 -1
  224. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts +1 -1
  225. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts.map +1 -1
  226. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js +2 -6
  227. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js.map +1 -1
  228. package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts +1 -1
  229. package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts.map +1 -1
  230. package/dist/schema-utils/lib/table/batches/make-table-from-batches.js +4 -24
  231. package/dist/schema-utils/lib/table/batches/make-table-from-batches.js.map +1 -1
  232. package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts +3 -6
  233. package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts.map +1 -1
  234. package/dist/schema-utils/lib/table/tables/convert-arrow-table.js +6 -57
  235. package/dist/schema-utils/lib/table/tables/convert-arrow-table.js.map +1 -1
  236. package/dist/schema-utils/lib/table/tables/make-table.js +2 -2
  237. package/dist/schema-utils/lib/table/tables/make-table.js.map +1 -1
  238. package/dist/schema-utils/lib/table/tables/table-accessors.d.ts.map +1 -1
  239. package/dist/schema-utils/lib/table/tables/table-accessors.js +2 -16
  240. package/dist/schema-utils/lib/table/tables/table-accessors.js.map +1 -1
  241. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts +2 -2
  242. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts.map +1 -1
  243. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js +4 -4
  244. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js.map +1 -1
  245. package/dist/schema-utils/lib/table/tables/table-types.d.ts +1 -3
  246. package/dist/schema-utils/lib/table/tables/table-types.d.ts.map +1 -1
  247. package/dist/schema-utils/lib/table/tables/table-types.js +0 -4
  248. package/dist/schema-utils/lib/table/tables/table-types.js.map +1 -1
  249. package/dist/vector-table-scan-source.cjs +16 -10
  250. package/dist/vector-table-scan-source.cjs.map +2 -2
  251. package/dist/worker-utils/index.cjs +2 -2
  252. package/dist/worker-utils/lib/env-utils/version.js +1 -1
  253. package/package.json +23 -8
  254. package/src/arrow-geometry/feature-collection-to-arrow.ts +5 -8
  255. package/src/arrow-geometry/feature-table.ts +8 -21
  256. package/src/arrow-geometry/wkb-arrow-utils.ts +8 -12
  257. package/src/arrow-worker-transport.ts +21 -120
  258. package/src/geoarrow/clustering/cluster-source.ts +16 -23
  259. package/src/geoarrow/convert-table-to-geoarrow.ts +11 -23
  260. package/src/geoarrow/geoarrow-converter/convert-geoarrow.ts +2 -2
  261. package/src/geoarrow/geoarrow-converter/geoarrow-converter.ts +2 -4
  262. package/src/geoarrow/geoarrow-stream.ts +15 -15
  263. package/src/geoarrow/lib/feature-collection-converters/convert-arrow-binary-feature-collection.ts +3 -3
  264. package/src/geoarrow/lib/table-converters/convert-geoarrow-table.ts +7 -5
  265. package/src/index.ts +1 -1
  266. package/src/lib/api/load.ts +2 -12
  267. package/src/lib/api/loader-options.ts +69 -0
  268. package/src/lib/api/parse-file.ts +2 -11
  269. package/src/lib/api/parse-in-batches.ts +8 -12
  270. package/src/lib/api/parse-sync.ts +3 -7
  271. package/src/lib/api/parse.ts +2 -6
  272. package/src/lib/loader-utils/native-arrow.ts +12 -38
  273. package/src/loader-utils/index.ts +0 -1
  274. package/src/loader-utils/lib/scan-utils/scan-query-metadata.ts +7 -6
  275. package/src/loader-utils/lib/scan-utils/table-scan-batch.ts +64 -41
  276. package/src/loader-utils/lib/sources/table-source-collection.ts +2 -1
  277. package/src/loader-utils/lib/sources/vector-tile-source.ts +3 -9
  278. package/src/loader-utils/loader-types.ts +3 -3
  279. package/src/scan/arrow-execution/expressions.ts +7 -7
  280. package/src/scan/arrow-query-worker-entry.ts +8 -0
  281. package/src/scan/arrow-query-worker.ts +158 -0
  282. package/src/scan/federated-table-scan-source.ts +15 -18
  283. package/src/scan/index.ts +7 -1
  284. package/src/scan/parse-sql-predicate.ts +1 -1
  285. package/src/scan/query-pushdown.ts +7 -7
  286. package/src/scan/query-scales.ts +199 -0
  287. package/src/scan/query.ts +68 -71
  288. package/src/scan/vector-table-scan-source.ts +16 -21
  289. package/src/schema/categories/category-mesh.ts +3 -11
  290. package/src/schema/categories/category-table.ts +2 -28
  291. package/src/schema/geometry/arrow-binary-features.ts +1 -1
  292. package/src/schema/index.ts +1 -3
  293. package/src/schema/types/batch.ts +0 -5
  294. package/src/schema-utils/index.ts +4 -10
  295. package/src/schema-utils/lib/arrow/arrow-metadata.ts +33 -30
  296. package/src/schema-utils/lib/mesh/convert-mesh-to-table.ts +12 -38
  297. package/src/schema-utils/lib/mesh/convert-table-to-mesh.ts +15 -18
  298. package/src/schema-utils/lib/mesh/point-cloud-tiler.ts +4 -13
  299. package/src/schema-utils/lib/schema/deduce-table-schema.ts +4 -2
  300. package/src/schema-utils/lib/table/arrow-api/arrow-like-table.ts +10 -9
  301. package/src/schema-utils/lib/table/batches/convert-batches.ts +5 -8
  302. package/src/schema-utils/lib/table/batches/make-arrow-batch-iterator.ts +2 -6
  303. package/src/schema-utils/lib/table/batches/make-table-from-batches.ts +5 -27
  304. package/src/schema-utils/lib/table/tables/convert-arrow-table.ts +9 -72
  305. package/src/schema-utils/lib/table/tables/make-table.ts +2 -2
  306. package/src/schema-utils/lib/table/tables/table-accessors.ts +2 -22
  307. package/src/schema-utils/lib/table/tables/table-converter/table-converter.ts +6 -6
  308. package/src/schema-utils/lib/table/tables/table-types.ts +1 -7
  309. package/dist/schema-utils/lib/table/tables/convert-arrow-table-wrapper.d.ts +0 -27
  310. package/dist/schema-utils/lib/table/tables/convert-arrow-table-wrapper.d.ts.map +0 -1
  311. package/dist/schema-utils/lib/table/tables/convert-arrow-table-wrapper.js +0 -23
  312. package/dist/schema-utils/lib/table/tables/convert-arrow-table-wrapper.js.map +0 -1
  313. package/src/schema-utils/lib/table/tables/convert-arrow-table-wrapper.ts +0 -54
@@ -3,22 +3,11 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {getFloat16Storage, isNativeFloat16Array} from '@loaders.gl/core/schema';
6
- import type {
7
- BigTypedArray,
8
- Mesh,
9
- MeshAttribute,
10
- MeshArrowTable,
11
- MeshTable,
12
- Schema
13
- } from '@loaders.gl/core/schema';
6
+ import type {BigTypedArray, Mesh, MeshAttribute, MeshTable, Schema} from '@loaders.gl/core/schema';
14
7
  import {indexedMeshArrowSchema, meshArrowSchema} from '@loaders.gl/core/schema';
15
8
  import * as arrow from 'apache-arrow';
16
9
  import {getFixedSizeListVector} from '../arrow-utils/arrow-fixed-size-list-utils';
17
- import {
18
- deserializeArrowField,
19
- deserializeArrowMetadata,
20
- serializeArrowSchema
21
- } from '../schema/convert-arrow-schema';
10
+ import {deserializeArrowField, deserializeArrowMetadata} from '../schema/convert-arrow-schema';
22
11
 
23
12
  /** Arrow column inputs, including exact 64-bit integers that are not GPU attributes. */
24
13
  export type MeshArrowAttributes = Record<
@@ -71,7 +60,7 @@ export function convertMeshToTable(
71
60
  case 'columnar-table':
72
61
  return convertMeshToColumnarTable(mesh);
73
62
  case 'arrow':
74
- return convertMeshToArrowTableWrapper(mesh).data;
63
+ return convertMeshToArrowTable(mesh);
75
64
  default:
76
65
  throw new Error(shape);
77
66
  }
@@ -99,13 +88,8 @@ export function convertMeshToColumnarTable(mesh: Mesh): MeshTable {
99
88
  };
100
89
  }
101
90
 
102
- /**
103
- * Convert a loaders.gl Mesh to a legacy Arrow mesh wrapper for existing mesh consumers.
104
- * @param mesh Mesh to convert.
105
- * @param batchSize Reserved for future chunked Arrow conversion.
106
- * @returns Mesh data as an Apache Arrow table wrapper.
107
- */
108
- export function convertMeshToArrowTableWrapper(mesh: Mesh, batchSize?: number): MeshArrowTable {
91
+ /** Builds a native Apache Arrow mesh table, including topology, indices, and bounds. */
92
+ export function convertMeshToArrowTable(mesh: Mesh): arrow.Table {
109
93
  return makeMeshArrowTable(mesh.attributes, {
110
94
  schema: mesh.schema,
111
95
  topology: mesh.topology,
@@ -116,15 +100,15 @@ export function convertMeshToArrowTableWrapper(mesh: Mesh, batchSize?: number):
116
100
  }
117
101
 
118
102
  /**
119
- * Create a MeshArrowTable directly from mesh attribute typed arrays.
103
+ * Creates a native Apache Arrow mesh table from typed attributes.
120
104
  * @param attributes Mesh attributes to expose as Arrow columns.
121
105
  * @param options Mesh table metadata and optional schema.
122
- * @returns Mesh data as an Apache Arrow table wrapper.
106
+ * @returns The Arrow table with mesh topology, bounds, and optional indices.
123
107
  */
124
108
  export function makeMeshArrowTable(
125
109
  attributes: MeshArrowAttributes,
126
110
  options: MeshArrowTableOptions = {}
127
- ): MeshArrowTable {
111
+ ): arrow.Table {
128
112
  const fields: arrow.Field[] = [];
129
113
  const columns: {[columnName: string]: arrow.Vector} = {};
130
114
  const attributeNames = getOrderedAttributeNames(attributes);
@@ -139,7 +123,7 @@ export function makeMeshArrowTable(
139
123
  getAttributeArrowField(options.schema, attributeName, column, attribute.componentType)
140
124
  );
141
125
 
142
- if (attributeName === 'POSITION' && options.indices?.value?.length) {
126
+ if (attributeName === attributeNames[0] && options.indices?.value?.length) {
143
127
  const indicesField = indexedMeshArrowSchema.fields.find(field => field.name === 'indices')!;
144
128
  columns.indices = getIndicesVector(options.indices.value, column.length, indicesField.type);
145
129
  fields.push(indicesField);
@@ -149,19 +133,9 @@ export function makeMeshArrowTable(
149
133
  const arrowSchema = new arrow.Schema(fields, getMeshArrowMetadata(options));
150
134
  // Arrow's column-object constructor synthesizes an incompatible batch schema for empty
151
135
  // fixed-size-list vectors. A schema-only table preserves the declared mesh fields instead.
152
- const table =
153
- columns[attributeNames[0]]?.length === 0
154
- ? new arrow.Table(arrowSchema)
155
- : new arrow.Table(arrowSchema, columns);
156
- const schema = serializeArrowSchema(table.schema);
157
-
158
- return {
159
- shape: 'arrow-table',
160
- schema,
161
- data: table,
162
- topology: options.topology || 'point-list',
163
- indices: options.indices
164
- };
136
+ return columns[attributeNames[0]]?.length === 0
137
+ ? new arrow.Table(arrowSchema)
138
+ : new arrow.Table(arrowSchema, columns);
165
139
  }
166
140
 
167
141
  /** Return an Arrow vector for a mesh attribute. */
@@ -3,11 +3,11 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {createFloat16Array, getFloat16Value, setFloat16Value} from '@loaders.gl/core/schema';
6
- import type {Mesh, MeshAttribute, ColumnarTable, ArrowTable, Schema} from '@loaders.gl/core/schema';
6
+ import type {Mesh, MeshAttribute, ColumnarTable, Schema} from '@loaders.gl/core/schema';
7
7
  import * as arrow from 'apache-arrow';
8
8
  import {getFixedSizeListSize} from '../arrow-utils/arrow-fixed-size-list-utils';
9
9
  import {serializeArrowSchema} from '../schema/convert-arrow-schema';
10
- import {isNativeArrowTable} from '../../../lib/loader-utils/native-arrow';
10
+ import {isArrowTable} from '../../../lib/loader-utils/native-arrow';
11
11
  import {getMeshBoundingBox} from './mesh-utils';
12
12
 
13
13
  /**
@@ -15,26 +15,17 @@ import {getMeshBoundingBox} from './mesh-utils';
15
15
  * @param table Table to convert.
16
16
  * @returns Mesh reconstructed from the table.
17
17
  */
18
- export function convertTableToMesh(table: ColumnarTable | ArrowTable | arrow.Table): Mesh {
19
- if (isNativeArrowTable(table)) return convertArrowTableToMesh(table);
20
- switch (table.shape) {
21
- // case 'columnar-table':
22
- // return convertColumnarTableToMesh(table);
23
- case 'arrow-table':
24
- return convertArrowTableToMesh(table);
25
- default:
26
- throw new Error(table.shape);
27
- }
18
+ export function convertTableToMesh(table: ColumnarTable | arrow.Table): Mesh {
19
+ if (isArrowTable(table)) return convertArrowTableToMesh(table);
20
+ throw new Error(table.shape);
28
21
  }
29
22
 
30
23
  /**
31
24
  * Convert an Apache Arrow mesh table to a loaders.gl Mesh.
32
- * @param table Native Arrow table or legacy table wrapper.
25
+ * @param table Native Arrow table.
33
26
  * @returns Mesh reconstructed from the Arrow table.
34
27
  */
35
- export function convertArrowTableToMesh(table: ArrowTable | arrow.Table): Mesh {
36
- const arrowTable = isNativeArrowTable(table) ? table : table.data;
37
-
28
+ export function convertArrowTableToMesh(arrowTable: arrow.Table): Mesh {
38
29
  const schema = serializeArrowSchema(arrowTable.schema);
39
30
  // Legacy mesh batches describe their own vertices, not the cumulative stream extent.
40
31
  const localBounds =
@@ -185,14 +176,20 @@ function getAttributeTypedArray(attributeData: arrow.Vector, size: number): any
185
176
  return attributeData.toArray();
186
177
  }
187
178
 
188
- const values = attributeData.data[0].children[0].values;
179
+ if (attributeData.length === 0) {
180
+ const EmptyStorage = attributeData.type.valueType.ArrayType;
181
+ return new EmptyStorage(0);
182
+ }
183
+
184
+ const values = attributeData.data.find(chunk => chunk.length > 0)!.children[0].values;
189
185
  const TypedArrayConstructor = values.constructor as any;
190
186
  const typedArray = new TypedArrayConstructor(attributeData.length * size);
191
187
  let targetOffset = 0;
192
188
 
193
189
  for (const data of attributeData.data) {
194
- const child = data.children[0];
195
190
  const sourceLength = data.length * size;
191
+ if (sourceLength === 0) continue;
192
+ const child = data.children[0];
196
193
  const sourceOffset = child.offset || data.offset * size;
197
194
  // Arrow chunks can either slice child values eagerly or retain offsets into the source buffer.
198
195
  const sourceStart = sourceOffset + sourceLength <= child.values.length ? sourceOffset : 0;
@@ -2,13 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import type {
6
- Mesh,
7
- MeshArrowTable,
8
- MeshArrowTableData,
9
- MeshAttribute,
10
- TypedArray
11
- } from '@loaders.gl/core/schema';
5
+ import type {Mesh, MeshArrowTable, MeshAttribute, TypedArray} from '@loaders.gl/core/schema';
12
6
  import {convertTableToMesh} from './convert-table-to-mesh';
13
7
 
14
8
  /** A native-coordinate cube, with minimum and maximum XYZ corners. */
@@ -95,10 +89,7 @@ export class PointCloudTiler {
95
89
  private pointByteLength = 0;
96
90
 
97
91
  /** Starts indexing one decoded point dataset with explicit allocation limits. */
98
- constructor(
99
- input: Mesh | MeshArrowTable | MeshArrowTableData,
100
- options: PointCloudTilerOptions = {}
101
- ) {
92
+ constructor(input: Mesh | MeshArrowTable, options: PointCloudTilerOptions = {}) {
102
93
  this.options = {
103
94
  nodePointLimit: options.nodePointLimit ?? 50_000,
104
95
  maximumDepth: options.maximumDepth ?? 16,
@@ -250,10 +241,10 @@ export class PointCloudTiler {
250
241
  }
251
242
 
252
243
  /** Validates the decoded profile and creates a root cube from finite native coordinates. */
253
- private async initialize(input: Mesh | MeshArrowTable | MeshArrowTableData): Promise<void> {
244
+ private async initialize(input: Mesh | MeshArrowTable): Promise<void> {
254
245
  this.signal.throwIfAborted();
255
246
  if (!('attributes' in input)) {
256
- const table = 'shape' in input ? input.data : input;
247
+ const table = input;
257
248
  const buffers = new Set<ArrayBufferLike>();
258
249
  let arrowBytes = 0;
259
250
  /** Counts retained Arrow buffers and rejects null child values before conversion. */
@@ -4,6 +4,8 @@
4
4
 
5
5
  // Type deduction
6
6
  import type {Schema, Field, ArrayType, Table} from '@loaders.gl/core/schema';
7
+ import type {Table as ArrowTable} from 'apache-arrow';
8
+ import {convertArrowToSchema} from './convert-arrow-schema';
7
9
  import {getDataTypeFromArray, getDataTypeFromValue} from './data-type';
8
10
 
9
11
  /**
@@ -12,7 +14,8 @@ import {getDataTypeFromArray, getDataTypeFromValue} from './data-type';
12
14
  * @param {*} schema
13
15
  * @returns
14
16
  */
15
- export function deduceTableSchema(table: Table): Schema {
17
+ export function deduceTableSchema(table: Table | ArrowTable): Schema {
18
+ if (!('shape' in table)) return convertArrowToSchema(table.schema);
16
19
  switch (table.shape) {
17
20
  case 'array-row-table':
18
21
  case 'object-row-table':
@@ -24,7 +27,6 @@ export function deduceTableSchema(table: Table): Schema {
24
27
  case 'columnar-table':
25
28
  return deduceSchemaFromColumns(table.data);
26
29
 
27
- case 'arrow-table':
28
30
  default:
29
31
  throw new Error('Deduce schema');
30
32
  }
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
+ import type * as arrow from 'apache-arrow';
5
6
  import type {Table} from '@loaders.gl/core/schema';
6
7
 
7
8
  import {ArrowLikeSchema} from './arrow-like-schema';
@@ -20,10 +21,10 @@ import {
20
21
  } from '../tables/table-accessors';
21
22
 
22
23
  class ArrowLikeVector {
23
- table: Table;
24
+ table: Table | arrow.Table;
24
25
  columnName: string;
25
26
 
26
- constructor(table: Table, columnName: string) {
27
+ constructor(table: Table | arrow.Table, columnName: string) {
27
28
  this.table = table;
28
29
  this.columnName = columnName;
29
30
  }
@@ -33,10 +34,8 @@ class ArrowLikeVector {
33
34
  }
34
35
 
35
36
  toArray(): ArrayLike<unknown> {
37
+ if (!('shape' in this.table)) return this.table.getChild(this.columnName)?.toArray();
36
38
  switch (this.table.shape) {
37
- case 'arrow-table':
38
- const arrowTable = this.table.data as any;
39
- return arrowTable.getChild(this.columnName)?.toArray();
40
39
  case 'columnar-table':
41
40
  return this.table.data[this.columnName];
42
41
  default:
@@ -51,12 +50,13 @@ class ArrowLikeVector {
51
50
  */
52
51
  export class ArrowLikeTable {
53
52
  schema: ArrowLikeSchema;
54
- table: Table;
53
+ table: Table | arrow.Table;
55
54
 
56
- constructor(table: Table) {
57
- const schema = table.schema || deduceTableSchema(table);
55
+ constructor(table: Table | arrow.Table) {
56
+ const schema =
57
+ 'shape' in table ? table.schema || deduceTableSchema(table) : deduceTableSchema(table);
58
58
  this.schema = new ArrowLikeSchema(schema.fields, schema.metadata);
59
- this.table = {...table, schema};
59
+ this.table = 'shape' in table ? {...table, schema} : table;
60
60
  }
61
61
 
62
62
  // get schema() {
@@ -64,6 +64,7 @@ export class ArrowLikeTable {
64
64
  // }
65
65
 
66
66
  get data() {
67
+ if (!('shape' in this.table)) return this.table;
67
68
  return this.table.shape === 'geojson-table' ? this.table.features : this.table.data;
68
69
  }
69
70
 
@@ -9,7 +9,7 @@ import type {
9
9
  ColumnarTableBatch
10
10
  } from '@loaders.gl/core/schema';
11
11
  import * as arrow from 'apache-arrow';
12
- import {isNativeArrowRecordBatch} from '../../../../lib/loader-utils/native-arrow';
12
+ import {isArrowRecordBatch} from '../../../../lib/loader-utils/native-arrow';
13
13
  import {makeArrowMetadataBatch} from '../../arrow/arrow-metadata';
14
14
  import {convertTable} from '../tables/convert-table';
15
15
 
@@ -21,12 +21,12 @@ export function convertBatch(
21
21
  shape: 'arrow'
22
22
  ): arrow.RecordBatch;
23
23
 
24
- /** Converts one batch. Use convertBatches to expand an Arrow wrapper containing multiple batches. */
24
+ /** Converts one portable batch or returns the supplied native record batch. */
25
25
  export function convertBatch(
26
26
  batch: TableBatch | arrow.RecordBatch,
27
27
  shape: 'object-row-table' | 'array-row-table' | 'columnar-table' | 'arrow'
28
28
  ): TableBatch | arrow.RecordBatch {
29
- if (isNativeArrowRecordBatch(batch)) {
29
+ if (isArrowRecordBatch(batch)) {
30
30
  if (shape === 'arrow') return batch;
31
31
  throw new Error('Convert a native RecordBatch as a table to select a row or column layout');
32
32
  }
@@ -39,9 +39,6 @@ export function convertBatch(
39
39
  return {...batch, ...convertTable(batch, 'columnar-table')};
40
40
  case 'arrow': {
41
41
  const table = convertTable(batch, 'arrow');
42
- if (table.batches.length > 1) {
43
- throw new Error('Use convertBatches to expand multiple Arrow record batches');
44
- }
45
42
  return table.batches[0] ?? makeArrowMetadataBatch(table.schema);
46
43
  }
47
44
  default:
@@ -68,14 +65,14 @@ export function convertBatches(
68
65
 
69
66
  /**
70
67
  * Converts batches in emission order. For Arrow output, yields native record batches,
71
- * expanding wrapped tables and preserving the declared schema of empty inputs.
68
+ * preserving the declared schema of empty inputs.
72
69
  */
73
70
  export async function* convertBatches(
74
71
  batches: Iterable<TableBatch | arrow.RecordBatch> | AsyncIterable<TableBatch | arrow.RecordBatch>,
75
72
  shape: 'object-row-table' | 'array-row-table' | 'columnar-table' | 'arrow'
76
73
  ): AsyncIterableIterator<TableBatch | arrow.RecordBatch> {
77
74
  for await (const batch of batches) {
78
- if (isNativeArrowRecordBatch(batch)) {
75
+ if (isArrowRecordBatch(batch)) {
79
76
  if (shape !== 'arrow') throw new Error('Expected a loaders.gl table batch');
80
77
  yield batch;
81
78
  continue;
@@ -39,18 +39,14 @@ export function* makeArrowRecordBatchIterator(
39
39
  yield* sliceNativeArrowBatches(table, options?.batchSize);
40
40
  return;
41
41
  }
42
- yield* makeWrappedTableRecordBatchIterator(table, options);
42
+ yield* makePortableTableRecordBatchIterator(table, options);
43
43
  }
44
44
 
45
45
  /** Converts loaders.gl table representations to record batches. */
46
- export function* makeWrappedTableRecordBatchIterator(
46
+ export function* makePortableTableRecordBatchIterator(
47
47
  table: Table,
48
48
  options?: {batchSize?: number}
49
49
  ): IterableIterator<arrow.RecordBatch> {
50
- if (table.shape === 'arrow-table') {
51
- yield* sliceNativeArrowBatches(table.data, options?.batchSize);
52
- return;
53
- }
54
50
  const arrowSchema = convertSchemaToArrow(table.schema!);
55
51
 
56
52
  const length = getTableLength(table);
@@ -10,14 +10,9 @@ import type {
10
10
  ArrayRowTable,
11
11
  Feature
12
12
  } from '@loaders.gl/core/schema';
13
- import * as arrow from 'apache-arrow';
14
- import {
15
- makeArrowTableFromBatches,
16
- mergeArrowSchemas,
17
- makeArrowMetadataBatch
18
- } from '../../arrow/arrow-metadata';
19
- import {convertSchemaToArrow, serializeArrowSchema} from '../../schema/convert-arrow-schema';
20
- import {isNativeArrowRecordBatch} from '../../../../lib/loader-utils/native-arrow';
13
+ import type * as arrow from 'apache-arrow';
14
+ import {makeArrowTableFromBatches} from '../../arrow/arrow-metadata';
15
+ import {isArrowRecordBatch} from '../../../../lib/loader-utils/native-arrow';
21
16
  import {getTableLength} from '../tables/table-accessors';
22
17
 
23
18
  /**
@@ -44,13 +39,12 @@ export async function makeTableFromBatches(
44
39
  let shape: Table['shape'] | 'arrow' | null = null;
45
40
  let schema: Schema | undefined;
46
41
  const arrowBatches: arrow.RecordBatch[] = [];
47
- let arrowSchema: arrow.Schema | undefined;
48
42
 
49
43
  for await (const batch of batchIterator) {
50
- const batchShape = isNativeArrowRecordBatch(batch) ? 'arrow' : batch.shape;
44
+ const batchShape = isArrowRecordBatch(batch) ? 'arrow' : batch.shape;
51
45
  shape ??= batchShape;
52
46
  if (shape !== batchShape) throw new Error('Batches must have the same shape');
53
- if (isNativeArrowRecordBatch(batch)) {
47
+ if (isArrowRecordBatch(batch)) {
54
48
  arrowBatches.push(batch);
55
49
  continue;
56
50
  }
@@ -81,17 +75,6 @@ export async function makeTableFromBatches(
81
75
  }
82
76
  break;
83
77
 
84
- case 'arrow-table': {
85
- for (const recordBatch of batch.data.batches) {
86
- arrowSchema = mergeArrowSchemas(arrowSchema, recordBatch.schema);
87
- arrowBatches.push(recordBatch);
88
- }
89
- arrowSchema = mergeArrowSchemas(arrowSchema, batch.data.schema);
90
- if (batch.schema)
91
- arrowSchema = mergeArrowSchemas(arrowSchema, convertSchemaToArrow(batch.schema));
92
- if (batch.data.batches.length === 0) arrowBatches.push(makeArrowMetadataBatch(arrowSchema));
93
- break;
94
- }
95
78
  case 'columnar-table':
96
79
  default:
97
80
  throw new Error('shape');
@@ -105,11 +88,6 @@ export async function makeTableFromBatches(
105
88
  switch (shape) {
106
89
  case 'arrow':
107
90
  return makeArrowTableFromBatches(arrowBatches);
108
- case 'arrow-table': {
109
- const collected = await makeArrowTableFromBatches(arrowBatches);
110
- const data = collected && new arrow.Table(arrowSchema || collected.schema, collected.batches);
111
- return data ? {shape: 'arrow-table', data, schema: serializeArrowSchema(data.schema)} : null;
112
- }
113
91
  case 'array-row-table':
114
92
  return {shape: 'array-row-table', data: arrayRows!, schema};
115
93
 
@@ -15,38 +15,25 @@ import type {
15
15
  import {convertTable} from './convert-table';
16
16
  import {deduceTableSchema} from '../../schema/deduce-table-schema';
17
17
  import {convertArrowToSchema, convertSchemaToArrow} from '../../schema/convert-arrow-schema';
18
- import {makeWrappedTableRecordBatchIterator} from '../batches/make-arrow-batch-iterator';
18
+ import {makePortableTableRecordBatchIterator} from '../batches/make-arrow-batch-iterator';
19
19
 
20
20
  /**
21
21
  * Converts a loaders.gl table to native Arrow and preserves the schema on empty input.
22
- * Native Arrow inputs and legacy wrapped Arrow columns are reused.
22
+ * Native Arrow inputs retain their identity.
23
23
  */
24
24
  export function convertTableToArrow(
25
25
  table: Table | arrow.Table,
26
26
  options?: {batchSize?: number}
27
27
  ): arrow.Table {
28
28
  if (!('shape' in table)) return table;
29
- switch (table.shape) {
30
- case 'arrow-table':
31
- return table.data;
32
-
33
- case 'columnar-table':
34
- // TODO - optimized implementation is possible
35
- // return convertColumnarTableToArrow(table, options);
36
-
37
- // fall through
38
-
39
- default:
40
- const schema = table.schema ?? deduceTableSchema(table);
41
- return new arrow.Table(convertSchemaToArrow(schema), [
42
- ...makeWrappedTableRecordBatchIterator({...table, schema}, options)
43
- ]);
44
- }
29
+ const schema = table.schema ?? deduceTableSchema(table);
30
+ return new arrow.Table(convertSchemaToArrow(schema), [
31
+ ...makePortableTableRecordBatchIterator({...table, schema}, options)
32
+ ]);
45
33
  }
46
34
 
47
35
  /** Loader table layouts produced when converting from Arrow. */
48
- type NonArrowTable = Exclude<Table, {shape: 'arrow-table'}>;
49
- type NonArrowTableShape = NonArrowTable['shape'];
36
+ type NonArrowTableShape = Table['shape'];
50
37
 
51
38
  /**
52
39
  * Convert an Apache Arrow table to a loaders.gl Table
@@ -57,7 +44,7 @@ export function convertArrowToTable(arrow: arrow.Table, shape: 'columnar-table')
57
44
  export function convertArrowToTable(arrow: arrow.Table, shape: 'object-row-table'): ObjectRowTable;
58
45
  export function convertArrowToTable(arrow: arrow.Table, shape: 'array-row-table'): ArrayRowTable;
59
46
  export function convertArrowToTable(arrow: arrow.Table, shape: 'geojson-table'): GeoJSONTable;
60
- export function convertArrowToTable(arrow: arrow.Table, shape: NonArrowTableShape): NonArrowTable;
47
+ export function convertArrowToTable(arrow: arrow.Table, shape: NonArrowTableShape): Table;
61
48
 
62
49
  /**
63
50
  * Convert an Apache Arrow table to a loaders.gl Table
@@ -66,7 +53,7 @@ export function convertArrowToTable(arrow: arrow.Table, shape: NonArrowTableShap
66
53
  export function convertArrowToTable(
67
54
  arrowTable: arrow.Table,
68
55
  shape: NonArrowTableShape | 'arrow'
69
- ): NonArrowTable | arrow.Table {
56
+ ): Table | arrow.Table {
70
57
  switch (shape) {
71
58
  case 'arrow':
72
59
  return arrowTable;
@@ -141,53 +128,3 @@ function convertArrowToGeoJSONTable(arrowTable: arrow.Table): GeoJSONTable {
141
128
  features
142
129
  };
143
130
  }
144
-
145
- // /**
146
- // * Wrap an apache arrow table in a loaders.gl table wrapper.
147
- // * From this additional conversions are available.
148
- // * @param arrowTable
149
- // * @returns
150
- // */
151
- // function convertArrowToArrowTable(arrowTable: arrow.Table): ArrowTable {
152
- // return {
153
- // shape: 'arrow-table',
154
- // schema: convertArrowToSchema(arrowTable.schema),
155
- // data: arrowTable
156
- // };
157
- // }
158
-
159
- // function convertArrowToArrayRowTable(arrowTable: arrow.Table): ArrayRowTable {
160
- // const columnarTable = convertArrowToColumnarTable(arrowTable);
161
- // return convertTable(columnarTable, 'array-row-table');
162
- // }
163
-
164
- // function convertArrowToObjectRowTable(arrowTable: arrow.Table): ObjectRowTable {
165
- // const columnarTable = convertArrowToColumnarTable(arrowTable);
166
- // return convertTable(columnarTable, 'object-row-table');
167
- // }
168
-
169
- // /**
170
- // * Convert an Apache Arrow table to a ColumnarTable
171
- // * @note Currently does not convert schema
172
- // */
173
- // function convertArrowToColumnarTable(arrowTable: arrow.Table): ColumnarTable {
174
- // // TODO - avoid calling `getColumn` on columns we are not interested in?
175
- // // Add options object?
176
-
177
- // const columns: ColumnarTable['data'] = {};
178
-
179
- // for (const field of arrowTable.schema.fields) {
180
- // // This (is intended to) coalesce all record batches into a single typed array
181
- // const arrowColumn = arrowTable.getChild(field.name);
182
- // const values = arrowColumn?.toArray();
183
- // columns[field.name] = values;
184
- // }
185
-
186
- // const schema = convertArrowToSchema(arrowTable.schema);
187
-
188
- // return {
189
- // shape: 'columnar-table',
190
- // schema,
191
- // data: columns
192
- // };
193
- // }
@@ -4,7 +4,7 @@
4
4
 
5
5
  import type * as arrow from 'apache-arrow';
6
6
  import type {Table, ArrayRowTable, ObjectRowTable, ColumnarTable} from '@loaders.gl/core/schema';
7
- import {isNativeArrowTable} from '../../../../lib/loader-utils/native-arrow';
7
+ import {isArrowTable} from '../../../../lib/loader-utils/native-arrow';
8
8
  import {deduceTableSchema} from '../../schema/deduce-table-schema';
9
9
 
10
10
  /**
@@ -17,7 +17,7 @@ export function makeTableFromData(data: {[column: string]: ArrayLike<unknown>}):
17
17
  export function makeTableFromData(data: arrow.Table): arrow.Table;
18
18
 
19
19
  export function makeTableFromData(data: unknown): Table | arrow.Table {
20
- if (isNativeArrowTable(data)) return data;
20
+ if (isArrowTable(data)) return data;
21
21
  let table: Table;
22
22
  switch (getTableShapeFromData(data)) {
23
23
  case 'array-row-table':
@@ -5,13 +5,13 @@
5
5
  /* eslint-disable no-else-return */
6
6
 
7
7
  import type {Table as NativeArrowTable} from 'apache-arrow';
8
- import {isNativeArrowTable} from '../../../../lib/loader-utils/native-arrow';
8
+ import {isArrowTable} from '../../../../lib/loader-utils/native-arrow';
9
9
  import {convertArrowToSchema} from '../../schema/convert-arrow-schema';
10
10
  import type {Table, ArrayRowTable, ObjectRowTable} from '@loaders.gl/core/schema';
11
11
 
12
12
  /** Checks whether a value is a native Arrow table or a loaders.gl table. */
13
13
  export function isTable(table: any): table is Table | NativeArrowTable {
14
- if (isNativeArrowTable(table)) return true;
14
+ if (isArrowTable(table)) return true;
15
15
  const shape = typeof table === 'object' && table?.shape;
16
16
  switch (shape) {
17
17
  case 'array-row-table':
@@ -24,9 +24,6 @@ export function isTable(table: any): table is Table | NativeArrowTable {
24
24
  case 'columnar-table':
25
25
  return Boolean(table.data && typeof table.data === 'object');
26
26
 
27
- case 'arrow-table':
28
- return Boolean(table?.data?.numRows !== undefined);
29
-
30
27
  default:
31
28
  return false;
32
29
  }
@@ -45,9 +42,6 @@ export function getTableLength(table: Table | NativeArrowTable): number {
45
42
  case 'geojson-table':
46
43
  return table.features.length;
47
44
 
48
- case 'arrow-table':
49
- return getTableLength(table.data);
50
-
51
45
  case 'columnar-table':
52
46
  for (const column of Object.values(table.data)) {
53
47
  return column.length || 0;
@@ -79,8 +73,6 @@ export function getTableNumCols(table: Table | NativeArrowTable): number {
79
73
  return Object.keys(table.features[0]).length;
80
74
  case 'columnar-table':
81
75
  return Object.keys(table.data).length;
82
- case 'arrow-table':
83
- return getTableNumCols(table.data);
84
76
 
85
77
  default:
86
78
  throw new Error('table');
@@ -109,9 +101,6 @@ export function getTableCell(
109
101
  const column = table.data[columnName];
110
102
  return column[rowIndex];
111
103
 
112
- case 'arrow-table':
113
- return getTableCell(table.data, rowIndex, columnName);
114
-
115
104
  default:
116
105
  throw new Error('todo');
117
106
  }
@@ -141,9 +130,6 @@ export function getTableCellAt(
141
130
  const column = table.data[columnName3];
142
131
  return column[rowIndex];
143
132
 
144
- case 'arrow-table':
145
- return getTableCellAt(table.data, rowIndex, columnIndex);
146
-
147
133
  default:
148
134
  throw new Error('todo');
149
135
  }
@@ -248,9 +234,6 @@ export function getTableRowAsObject(
248
234
  return objectRow;
249
235
  }
250
236
 
251
- case 'arrow-table':
252
- return getTableRowAsObject(table.data, rowIndex, target, copy);
253
-
254
237
  default:
255
238
  throw new Error('shape');
256
239
  }
@@ -321,9 +304,6 @@ export function getTableRowAsArray(
321
304
  return arrayRow;
322
305
  }
323
306
 
324
- case 'arrow-table':
325
- return getTableRowAsArray(table.data, rowIndex, target, copy);
326
-
327
307
  default:
328
308
  throw new Error('shape');
329
309
  }