@kepler.gl/utils 3.3.0-alpha.2 → 3.3.0-alpha.21

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 (264) hide show
  1. package/dist/application-config.d.ts +180 -1
  2. package/dist/arrow-data-container.d.ts +55 -2
  3. package/dist/camera-tour.d.ts +11 -0
  4. package/dist/camera-utils.d.ts +7 -0
  5. package/dist/cjs/aggregation.js +84 -0
  6. package/dist/cjs/aggregation.js.map +1 -0
  7. package/dist/cjs/application-config-types.js +6 -0
  8. package/dist/cjs/application-config-types.js.map +1 -0
  9. package/dist/cjs/application-config.js +178 -0
  10. package/dist/cjs/application-config.js.map +1 -0
  11. package/dist/cjs/arrow-data-container.js +1152 -0
  12. package/dist/cjs/arrow-data-container.js.map +1 -0
  13. package/dist/cjs/browser-utils.js +17 -0
  14. package/dist/cjs/browser-utils.js.map +1 -0
  15. package/dist/cjs/camera-tour.js +99 -0
  16. package/dist/cjs/camera-tour.js.map +1 -0
  17. package/dist/cjs/camera-utils.js +81 -0
  18. package/dist/cjs/camera-utils.js.map +1 -0
  19. package/dist/cjs/color-utils.js +462 -0
  20. package/dist/cjs/color-utils.js.map +1 -0
  21. package/dist/cjs/column-statistics.js +115 -0
  22. package/dist/cjs/column-statistics.js.map +1 -0
  23. package/dist/cjs/data-container-interface.js +6 -0
  24. package/dist/cjs/data-container-interface.js.map +1 -0
  25. package/dist/cjs/data-container-utils.js +76 -0
  26. package/dist/cjs/data-container-utils.js.map +1 -0
  27. package/dist/cjs/data-row.js +110 -0
  28. package/dist/cjs/data-row.js.map +1 -0
  29. package/dist/cjs/data-scale-utils.js +634 -0
  30. package/dist/cjs/data-scale-utils.js.map +1 -0
  31. package/dist/cjs/data-utils.js +538 -0
  32. package/dist/cjs/data-utils.js.map +1 -0
  33. package/dist/cjs/dataset-utils.js +361 -0
  34. package/dist/cjs/dataset-utils.js.map +1 -0
  35. package/dist/cjs/dom-to-image.js +433 -0
  36. package/dist/cjs/dom-to-image.js.map +1 -0
  37. package/dist/cjs/dom-utils.js +349 -0
  38. package/dist/cjs/dom-utils.js.map +1 -0
  39. package/dist/cjs/editor-feature-utils.js +177 -0
  40. package/dist/cjs/editor-feature-utils.js.map +1 -0
  41. package/dist/cjs/effect-utils.js +340 -0
  42. package/dist/cjs/effect-utils.js.map +1 -0
  43. package/dist/cjs/export-map-html.js +112 -0
  44. package/dist/cjs/export-map-html.js.map +1 -0
  45. package/dist/cjs/export-utils.js +318 -0
  46. package/dist/cjs/export-utils.js.map +1 -0
  47. package/dist/cjs/extract-dataset-utils.js +218 -0
  48. package/dist/cjs/extract-dataset-utils.js.map +1 -0
  49. package/dist/cjs/filter-utils.js +1762 -0
  50. package/dist/cjs/filter-utils.js.map +1 -0
  51. package/dist/cjs/format.js +38 -0
  52. package/dist/cjs/format.js.map +1 -0
  53. package/dist/cjs/gl-utils.js +118 -0
  54. package/dist/cjs/gl-utils.js.map +1 -0
  55. package/dist/{index.js → cjs/index.js} +391 -10
  56. package/dist/cjs/index.js.map +1 -0
  57. package/dist/cjs/indexed-data-container.js +214 -0
  58. package/dist/cjs/indexed-data-container.js.map +1 -0
  59. package/dist/cjs/jenks.js +156 -0
  60. package/dist/cjs/jenks.js.map +1 -0
  61. package/dist/cjs/locale-utils.js +39 -0
  62. package/dist/cjs/locale-utils.js.map +1 -0
  63. package/dist/cjs/map-info-utils.js +41 -0
  64. package/dist/cjs/map-info-utils.js.map +1 -0
  65. package/dist/cjs/map-style-utils/mapbox-gl-style-editor.js +198 -0
  66. package/dist/cjs/map-style-utils/mapbox-gl-style-editor.js.map +1 -0
  67. package/dist/cjs/map-style-utils/mapbox-utils.js +155 -0
  68. package/dist/cjs/map-style-utils/mapbox-utils.js.map +1 -0
  69. package/dist/cjs/map-utils.js +76 -0
  70. package/dist/cjs/map-utils.js.map +1 -0
  71. package/dist/cjs/mapbox-utils.js +19 -0
  72. package/dist/cjs/mapbox-utils.js.map +1 -0
  73. package/dist/cjs/notifications-utils.js +69 -0
  74. package/dist/cjs/notifications-utils.js.map +1 -0
  75. package/dist/cjs/observe-dimensions.js +136 -0
  76. package/dist/cjs/observe-dimensions.js.map +1 -0
  77. package/dist/cjs/plot.js +1502 -0
  78. package/dist/cjs/plot.js.map +1 -0
  79. package/dist/cjs/position-utils.js +29 -0
  80. package/dist/cjs/position-utils.js.map +1 -0
  81. package/dist/cjs/projection-utils.js +141 -0
  82. package/dist/cjs/projection-utils.js.map +1 -0
  83. package/dist/cjs/quick-insertion-sort.js +132 -0
  84. package/dist/cjs/quick-insertion-sort.js.map +1 -0
  85. package/dist/cjs/row-data-container.js +291 -0
  86. package/dist/cjs/row-data-container.js.map +1 -0
  87. package/dist/cjs/slider-scale-utils.js +138 -0
  88. package/dist/cjs/slider-scale-utils.js.map +1 -0
  89. package/dist/cjs/split-map-utils.js +117 -0
  90. package/dist/cjs/split-map-utils.js.map +1 -0
  91. package/dist/cjs/strings.js +16 -0
  92. package/dist/cjs/strings.js.map +1 -0
  93. package/dist/cjs/theme-utils.js +46 -0
  94. package/dist/cjs/theme-utils.js.map +1 -0
  95. package/dist/cjs/time.js +321 -0
  96. package/dist/cjs/time.js.map +1 -0
  97. package/dist/cjs/types.js +6 -0
  98. package/dist/cjs/types.js.map +1 -0
  99. package/dist/cjs/utils.js +224 -0
  100. package/dist/cjs/utils.js.map +1 -0
  101. package/dist/column-statistics.d.ts +54 -0
  102. package/dist/data-container-interface.d.ts +16 -1
  103. package/dist/data-container-utils.d.ts +2 -1
  104. package/dist/data-scale-utils.d.ts +5 -0
  105. package/dist/data-utils.d.ts +3 -3
  106. package/dist/dataset-utils.d.ts +11 -28
  107. package/dist/editor-feature-utils.d.ts +30 -0
  108. package/dist/esm/aggregation.js +75 -0
  109. package/dist/esm/aggregation.js.map +1 -0
  110. package/dist/esm/application-config-types.js +3 -0
  111. package/dist/esm/application-config-types.js.map +1 -0
  112. package/dist/esm/application-config.js +167 -0
  113. package/dist/esm/application-config.js.map +1 -0
  114. package/dist/esm/arrow-data-container.js +1136 -0
  115. package/dist/esm/arrow-data-container.js.map +1 -0
  116. package/dist/esm/browser-utils.js +11 -0
  117. package/dist/esm/browser-utils.js.map +1 -0
  118. package/dist/esm/camera-tour.js +92 -0
  119. package/dist/esm/camera-tour.js.map +1 -0
  120. package/dist/esm/camera-utils.js +74 -0
  121. package/dist/esm/camera-utils.js.map +1 -0
  122. package/dist/esm/color-utils.js +435 -0
  123. package/dist/esm/color-utils.js.map +1 -0
  124. package/dist/esm/column-statistics.js +105 -0
  125. package/dist/esm/column-statistics.js.map +1 -0
  126. package/dist/esm/data-container-interface.js +3 -0
  127. package/dist/esm/data-container-interface.js.map +1 -0
  128. package/dist/esm/data-container-utils.js +68 -0
  129. package/dist/esm/data-container-utils.js.map +1 -0
  130. package/dist/esm/data-row.js +106 -0
  131. package/dist/esm/data-row.js.map +1 -0
  132. package/dist/esm/data-scale-utils.js +602 -0
  133. package/dist/esm/data-scale-utils.js.map +1 -0
  134. package/dist/esm/data-utils.js +504 -0
  135. package/dist/esm/data-utils.js.map +1 -0
  136. package/dist/esm/dataset-utils.js +352 -0
  137. package/dist/esm/dataset-utils.js.map +1 -0
  138. package/dist/esm/dom-to-image.js +426 -0
  139. package/dist/esm/dom-to-image.js.map +1 -0
  140. package/dist/esm/dom-utils.js +323 -0
  141. package/dist/esm/dom-utils.js.map +1 -0
  142. package/dist/esm/editor-feature-utils.js +164 -0
  143. package/dist/esm/editor-feature-utils.js.map +1 -0
  144. package/dist/esm/effect-utils.js +333 -0
  145. package/dist/esm/effect-utils.js.map +1 -0
  146. package/dist/esm/export-map-html.js +107 -0
  147. package/dist/esm/export-map-html.js.map +1 -0
  148. package/dist/esm/export-utils.js +297 -0
  149. package/dist/esm/export-utils.js.map +1 -0
  150. package/dist/esm/extract-dataset-utils.js +206 -0
  151. package/dist/esm/extract-dataset-utils.js.map +1 -0
  152. package/dist/esm/filter-utils.js +1701 -0
  153. package/dist/esm/filter-utils.js.map +1 -0
  154. package/dist/esm/format.js +31 -0
  155. package/dist/esm/format.js.map +1 -0
  156. package/dist/esm/gl-utils.js +113 -0
  157. package/dist/esm/gl-utils.js.map +1 -0
  158. package/dist/esm/index.js +55 -0
  159. package/dist/esm/index.js.map +1 -0
  160. package/dist/esm/indexed-data-container.js +210 -0
  161. package/dist/esm/indexed-data-container.js.map +1 -0
  162. package/dist/esm/jenks.js +149 -0
  163. package/dist/esm/jenks.js.map +1 -0
  164. package/dist/esm/locale-utils.js +36 -0
  165. package/dist/esm/locale-utils.js.map +1 -0
  166. package/dist/esm/map-info-utils.js +35 -0
  167. package/dist/esm/map-info-utils.js.map +1 -0
  168. package/dist/esm/map-style-utils/mapbox-gl-style-editor.js +188 -0
  169. package/dist/esm/map-style-utils/mapbox-gl-style-editor.js.map +1 -0
  170. package/dist/esm/map-style-utils/mapbox-utils.js +144 -0
  171. package/dist/esm/map-style-utils/mapbox-utils.js.map +1 -0
  172. package/dist/esm/map-utils.js +72 -0
  173. package/dist/esm/map-utils.js.map +1 -0
  174. package/dist/esm/mapbox-utils.js +13 -0
  175. package/dist/esm/mapbox-utils.js.map +1 -0
  176. package/dist/esm/notifications-utils.js +63 -0
  177. package/dist/esm/notifications-utils.js.map +1 -0
  178. package/dist/esm/observe-dimensions.js +128 -0
  179. package/dist/esm/observe-dimensions.js.map +1 -0
  180. package/dist/esm/plot.js +1460 -0
  181. package/dist/esm/plot.js.map +1 -0
  182. package/dist/esm/position-utils.js +22 -0
  183. package/dist/esm/position-utils.js.map +1 -0
  184. package/dist/esm/projection-utils.js +131 -0
  185. package/dist/esm/projection-utils.js.map +1 -0
  186. package/dist/esm/quick-insertion-sort.js +125 -0
  187. package/dist/esm/quick-insertion-sort.js.map +1 -0
  188. package/dist/esm/row-data-container.js +286 -0
  189. package/dist/esm/row-data-container.js.map +1 -0
  190. package/dist/esm/slider-scale-utils.js +129 -0
  191. package/dist/esm/slider-scale-utils.js.map +1 -0
  192. package/dist/esm/split-map-utils.js +109 -0
  193. package/dist/esm/split-map-utils.js.map +1 -0
  194. package/dist/esm/strings.js +10 -0
  195. package/dist/esm/strings.js.map +1 -0
  196. package/dist/esm/theme-utils.js +38 -0
  197. package/dist/esm/theme-utils.js.map +1 -0
  198. package/dist/esm/time.js +308 -0
  199. package/dist/esm/time.js.map +1 -0
  200. package/dist/esm/types.js +3 -0
  201. package/dist/esm/types.js.map +1 -0
  202. package/dist/esm/utils.js +203 -0
  203. package/dist/esm/utils.js.map +1 -0
  204. package/dist/export-map-html.d.ts +5 -0
  205. package/dist/export-utils.d.ts +31 -3
  206. package/dist/extract-dataset-utils.d.ts +79 -0
  207. package/dist/filter-utils.d.ts +56 -7
  208. package/dist/index.d.ts +20 -9
  209. package/dist/jenks.d.ts +5 -0
  210. package/dist/map-info-utils.d.ts +11 -1
  211. package/dist/map-style-utils/mapbox-gl-style-editor.d.ts +11 -10
  212. package/dist/map-style-utils/mapbox-utils.d.ts +29 -1
  213. package/dist/plot.d.ts +187 -21
  214. package/dist/projection-utils.d.ts +6 -4
  215. package/dist/row-data-container.d.ts +19 -0
  216. package/dist/split-map-utils.d.ts +7 -0
  217. package/dist/theme-utils.d.ts +8 -0
  218. package/dist/time.d.ts +3 -3
  219. package/dist/types.d.ts +2 -0
  220. package/package.json +33 -26
  221. package/dist/aggregation.js +0 -84
  222. package/dist/application-config-types.js +0 -6
  223. package/dist/application-config.js +0 -113
  224. package/dist/arrow-data-container.js +0 -398
  225. package/dist/browser-utils.js +0 -17
  226. package/dist/color-utils.js +0 -462
  227. package/dist/data-container-interface.js +0 -6
  228. package/dist/data-container-utils.js +0 -75
  229. package/dist/data-row.js +0 -110
  230. package/dist/data-scale-utils.js +0 -620
  231. package/dist/data-utils.js +0 -532
  232. package/dist/dataset-utils.js +0 -330
  233. package/dist/dom-to-image.js +0 -433
  234. package/dist/dom-utils.js +0 -349
  235. package/dist/effect-utils.js +0 -318
  236. package/dist/export-map-html.js +0 -38
  237. package/dist/export-utils.js +0 -203
  238. package/dist/filter-utils.js +0 -1274
  239. package/dist/format.js +0 -38
  240. package/dist/gl-utils.js +0 -118
  241. package/dist/indexed-data-container.js +0 -214
  242. package/dist/locale-utils.js +0 -39
  243. package/dist/map-info-utils.js +0 -14
  244. package/dist/map-style-utils/mapbox-gl-style-editor.js +0 -194
  245. package/dist/map-style-utils/mapbox-utils.js +0 -107
  246. package/dist/map-utils.js +0 -72
  247. package/dist/mapbox-utils.js +0 -19
  248. package/dist/noop.d.ts +0 -1
  249. package/dist/noop.js +0 -13
  250. package/dist/notifications-utils.js +0 -69
  251. package/dist/observe-dimensions.js +0 -136
  252. package/dist/plot.js +0 -637
  253. package/dist/position-utils.js +0 -26
  254. package/dist/projection-utils.js +0 -91
  255. package/dist/quick-insertion-sort.js +0 -132
  256. package/dist/row-data-container.js +0 -206
  257. package/dist/searcher-utils.d.ts +0 -1
  258. package/dist/searcher-utils.js +0 -25
  259. package/dist/slider-scale-utils.js +0 -138
  260. package/dist/split-map-utils.js +0 -99
  261. package/dist/strings.js +0 -16
  262. package/dist/time.js +0 -325
  263. package/dist/types.js +0 -6
  264. package/dist/utils.js +0 -224
@@ -0,0 +1,1152 @@
1
+ "use strict";
2
+
3
+ var _typeof3 = require("@babel/runtime/helpers/typeof");
4
+ var _regeneratorRuntime2 = require("@babel/runtime/regenerator");
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.ArrowDataContainer = void 0;
10
+ exports.arrowDataTypeToAnalyzerDataType = arrowDataTypeToAnalyzerDataType;
11
+ exports.arrowDataTypeToFieldType = arrowDataTypeToFieldType;
12
+ exports.compactArrowTable = compactArrowTable;
13
+ exports.convertStructToFixedSizeList = convertStructToFixedSizeList;
14
+ exports.createArrowVector = createArrowVector;
15
+ exports.isArrowFixedSizeList = isArrowFixedSizeList;
16
+ exports.isArrowStruct = isArrowStruct;
17
+ exports.isArrowTable = isArrowTable;
18
+ exports.isArrowVector = isArrowVector;
19
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
20
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
21
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
22
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
23
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
24
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
25
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
26
+ var _constants = require("@kepler.gl/constants");
27
+ var arrow = _interopRequireWildcard(require("apache-arrow"));
28
+ var _window = require("global/window");
29
+ var _typeAnalyzer = require("type-analyzer");
30
+ var _applicationConfig = require("./application-config");
31
+ var _dataRow = require("./data-row");
32
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
33
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
34
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
35
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
36
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
37
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
38
+ var _marked = /*#__PURE__*/_regeneratorRuntime2.mark(rowsIterator),
39
+ _marked2 = /*#__PURE__*/_regeneratorRuntime2.mark(columnIterator); // SPDX-License-Identifier: MIT
40
+ // Copyright contributors to the kepler.gl project
41
+ /**
42
+ * Check if table is an ArrowTable object.
43
+ *
44
+ * We use duck-typing instead of `instanceof arrow.Table` because DuckDB loads its own
45
+ * bundled version of Apache Arrow. When DuckDB creates Arrow tables, they are instances
46
+ * of DuckDB's Arrow.Table class, not the Arrow.Table class from our application's
47
+ * apache-arrow package. This causes `instanceof` checks to fail even though the objects
48
+ * are functionally equivalent Arrow tables.
49
+ *
50
+ * @param data - object to check
51
+ * @returns true if data is an ArrowTable object (type guarded)
52
+ */
53
+ function isArrowTable(data) {
54
+ return (0, _typeof2["default"])(data) === 'object' && data !== null && 'schema' in data && 'getChildAt' in data && typeof data.getChildAt === 'function' && 'batches' in data && Array.isArray(data.batches);
55
+ }
56
+
57
+ /**
58
+ * Check if data is an ArrowVector object.
59
+ * Uses duck-typing instead of `instanceof` to handle DuckDB's bundled Arrow version.
60
+ *
61
+ * @param data - object to check
62
+ * @returns true if data is an ArrowVector object (type guarded)
63
+ */
64
+ function isArrowVector(data) {
65
+ return (0, _typeof2["default"])(data) === 'object' && data !== null && 'type' in data && 'length' in data && typeof data.length === 'number' && 'get' in data && typeof data.get === 'function' && 'data' in data && Array.isArray(data.data);
66
+ }
67
+
68
+ /**
69
+ * Normalize native point coordinates for deck.gl and loaders.gl. Interleaved
70
+ * coordinates are already usable and retain their buffers without copying.
71
+ */
72
+ function convertStructToFixedSizeList(coords) {
73
+ if (arrow.DataType.isFixedSizeList(coords.type)) {
74
+ var pointData = coords;
75
+ var child = pointData.children[0];
76
+ var length = coords.length * coords.type.listSize;
77
+ // IPC/compaction can pad the final buffer. Expose only logical coordinates
78
+ // to loaders.gl, which derives feature counts and bounds from buffer length.
79
+ return child.values.length === length ? pointData : pointData.clone(undefined, undefined, undefined, undefined, undefined, [child.slice(0, length)]);
80
+ }
81
+ if (!arrow.DataType.isStruct(coords.type)) {
82
+ throw new Error('Expected GeoArrow point coordinates');
83
+ }
84
+ var dimensions = coords.children.length;
85
+ var values = new Float64Array(coords.length * dimensions);
86
+ var _loop = function _loop(i) {
87
+ // Arrow slices already slice child values. Parent/child validity bitmaps
88
+ // retain their own offsets, which getValid accounts for.
89
+ var valid = coords.getValid(i) && coords.children.every(function (child) {
90
+ return child.getValid(i) && Number.isFinite(child.values[i]);
91
+ });
92
+ for (var axis = 0; axis < dimensions; axis++) {
93
+ // Preserve row alignment while keeping missing/empty points out of bounds
94
+ // and rendering. Float64 also preserves Float32 input values exactly.
95
+ values[i * dimensions + axis] = valid ? coords.children[axis].values[i] : NaN;
96
+ }
97
+ };
98
+ for (var i = 0; i < coords.length; i++) {
99
+ _loop(i);
100
+ }
101
+ var floatType = new arrow.Float64();
102
+ return arrow.makeData({
103
+ type: new arrow.FixedSizeList(dimensions, new arrow.Field('coords', floatType)),
104
+ offset: coords.offset,
105
+ length: coords.length,
106
+ nullCount: coords.nullCount,
107
+ nullBitmap: coords.nullBitmap,
108
+ child: arrow.makeData({
109
+ type: floatType,
110
+ length: values.length,
111
+ data: values
112
+ })
113
+ });
114
+ }
115
+
116
+ /** Build an Arrow vector while letting Arrow infer the physical type from converted values. */
117
+ function createArrowVector(values) {
118
+ return arrow.vectorFromArray(values);
119
+ }
120
+
121
+ /**
122
+ * Check if data is an Arrow FixedSizeList DataType.
123
+ * Uses duck-typing instead of `instanceof` to handle DuckDB's bundled Arrow version.
124
+ *
125
+ * @param data - object to check
126
+ * @returns true if data is an Arrow FixedSizeList DataType (type guarded)
127
+ */
128
+ function isArrowFixedSizeList(data) {
129
+ return (0, _typeof2["default"])(data) === 'object' && data !== null && 'typeId' in data && 'listSize' in data && typeof data.listSize === 'number' && 'children' in data && Array.isArray(data.children);
130
+ }
131
+
132
+ /**
133
+ * Check if data is an Arrow Struct DataType.
134
+ * Uses duck-typing instead of `instanceof` to handle DuckDB's bundled Arrow version.
135
+ *
136
+ * @param data - object to check
137
+ * @returns true if data is an Arrow Struct DataType (type guarded)
138
+ */
139
+ function isArrowStruct(data) {
140
+ return (0, _typeof2["default"])(data) === 'object' && data !== null && 'typeId' in data && 'children' in data && Array.isArray(data.children) && !('listSize' in data);
141
+ }
142
+
143
+ /**
144
+ * @param dataContainer
145
+ * @param sharedRow
146
+ */
147
+ function rowsIterator(dataContainer, sharedRow) {
148
+ var numRows, rowIndex;
149
+ return _regenerator["default"].wrap(function rowsIterator$(_context) {
150
+ while (1) switch (_context.prev = _context.next) {
151
+ case 0:
152
+ numRows = dataContainer.numRows();
153
+ rowIndex = 0;
154
+ case 2:
155
+ if (!(rowIndex < numRows)) {
156
+ _context.next = 8;
157
+ break;
158
+ }
159
+ _context.next = 5;
160
+ return dataContainer.row(rowIndex, sharedRow);
161
+ case 5:
162
+ ++rowIndex;
163
+ _context.next = 2;
164
+ break;
165
+ case 8:
166
+ case "end":
167
+ return _context.stop();
168
+ }
169
+ }, _marked);
170
+ }
171
+
172
+ /**
173
+ * @param dataContainer
174
+ * @param columnIndex
175
+ */
176
+ function columnIterator(dataContainer, columnIndex) {
177
+ var numRows, rowIndex;
178
+ return _regenerator["default"].wrap(function columnIterator$(_context2) {
179
+ while (1) switch (_context2.prev = _context2.next) {
180
+ case 0:
181
+ numRows = dataContainer.numRows();
182
+ rowIndex = 0;
183
+ case 2:
184
+ if (!(rowIndex < numRows)) {
185
+ _context2.next = 8;
186
+ break;
187
+ }
188
+ _context2.next = 5;
189
+ return dataContainer.valueAt(rowIndex, columnIndex);
190
+ case 5:
191
+ ++rowIndex;
192
+ _context2.next = 2;
193
+ break;
194
+ case 8:
195
+ case "end":
196
+ return _context2.stop();
197
+ }
198
+ }, _marked2);
199
+ }
200
+ var DEFAULT_MAX_ARROW_BATCHES = 1;
201
+
202
+ /**
203
+ * Collapse Arrow record batches into as few chunks as possible.
204
+ *
205
+ * Deck.gl picking encodes at most 255 pickable leaf layers. Kepler creates one
206
+ * Deck layer per Arrow record batch (and GeoJsonLayer adds fill/stroke/point
207
+ * sublayers), so parquet/DuckDB tables with hundreds of batches make hover and
208
+ * click miss most of the data. Combining chunks keeps picking under that cap
209
+ * without changing row values.
210
+ *
211
+ * apache-arrow JS does not expose Vector.combineChunks in the version Kepler
212
+ * uses, so we rebuild each column through a Builder (one chunk per column).
213
+ *
214
+ * Compaction only runs when `table.batches.length` is greater than
215
+ * `maxArrowBatches` from {@link getApplicationConfig} (default `1`) or the
216
+ * optional override. Progressive Arrow loading does not compact on each
217
+ * incoming batch; {@link ArrowDataContainer.update} assigns new chunks as-is
218
+ * and the completed file is compacted once.
219
+ */
220
+ function compactArrowTable(table, maxArrowBatches) {
221
+ var _ref;
222
+ var batchLimit = (_ref = maxArrowBatches !== null && maxArrowBatches !== void 0 ? maxArrowBatches : (0, _applicationConfig.getApplicationConfig)().maxArrowBatches) !== null && _ref !== void 0 ? _ref : DEFAULT_MAX_ARROW_BATCHES;
223
+ if (!table || !Array.isArray(table.batches) || table.batches.length <= 1) {
224
+ return table;
225
+ }
226
+ if (table.batches.length <= batchLimit) {
227
+ return table;
228
+ }
229
+ try {
230
+ var _compacted$batches;
231
+ var columns = {};
232
+ var columnNames = [];
233
+ var seenNames = new Map();
234
+ for (var i = 0; i < table.numCols; i++) {
235
+ var _seenNames$get;
236
+ var field = table.schema.fields[i];
237
+ var column = table.getChildAt(i);
238
+ if (!column) {
239
+ continue;
240
+ }
241
+ // Arrow schemas may repeat field names; object keys would drop earlier columns.
242
+ var seen = (_seenNames$get = seenNames.get(field.name)) !== null && _seenNames$get !== void 0 ? _seenNames$get : 0;
243
+ seenNames.set(field.name, seen + 1);
244
+ var key = seen === 0 ? field.name : "".concat(field.name, "_").concat(seen);
245
+ columns[key] = compactArrowVector(column, column.type || field.type);
246
+ columnNames.push(key);
247
+ }
248
+
249
+ // Always build a kepler apache-arrow Table. Using `table.constructor` can
250
+ // mix DuckDB's bundled Arrow Table with rebuilt vectors and drop schema
251
+ // metadata (`geo`, ARROW:extension:name) that Kepler needs to create layers.
252
+ var compacted = tableFromCompactedColumns(table, columns, columnNames);
253
+ if (compacted !== null && compacted !== void 0 && (_compacted$batches = compacted.batches) !== null && _compacted$batches !== void 0 && _compacted$batches.length && compacted.batches.length < table.batches.length) {
254
+ return compacted;
255
+ }
256
+ } catch (_unused) {
257
+ // Keep the original table if this Arrow build cannot combine chunks.
258
+ }
259
+ return table;
260
+ }
261
+ function copyArrowSchemaMetadata(from, to) {
262
+ if (!from || !to) {
263
+ return;
264
+ }
265
+ var fromMeta = from.metadata;
266
+ var toMeta = to.metadata;
267
+ if (fromMeta && toMeta && typeof fromMeta.forEach === 'function' && typeof toMeta.set === 'function') {
268
+ fromMeta.forEach(function (value, key) {
269
+ toMeta.set(key, value);
270
+ });
271
+ }
272
+ var fromByName = new Map((from.fields || []).map(function (field) {
273
+ return [field.name, field];
274
+ }));
275
+ (to.fields || []).forEach(function (toField, index) {
276
+ var _from$fields;
277
+ var fromField = ((_from$fields = from.fields) === null || _from$fields === void 0 ? void 0 : _from$fields[index]) || fromByName.get(toField.name);
278
+ var src = fromField === null || fromField === void 0 ? void 0 : fromField.metadata;
279
+ var dst = toField === null || toField === void 0 ? void 0 : toField.metadata;
280
+ if (!src || !dst || typeof src.forEach !== 'function' || typeof dst.set !== 'function') {
281
+ return;
282
+ }
283
+ src.forEach(function (value, key) {
284
+ dst.set(key, value);
285
+ });
286
+ });
287
+ }
288
+ function tableFromCompactedColumns(source, columns, columnNames) {
289
+ var ordered = new arrow.Table(columns).select(columnNames);
290
+ var compacted;
291
+ try {
292
+ compacted = new arrow.Table(source.schema, ordered.batches.map(function (batch) {
293
+ return new arrow.RecordBatch(source.schema, batch.data);
294
+ }));
295
+ } catch (_unused2) {
296
+ compacted = ordered;
297
+ }
298
+ copyArrowSchemaMetadata(source.schema, compacted.schema);
299
+ return compacted;
300
+ }
301
+
302
+ /**
303
+ * Convert an Arrow cell from Vector.get() into a value makeBuilder.append accepts.
304
+ * Nested GeoArrow (FixedSizeList / List) cells are Vectors, not arrays.
305
+ */
306
+ function arrowCellToBuilderValue(value) {
307
+ var logicalChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
308
+ if (value == null) {
309
+ return null;
310
+ }
311
+ if (ArrayBuffer.isView(value)) {
312
+ return Array.from(value);
313
+ }
314
+ if (logicalChildren && (value instanceof arrow.StructRow || value instanceof arrow.MapRow)) {
315
+ return new Map(Array.from(value, function (_ref2) {
316
+ var _ref3 = (0, _slicedToArray2["default"])(_ref2, 2),
317
+ key = _ref3[0],
318
+ child = _ref3[1];
319
+ return [key, arrowCellToBuilderValue(child, true)];
320
+ }));
321
+ }
322
+ var nested = value;
323
+
324
+ // Keep ordinary import compaction unchanged. Edited snapshots reinterpret
325
+ // timestamp storage first, so their children can safely use logical getters.
326
+ if (!logicalChildren && typeof nested.toArray === 'function' && nested.numChildren === 0) {
327
+ return Array.from(nested.toArray());
328
+ }
329
+ if (typeof nested.get === 'function' && typeof nested.length === 'number') {
330
+ var out = [];
331
+ for (var i = 0; i < nested.length; i++) {
332
+ var valid = typeof nested.isValid === 'function' ? nested.isValid(i) : true;
333
+ out.push(valid ? arrowCellToBuilderValue(nested.get(i), logicalChildren) : null);
334
+ }
335
+ return out;
336
+ }
337
+ return value;
338
+ }
339
+ function compactArrowVector(column) {
340
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : column.type;
341
+ var logicalChildren = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
342
+ var force = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
343
+ if (!column || !column.data || !force && column.data.length <= 1) {
344
+ return column;
345
+ }
346
+ var maybeCombine = column.combineChunks;
347
+ if (typeof maybeCombine === 'function') {
348
+ try {
349
+ var _combined$data;
350
+ var combined = maybeCombine.call(column);
351
+ if ((combined === null || combined === void 0 || (_combined$data = combined.data) === null || _combined$data === void 0 ? void 0 : _combined$data.length) <= 1) {
352
+ return combined;
353
+ }
354
+ } catch (_unused3) {
355
+ // fall through to Builder
356
+ }
357
+ }
358
+ var builder = arrow.makeBuilder(_objectSpread({
359
+ type: type,
360
+ nullValues: [null]
361
+ }, logicalChildren && arrow.DataType.isDictionary(type) ? {
362
+ // Struct/Map cells become Maps for builders; their default string key
363
+ // is always "[object Map]". Hash their typed contents instead.
364
+ dictionaryHashFunction: function dictionaryHashFunction(value) {
365
+ return JSON.stringify(value, function (_, child) {
366
+ return child instanceof Map ? Array.from(child) : typeof child === 'bigint' || typeof child === 'number' && !Number.isFinite(child) ? String(child) : child;
367
+ });
368
+ }
369
+ } : {}));
370
+ var length = column.length;
371
+ for (var i = 0; i < length; i++) {
372
+ var isValid = typeof column.isValid === 'function' ? column.isValid(i) : true;
373
+ // FixedSizeList/List .get() returns nested Vectors. Appending those
374
+ // silently writes NaN (points) or throws (lines/polygons). Plain JS
375
+ // arrays are what makeBuilder expects.
376
+ builder.append(isValid ? arrowCellToBuilderValue(column.get(i), logicalChildren) : null);
377
+ }
378
+ var finished = builder.finish();
379
+ if (finished instanceof arrow.Vector) {
380
+ return finished;
381
+ }
382
+ if (typeof finished.toVector === 'function') {
383
+ return finished.toVector();
384
+ }
385
+ return column;
386
+ }
387
+
388
+ /**
389
+ * Primitive (and dictionary-of-primitive) columns can be rebuilt from JS row
390
+ * arrays via vectorFromArray. Nested, binary, and geoarrow columns cannot.
391
+ */
392
+ function isSupportedArrowRowEditType(type) {
393
+ if (arrow.DataType.isUtf8(type) || arrow.DataType.isNull(type) || arrow.DataType.isInt(type) || arrow.DataType.isFloat(type) || arrow.DataType.isBool(type) || arrow.DataType.isDate(type) || arrow.DataType.isTimestamp(type) || arrow.DataType.isTime(type)) {
394
+ return true;
395
+ }
396
+ if (arrow.DataType.isDictionary(type)) {
397
+ var dictionary = type.dictionary;
398
+ return Boolean(dictionary && isSupportedArrowRowEditType(dictionary));
399
+ }
400
+ return false;
401
+ }
402
+
403
+ /** Reinterpret timestamp storage for builders without rounding through JS milliseconds. */
404
+ function rowEditStorageType(type) {
405
+ var _type$children;
406
+ if (arrow.DataType.isTimestamp(type)) return new arrow.Int64();
407
+ if (arrow.DataType.isDictionary(type)) return type.indices;
408
+ if ((_type$children = type.children) !== null && _type$children !== void 0 && _type$children.length) {
409
+ // Retain the Arrow type's prototype and layout (list size, union mode, etc.).
410
+ // Field.clone preserves names, nullability and extension metadata.
411
+ return Object.assign(Object.create(Object.getPrototypeOf(type)), type, {
412
+ children: type.children.map(function (field) {
413
+ return field.clone({
414
+ type: rowEditStorageType(field.type)
415
+ });
416
+ })
417
+ });
418
+ }
419
+ return type;
420
+ }
421
+ function rowEditStorageVector(column, type) {
422
+ var remapped = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Map();
423
+ var dictionaries = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Map();
424
+ var _convert = function convert(original, nextType) {
425
+ var data = remapped.get(original) || original;
426
+ var copy = data.clone(nextType, data.offset, data.length, data.nullCount, data.buffers, data.children.map(function (child, i) {
427
+ return _convert(child, nextType.children[i].type);
428
+ }));
429
+ if (arrow.DataType.isDictionary(nextType)) {
430
+ var canonical = dictionaries.get(nextType.id);
431
+ if (canonical) {
432
+ // Equivalent field types from different batches need the same object,
433
+ // even when their DataType instances differ.
434
+ copy.dictionary = canonical;
435
+ } else {
436
+ if (!data.dictionary) throw new Error('Missing Arrow dictionary');
437
+ copy.dictionary = rowEditStorageVector(data.dictionary, nextType.dictionary, remapped, dictionaries);
438
+ }
439
+ }
440
+ return copy;
441
+ };
442
+ return new arrow.Vector(column.data.map(function (data) {
443
+ return _convert(data, type);
444
+ }));
445
+ }
446
+ function rowEditDictionaryCapacity(type) {
447
+ return Math.pow(2, type.indices.bitWidth - (type.indices.isSigned ? 1 : 0));
448
+ }
449
+ function collectRowEditDictionaries(data, groups) {
450
+ data.children.forEach(function (child) {
451
+ return collectRowEditDictionaries(child, groups);
452
+ });
453
+ if (!arrow.DataType.isDictionary(data.type) || !data.dictionary) return;
454
+ // Inner dictionaries must be reconciled before their enclosing dictionary.
455
+ data.dictionary.data.forEach(function (child) {
456
+ return collectRowEditDictionaries(child, groups);
457
+ });
458
+ var group = groups.get(data.type.id) || new Set();
459
+ group.add(data);
460
+ groups.set(data.type.id, group);
461
+ }
462
+ function checkRowEditDictionaryCapacity(column) {
463
+ if (!arrow.DataType.isDictionary(column.type)) return;
464
+ var capacity = rowEditDictionaryCapacity(column.type);
465
+ if (column.data.some(function (data) {
466
+ var _data$dictionary;
467
+ return (((_data$dictionary = data.dictionary) === null || _data$dictionary === void 0 ? void 0 : _data$dictionary.length) || 0) > capacity;
468
+ })) {
469
+ throw new Error('Row edit exceeds the Arrow dictionary index capacity');
470
+ }
471
+ }
472
+
473
+ /** Compact only edited snapshots; progressive loading and other rebuilds keep their behavior. */
474
+ function compactRowEditColumns(columns) {
475
+ columns = columns.map(function (column) {
476
+ return new arrow.Vector(column.data.map(function (data) {
477
+ if (!data.children.length) return data;
478
+ // List/Map slices retain their entire child buffer. Normalize each
479
+ // retained chunk before merging dictionaries so deleted/null child
480
+ // entries cannot cause a false index-capacity overflow.
481
+ var sourceGroups = new Map();
482
+ collectRowEditDictionaries(data, sourceGroups);
483
+ var sourceDictionaries = new Map();
484
+ sourceGroups.forEach(function (entries, id) {
485
+ var _entries$values$next$;
486
+ var dictionary = (_entries$values$next$ = entries.values().next().value) === null || _entries$values$next$ === void 0 ? void 0 : _entries$values$next$.dictionary;
487
+ if (dictionary) sourceDictionaries.set(id, dictionary);
488
+ });
489
+ var type = rowEditStorageType(data.type);
490
+ var compacted = compactArrowVector(rowEditStorageVector(new arrow.Vector([data]), type), type, true, true);
491
+ return rowEditStorageVector(compacted, data.type, new Map(), sourceDictionaries).data[0];
492
+ }));
493
+ });
494
+ var groups = new Map();
495
+ columns.forEach(function (column) {
496
+ return column.data.forEach(function (data) {
497
+ return collectRowEditDictionaries(data, groups);
498
+ });
499
+ });
500
+ var dictionaries = new Map();
501
+ var remapped = new Map();
502
+ var _iterator = _createForOfIteratorHelper(groups.values()),
503
+ _step;
504
+ try {
505
+ var _loop2 = function _loop2() {
506
+ var entries = _step.value;
507
+ // Narrow indexes get the first dictionary entries before wider columns add values.
508
+ var group = (0, _toConsumableArray2["default"])(entries).sort(function (a, b) {
509
+ return rowEditDictionaryCapacity(a.type) - rowEditDictionaryCapacity(b.type);
510
+ });
511
+ var type = group[group.length - 1].type;
512
+ if (group.some(function (data) {
513
+ return String(data.type.dictionary) !== String(type.dictionary);
514
+ })) {
515
+ throw new Error('Shared Arrow dictionary value types must match');
516
+ }
517
+ var original = group[0].dictionary;
518
+ if (!original) throw new Error('Missing Arrow dictionary');
519
+ if (group.every(function (data) {
520
+ return data.dictionary === original;
521
+ })) {
522
+ // Deletion usually keeps one original mapping. Preserve its exact payload,
523
+ // including nested timestamps, and only compact the retained indices.
524
+ dictionaries.set(type.id, rowEditStorageVector(original, original.type, remapped, dictionaries));
525
+ return 1; // continue
526
+ }
527
+ var storageType = new arrow.Dictionary(rowEditStorageType(type.dictionary), type.indices, type.id, type.isOrdered);
528
+ var combined = new arrow.Vector(group.flatMap(function (data) {
529
+ return rowEditStorageVector(new arrow.Vector([data]), storageType, remapped, dictionaries).data;
530
+ }));
531
+ var compacted = compactArrowVector(combined, storageType, true);
532
+ checkRowEditDictionaryCapacity(compacted);
533
+ var compactedDictionary = compacted.data[0].dictionary;
534
+ if (!compactedDictionary) throw new Error('Missing compacted Arrow dictionary');
535
+ var dictionary = rowEditStorageVector(compactedDictionary, type.dictionary, new Map(), dictionaries);
536
+ dictionaries.set(type.id, dictionary);
537
+ var offset = 0;
538
+ var _iterator2 = _createForOfIteratorHelper(group),
539
+ _step2;
540
+ try {
541
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
542
+ var originalData = _step2.value;
543
+ var columnType = originalData.type;
544
+ var chunk = compacted.slice(offset, offset + originalData.length).data[0];
545
+ var capacity = rowEditDictionaryCapacity(columnType);
546
+ for (var index = 0; index < chunk.length; index++) {
547
+ if (chunk.getValid(index) && Number(chunk.values[index]) >= capacity) {
548
+ throw new Error('Row edit exceeds the Arrow dictionary index capacity');
549
+ }
550
+ }
551
+ var buffers = chunk.buffers;
552
+ buffers[arrow.BufferType.DATA] = new columnType.indices.ArrayType(chunk.values);
553
+ var data = chunk.clone(columnType, chunk.offset, chunk.length, chunk.nullCount, buffers);
554
+ data.dictionary = dictionary;
555
+ remapped.set(originalData, data);
556
+ offset += originalData.length;
557
+ }
558
+ } catch (err) {
559
+ _iterator2.e(err);
560
+ } finally {
561
+ _iterator2.f();
562
+ }
563
+ };
564
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
565
+ if (_loop2()) continue;
566
+ }
567
+ } catch (err) {
568
+ _iterator.e(err);
569
+ } finally {
570
+ _iterator.f();
571
+ }
572
+ return columns.map(function (column) {
573
+ // Builders see raw timestamp units and canonical dictionary indices, even
574
+ // inside lists/structs. Restore the original types after one-batch compaction.
575
+ var type = rowEditStorageType(column.type);
576
+ return rowEditStorageVector(compactArrowVector(rowEditStorageVector(column, type, remapped, dictionaries), type, true), column.type, new Map(), dictionaries);
577
+ });
578
+ }
579
+
580
+ /**
581
+ * A data container where all data is stored in raw Arrow table
582
+ */
583
+ var ArrowDataContainer = exports.ArrowDataContainer = /*#__PURE__*/function () {
584
+ function ArrowDataContainer(data) {
585
+ var _this$_cols$0$length, _this$_cols$, _this$_cols$0$data$le, _this$_cols$2;
586
+ (0, _classCallCheck2["default"])(this, ArrowDataContainer);
587
+ (0, _defineProperty2["default"])(this, "_cols", void 0);
588
+ (0, _defineProperty2["default"])(this, "_numColumns", void 0);
589
+ (0, _defineProperty2["default"])(this, "_numRows", void 0);
590
+ (0, _defineProperty2["default"])(this, "_fields", void 0);
591
+ (0, _defineProperty2["default"])(this, "_numChunks", void 0);
592
+ (0, _defineProperty2["default"])(this, "_geoArrowBinaryData", void 0);
593
+ // cache column data to make valueAt() faster
594
+ // _colData: any[][];
595
+ /** An arrow table recreated from vectors */
596
+ (0, _defineProperty2["default"])(this, "_arrowTable", void 0);
597
+ if (!data.cols) {
598
+ throw Error('ArrowDataContainer: no columns provided');
599
+ }
600
+ if (!Array.isArray(data.cols)) {
601
+ throw Error("ArrowDataContainer: columns object isn't an array");
602
+ }
603
+ this._fields = data.fields || [];
604
+ this._cols = data.cols;
605
+ this._numColumns = this._cols.length;
606
+ this._numRows = (_this$_cols$0$length = (_this$_cols$ = this._cols[0]) === null || _this$_cols$ === void 0 ? void 0 : _this$_cols$.length) !== null && _this$_cols$0$length !== void 0 ? _this$_cols$0$length : 0;
607
+ this._numChunks = (_this$_cols$0$data$le = (_this$_cols$2 = this._cols[0]) === null || _this$_cols$2 === void 0 || (_this$_cols$2 = _this$_cols$2.data) === null || _this$_cols$2 === void 0 ? void 0 : _this$_cols$2.length) !== null && _this$_cols$0$data$le !== void 0 ? _this$_cols$0$data$le : 0;
608
+ this._geoArrowBinaryData = data.geoArrowBinaryData || {};
609
+ var table = compactArrowTable(data.arrowTable || this._createTable());
610
+ this._arrowTable = table;
611
+ if (table.numCols > 0) {
612
+ this._assignTable(table);
613
+ }
614
+ }
615
+
616
+ /**
617
+ * Restores internal Arrow table from vectors.
618
+ * TODO: consider using original arrow table, as it could contain extra metadata, not passed to the fields.
619
+ */
620
+ return (0, _createClass2["default"])(ArrowDataContainer, [{
621
+ key: "_createTable",
622
+ value: function _createTable() {
623
+ var _this = this;
624
+ var creaOpts = {};
625
+ this._fields.map(function (field, index) {
626
+ creaOpts[field.name] = _this._cols[index];
627
+ });
628
+ return new arrow.Table(creaOpts).select(this._fields.map(function (field) {
629
+ return field.name;
630
+ }));
631
+ }
632
+ }, {
633
+ key: "getTable",
634
+ value: function getTable() {
635
+ return this._arrowTable;
636
+ }
637
+ }, {
638
+ key: "_assignTable",
639
+ value: function _assignTable(table) {
640
+ var _this$_cols$0$length2, _this$_cols$3, _this$_cols$0$data$le2, _this$_cols$4;
641
+ this._arrowTable = table;
642
+ this._cols = Array.from({
643
+ length: table.numCols
644
+ }, function (_, i) {
645
+ return table.getChildAt(i);
646
+ }).filter(function (col) {
647
+ return col;
648
+ });
649
+ this._numColumns = this._cols.length;
650
+ this._numRows = (_this$_cols$0$length2 = (_this$_cols$3 = this._cols[0]) === null || _this$_cols$3 === void 0 ? void 0 : _this$_cols$3.length) !== null && _this$_cols$0$length2 !== void 0 ? _this$_cols$0$length2 : 0;
651
+ this._numChunks = (_this$_cols$0$data$le2 = (_this$_cols$4 = this._cols[0]) === null || _this$_cols$4 === void 0 || (_this$_cols$4 = _this$_cols$4.data) === null || _this$_cols$4 === void 0 ? void 0 : _this$_cols$4.length) !== null && _this$_cols$0$data$le2 !== void 0 ? _this$_cols$0$data$le2 : 0;
652
+ }
653
+ }, {
654
+ key: "update",
655
+ value: function update(updateData) {
656
+ var _this2 = this;
657
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
658
+ // Incremental Arrow loads append batches here. Compacting on every update
659
+ // would copy the growing table (Builder over every cell). Skip collapse;
660
+ // processArrowBatches compact once when the file is fully loaded.
661
+ var previousNumChunks = this._numChunks;
662
+ var isArrow = isArrowTable(updateData);
663
+ if (isArrow) {
664
+ this._assignTable(updateData);
665
+ } else {
666
+ this._cols = updateData;
667
+ var table = this._createTable();
668
+ if (table.numCols > 0) {
669
+ this._assignTable(table);
670
+ } else {
671
+ var _this$_cols$0$length3, _this$_cols$5, _this$_cols$0$data$le3, _this$_cols$6;
672
+ this._numColumns = this._cols.length;
673
+ this._numRows = (_this$_cols$0$length3 = (_this$_cols$5 = this._cols[0]) === null || _this$_cols$5 === void 0 ? void 0 : _this$_cols$5.length) !== null && _this$_cols$0$length3 !== void 0 ? _this$_cols$0$length3 : 0;
674
+ this._numChunks = (_this$_cols$0$data$le3 = (_this$_cols$6 = this._cols[0]) === null || _this$_cols$6 === void 0 || (_this$_cols$6 = _this$_cols$6.data) === null || _this$_cols$6 === void 0 ? void 0 : _this$_cols$6.length) !== null && _this$_cols$0$data$le3 !== void 0 ? _this$_cols$0$data$le3 : 0;
675
+ this._arrowTable = table;
676
+ }
677
+ }
678
+
679
+ // Progressive snapshots add one record batch at a time, so keep already
680
+ // parsed chunks and merge the new worker result. A compaction/replacement
681
+ // resets chunk numbering and must replace the cache instead.
682
+ if (this._numChunks > previousNumChunks) {
683
+ Object.entries(options.geoArrowBinaryData || {}).forEach(function (_ref4) {
684
+ var _ref5 = (0, _slicedToArray2["default"])(_ref4, 2),
685
+ columnIndex = _ref5[0],
686
+ chunks = _ref5[1];
687
+ _this2._geoArrowBinaryData[Number(columnIndex)] = _objectSpread(_objectSpread({}, _this2._geoArrowBinaryData[Number(columnIndex)]), chunks);
688
+ });
689
+ } else {
690
+ this._geoArrowBinaryData = options.geoArrowBinaryData || {};
691
+ }
692
+
693
+ // cache column data to make valueAt() faster
694
+ // this._colData = this._cols.map(c => c.toArray());
695
+ }
696
+
697
+ /** Append typed rows atomically while retaining the container and prior snapshots. */
698
+ }, {
699
+ key: "append",
700
+ value: function append(rows) {
701
+ if (!Array.isArray(rows)) return false;
702
+ return this.replaceRows(new Map(), rows);
703
+ }
704
+ }, {
705
+ key: "replace",
706
+ value: function replace(index, row) {
707
+ return this.replaceRows(new Map([[index, row]]), []);
708
+ }
709
+
710
+ /** @internal Match upsert keys in the same representation returned by valueAt. */
711
+ }, {
712
+ key: "getRowEditKeys",
713
+ value: function getRowEditKeys(rows, keyIndex) {
714
+ var _this$_arrowTable$sch;
715
+ var type = (_this$_arrowTable$sch = this._arrowTable.schema.fields[keyIndex]) === null || _this$_arrowTable$sch === void 0 ? void 0 : _this$_arrowTable$sch.type;
716
+ if (!type) return null;
717
+ var valueType = type;
718
+ while (arrow.DataType.isDictionary(valueType)) valueType = valueType.dictionary;
719
+ try {
720
+ if (arrow.DataType.isInt(valueType)) {
721
+ var bits = valueType.bitWidth;
722
+ var limit = 1n << BigInt(bits - (valueType.isSigned ? 1 : 0));
723
+ var min = valueType.isSigned ? -limit : 0n;
724
+ var max = limit - 1n;
725
+ var _iterator3 = _createForOfIteratorHelper(rows),
726
+ _step3;
727
+ try {
728
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
729
+ var row = _step3.value;
730
+ var value = row[keyIndex];
731
+ if (value === null) continue;
732
+ // Arrow's typed array assignment wraps out-of-range integers. A key
733
+ // must not silently turn into a different existing row's identity.
734
+ if (typeof value === 'string' && !value.trim()) return null;
735
+ var integer = BigInt(bits === 64 ? value : Number(value));
736
+ if (integer < min || integer > max) return null;
737
+ }
738
+ } catch (err) {
739
+ _iterator3.e(err);
740
+ } finally {
741
+ _iterator3.f();
742
+ }
743
+ }
744
+ var keys = arrow.vectorFromArray(rows.map(function (row) {
745
+ return row[keyIndex];
746
+ }), type);
747
+ checkRowEditDictionaryCapacity(keys);
748
+ return Array.from(keys);
749
+ } catch (_unused4) {
750
+ return null;
751
+ }
752
+ }
753
+
754
+ /** @internal Encode a complete edit batch before replacing any live columns. */
755
+ }, {
756
+ key: "replaceRows",
757
+ value: function replaceRows(replacements, appended) {
758
+ var _iterator4 = _createForOfIteratorHelper(replacements.keys()),
759
+ _step4;
760
+ try {
761
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
762
+ var index = _step4.value;
763
+ if (!Number.isInteger(index) || index < 0 || index >= this._numRows) return false;
764
+ }
765
+ } catch (err) {
766
+ _iterator4.e(err);
767
+ } finally {
768
+ _iterator4.f();
769
+ }
770
+ var incoming = this._columnsFromRows([].concat((0, _toConsumableArray2["default"])(replacements.values()), (0, _toConsumableArray2["default"])(appended)));
771
+ if (!incoming) return false;
772
+ var ordered = (0, _toConsumableArray2["default"])(replacements.keys()).map(function (index, incomingIndex) {
773
+ return {
774
+ index: index,
775
+ incomingIndex: incomingIndex
776
+ };
777
+ }).sort(function (a, b) {
778
+ return a.index - b.index;
779
+ });
780
+ try {
781
+ var columns = this._cols.map(function (column, i) {
782
+ var chunks = [];
783
+ var start = 0;
784
+ var _iterator5 = _createForOfIteratorHelper(ordered),
785
+ _step5;
786
+ try {
787
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
788
+ var _step5$value = _step5.value,
789
+ index = _step5$value.index,
790
+ incomingIndex = _step5$value.incomingIndex;
791
+ chunks.push.apply(chunks, (0, _toConsumableArray2["default"])(column.slice(start, index).data).concat((0, _toConsumableArray2["default"])(incoming[i].slice(incomingIndex, incomingIndex + 1).data)));
792
+ start = index + 1;
793
+ }
794
+ } catch (err) {
795
+ _iterator5.e(err);
796
+ } finally {
797
+ _iterator5.f();
798
+ }
799
+ chunks.push.apply(chunks, (0, _toConsumableArray2["default"])(column.slice(start).data).concat((0, _toConsumableArray2["default"])(incoming[i].slice(replacements.size).data)));
800
+ return new arrow.Vector(chunks);
801
+ });
802
+ this._commitColumns(columns);
803
+ return true;
804
+ } catch (_unused5) {
805
+ return false;
806
+ }
807
+ }
808
+
809
+ /** Delete unique valid indexes without decoding retained values. */
810
+ }, {
811
+ key: "remove",
812
+ value: function remove(indexes) {
813
+ var _this3 = this;
814
+ if (!Array.isArray(indexes) || !indexes.length) return false;
815
+ if (indexes.some(function (index) {
816
+ return !Number.isInteger(index) || index < 0 || index >= _this3._numRows;
817
+ })) return false;
818
+ var sorted = (0, _toConsumableArray2["default"])(new Set(indexes)).sort(function (a, b) {
819
+ return a - b;
820
+ });
821
+ try {
822
+ var columns = this._cols.map(function (column) {
823
+ var chunks = [];
824
+ var start = 0;
825
+ var _iterator6 = _createForOfIteratorHelper(sorted),
826
+ _step6;
827
+ try {
828
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
829
+ var index = _step6.value;
830
+ if (start < index) chunks.push.apply(chunks, (0, _toConsumableArray2["default"])(column.slice(start, index).data));
831
+ start = index + 1;
832
+ }
833
+ } catch (err) {
834
+ _iterator6.e(err);
835
+ } finally {
836
+ _iterator6.f();
837
+ }
838
+ if (start < _this3._numRows) chunks.push.apply(chunks, (0, _toConsumableArray2["default"])(column.slice(start).data));
839
+ return chunks.length ? new arrow.Vector(chunks) : column.slice(0, 0);
840
+ });
841
+ this._commitColumns(columns);
842
+ return true;
843
+ } catch (_unused6) {
844
+ return false;
845
+ }
846
+ }
847
+ }, {
848
+ key: "_commitColumns",
849
+ value: function _commitColumns(columns) {
850
+ var schema = this._arrowTable.schema;
851
+ var compacted = compactRowEditColumns(columns);
852
+ // Ordinal keys let Arrow align chunks without interpreting real column names.
853
+ var ordered = new arrow.Table(Object.fromEntries(compacted.map(function (column, i) {
854
+ return [i, column];
855
+ })));
856
+ var batches = ordered.batches.map(function (batch) {
857
+ var result = new arrow.RecordBatch(schema, batch.data);
858
+ // Arrow reconciles fields by name, even for positional input. Retain the
859
+ // source fields when an external schema contains duplicate names.
860
+ schema.fields.forEach(function (field, i) {
861
+ result.schema.fields[i] = field;
862
+ });
863
+ // Validate shared dictionary identities before publishing the snapshot.
864
+ result.dictionaries;
865
+ return result;
866
+ });
867
+ this._assignTable(new arrow.Table(schema, batches));
868
+ this._geoArrowBinaryData = {};
869
+ }
870
+ }, {
871
+ key: "_columnsFromRows",
872
+ value: function _columnsFromRows(rows) {
873
+ var fields = this._arrowTable.schema.fields;
874
+ if (!rows.length || !fields.length || rows.some(function (row) {
875
+ return !Array.isArray(row) || row.length !== fields.length;
876
+ })) return null;
877
+ var _iterator7 = _createForOfIteratorHelper(fields),
878
+ _step7;
879
+ try {
880
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
881
+ var _field$metadata$get;
882
+ var field = _step7.value;
883
+ if ((_field$metadata$get = field.metadata.get(_constants.GEOARROW_METADATA_KEY)) !== null && _field$metadata$get !== void 0 && _field$metadata$get.startsWith('geoarrow') || !isSupportedArrowRowEditType(field.type)) {
884
+ _window.console.warn("ArrowDataContainer: row edits do not support column \"".concat(field.name, "\" (").concat(field.type, ")"));
885
+ return null;
886
+ }
887
+ }
888
+ } catch (err) {
889
+ _iterator7.e(err);
890
+ } finally {
891
+ _iterator7.f();
892
+ }
893
+ try {
894
+ return fields.map(function (field, i) {
895
+ var column = arrow.vectorFromArray(rows.map(function (row) {
896
+ return row[i];
897
+ }), field.type);
898
+ checkRowEditDictionaryCapacity(column);
899
+ return column;
900
+ });
901
+ } catch (_unused7) {
902
+ _window.console.warn('ArrowDataContainer: could not encode row edits using the existing column types');
903
+ return null;
904
+ }
905
+ }
906
+ }, {
907
+ key: "numChunks",
908
+ value: function numChunks() {
909
+ return this._numChunks;
910
+ }
911
+ }, {
912
+ key: "getGeoArrowBinaryData",
913
+ value: function getGeoArrowBinaryData(columnIndex, chunkIndex) {
914
+ var columnData = this._geoArrowBinaryData[columnIndex];
915
+ if (!columnData) {
916
+ return undefined;
917
+ }
918
+ if (chunkIndex !== undefined) {
919
+ return columnData[chunkIndex];
920
+ }
921
+ var chunks = Object.entries(columnData).map(function (_ref6) {
922
+ var _ref7 = (0, _slicedToArray2["default"])(_ref6, 2),
923
+ index = _ref7[0],
924
+ data = _ref7[1];
925
+ return {
926
+ index: Number(index),
927
+ data: data
928
+ };
929
+ }).sort(function (a, b) {
930
+ return a.index - b.index;
931
+ });
932
+ if (chunks.length !== this._numChunks) {
933
+ return undefined;
934
+ }
935
+ var featureTypes = {
936
+ point: false,
937
+ line: false,
938
+ polygon: false
939
+ };
940
+ var bounds = [Infinity, Infinity, -Infinity, -Infinity];
941
+ var binaryGeometries = [];
942
+ var meanCenters = [];
943
+ var hasMeanCenters = true;
944
+ chunks.forEach(function (_ref8) {
945
+ var data = _ref8.data;
946
+ data.binaryGeometries.forEach(function (geometry) {
947
+ return binaryGeometries.push(geometry);
948
+ });
949
+ featureTypes.point || (featureTypes.point = data.featureTypes.point);
950
+ featureTypes.line || (featureTypes.line = data.featureTypes.line);
951
+ featureTypes.polygon || (featureTypes.polygon = data.featureTypes.polygon);
952
+ bounds[0] = Math.min(bounds[0], data.bounds[0]);
953
+ bounds[1] = Math.min(bounds[1], data.bounds[1]);
954
+ bounds[2] = Math.max(bounds[2], data.bounds[2]);
955
+ bounds[3] = Math.max(bounds[3], data.bounds[3]);
956
+ if (data.meanCenters) {
957
+ data.meanCenters.forEach(function (center) {
958
+ return meanCenters.push(center);
959
+ });
960
+ } else {
961
+ hasMeanCenters = false;
962
+ }
963
+ });
964
+ return _objectSpread({
965
+ binaryGeometries: binaryGeometries,
966
+ featureTypes: featureTypes,
967
+ bounds: bounds
968
+ }, hasMeanCenters ? {
969
+ meanCenters: meanCenters
970
+ } : {});
971
+ }
972
+ }, {
973
+ key: "numRows",
974
+ value: function numRows() {
975
+ return this._numRows;
976
+ }
977
+ }, {
978
+ key: "numColumns",
979
+ value: function numColumns() {
980
+ return this._numColumns;
981
+ }
982
+ }, {
983
+ key: "valueAt",
984
+ value: function valueAt(rowIndex, columnIndex) {
985
+ // return this._colData[columnIndex][rowIndex];
986
+ return this._cols[columnIndex].get(rowIndex);
987
+ }
988
+ }, {
989
+ key: "row",
990
+ value: function row(rowIndex, sharedRow) {
991
+ var tSharedRow = _dataRow.DataRow.createSharedRow(sharedRow);
992
+ if (tSharedRow) {
993
+ tSharedRow.setSource(this, rowIndex);
994
+ return tSharedRow;
995
+ }
996
+ return new _dataRow.DataRow(this, rowIndex);
997
+ }
998
+ }, {
999
+ key: "rowAsArray",
1000
+ value: function rowAsArray(rowIndex) {
1001
+ // return this._colData.map(col => col[rowIndex]);
1002
+ return this._cols.map(function (col) {
1003
+ return col.get(rowIndex);
1004
+ });
1005
+ }
1006
+ }, {
1007
+ key: "rows",
1008
+ value: function rows(sharedRow) {
1009
+ var tSharedRow = _dataRow.DataRow.createSharedRow(sharedRow);
1010
+ return rowsIterator(this, tSharedRow);
1011
+ }
1012
+ }, {
1013
+ key: "column",
1014
+ value: function column(columnIndex) {
1015
+ return columnIterator(this, columnIndex);
1016
+ }
1017
+ }, {
1018
+ key: "getColumn",
1019
+ value: function getColumn(columnIndex) {
1020
+ return this._cols[columnIndex];
1021
+ }
1022
+ }, {
1023
+ key: "getField",
1024
+ value: function getField(columnIndex) {
1025
+ return this._fields[columnIndex];
1026
+ }
1027
+ }, {
1028
+ key: "flattenData",
1029
+ value: function flattenData() {
1030
+ var data = [];
1031
+ for (var i = 0; i < this._numRows; ++i) {
1032
+ data.push(this.rowAsArray(i));
1033
+ }
1034
+ return data;
1035
+ }
1036
+ }, {
1037
+ key: "getPlainIndex",
1038
+ value: function getPlainIndex() {
1039
+ return (0, _toConsumableArray2["default"])(Array(this._numRows).keys());
1040
+ }
1041
+ }, {
1042
+ key: "map",
1043
+ value: function map(func, sharedRow) {
1044
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1045
+ var tSharedRow = _dataRow.DataRow.createSharedRow(sharedRow);
1046
+ var _options$start = options.start,
1047
+ start = _options$start === void 0 ? 0 : _options$start,
1048
+ _options$end = options.end,
1049
+ end = _options$end === void 0 ? this.numRows() : _options$end;
1050
+ var endRow = Math.min(this.numRows(), end);
1051
+ var out = [];
1052
+ for (var rowIndex = start; rowIndex < endRow; ++rowIndex) {
1053
+ var row = this.row(rowIndex, tSharedRow);
1054
+ out.push(func(row, rowIndex));
1055
+ }
1056
+ return out;
1057
+ }
1058
+ }, {
1059
+ key: "mapIndex",
1060
+ value: function mapIndex(func) {
1061
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1062
+ var _options$start2 = options.start,
1063
+ start = _options$start2 === void 0 ? 0 : _options$start2,
1064
+ _options$end2 = options.end,
1065
+ end = _options$end2 === void 0 ? this.numRows() : _options$end2;
1066
+ var endRow = Math.min(this.numRows(), end);
1067
+ var out = [];
1068
+ for (var rowIndex = start; rowIndex < endRow; ++rowIndex) {
1069
+ out.push(func({
1070
+ index: rowIndex
1071
+ }, this));
1072
+ }
1073
+ return out;
1074
+ }
1075
+ }, {
1076
+ key: "find",
1077
+ value: function find(func, sharedRow) {
1078
+ var tSharedRow = _dataRow.DataRow.createSharedRow(sharedRow);
1079
+ for (var rowIndex = 0; rowIndex < this._numRows; ++rowIndex) {
1080
+ var row = this.row(rowIndex, tSharedRow);
1081
+ if (func(row, rowIndex)) {
1082
+ return row;
1083
+ }
1084
+ }
1085
+ return undefined;
1086
+ }
1087
+ }, {
1088
+ key: "reduce",
1089
+ value: function reduce(func, initialValue, sharedRow) {
1090
+ var tSharedRow = _dataRow.DataRow.createSharedRow(sharedRow);
1091
+ for (var rowIndex = 0; rowIndex < this._numRows; ++rowIndex) {
1092
+ var row = this.row(rowIndex, tSharedRow);
1093
+ initialValue = func(initialValue, row, rowIndex);
1094
+ }
1095
+ return initialValue;
1096
+ }
1097
+ }]);
1098
+ }();
1099
+ /**
1100
+ * Convert arrow data type to kepler.gl field types
1101
+ *
1102
+ * @param arrowType the arrow data type
1103
+ * @returns corresponding type in `ALL_FIELD_TYPES`
1104
+ */
1105
+ function arrowDataTypeToFieldType(arrowType) {
1106
+ // Note: this function doesn't return ALL_FIELD_TYPES.geojson or ALL_FIELD_TYPES.array, which
1107
+ // should be further detected by caller
1108
+ if (arrow.DataType.isDate(arrowType)) {
1109
+ return _constants.ALL_FIELD_TYPES.date;
1110
+ } else if (arrow.DataType.isTimestamp(arrowType) || arrow.DataType.isTime(arrowType)) {
1111
+ return _constants.ALL_FIELD_TYPES.timestamp;
1112
+ } else if (arrow.DataType.isFloat(arrowType)) {
1113
+ return _constants.ALL_FIELD_TYPES.real;
1114
+ } else if (arrow.DataType.isInt(arrowType)) {
1115
+ return _constants.ALL_FIELD_TYPES.integer;
1116
+ } else if (arrow.DataType.isBool(arrowType)) {
1117
+ return _constants.ALL_FIELD_TYPES["boolean"];
1118
+ } else if (arrow.DataType.isUtf8(arrowType) || arrow.DataType.isNull(arrowType)) {
1119
+ return _constants.ALL_FIELD_TYPES.string;
1120
+ } else if (arrow.DataType.isBinary(arrowType) || arrow.DataType.isDictionary(arrowType) || arrow.DataType.isFixedSizeBinary(arrowType) || arrow.DataType.isFixedSizeList(arrowType) || arrow.DataType.isList(arrowType) || arrow.DataType.isMap(arrowType) || arrow.DataType.isStruct(arrowType)) {
1121
+ return _constants.ALL_FIELD_TYPES.object;
1122
+ }
1123
+ _window.console.warn("Unsupported arrow type: ".concat(arrowType));
1124
+ return _constants.ALL_FIELD_TYPES.string;
1125
+ }
1126
+
1127
+ /**
1128
+ * Convert arrow data type to analyzer type
1129
+ *
1130
+ * @param arrowType the arrow data type
1131
+ * @returns corresponding type in `AnalyzerDATA_TYPES`
1132
+ */
1133
+ function arrowDataTypeToAnalyzerDataType(arrowType) {
1134
+ if (arrow.DataType.isDate(arrowType)) {
1135
+ return _typeAnalyzer.DATA_TYPES.DATE;
1136
+ } else if (arrow.DataType.isTimestamp(arrowType) || arrow.DataType.isTime(arrowType)) {
1137
+ return _typeAnalyzer.DATA_TYPES.DATETIME;
1138
+ } else if (arrow.DataType.isFloat(arrowType)) {
1139
+ return _typeAnalyzer.DATA_TYPES.FLOAT;
1140
+ } else if (arrow.DataType.isInt(arrowType)) {
1141
+ return _typeAnalyzer.DATA_TYPES.INT;
1142
+ } else if (arrow.DataType.isBool(arrowType)) {
1143
+ return _typeAnalyzer.DATA_TYPES.BOOLEAN;
1144
+ } else if (arrow.DataType.isUtf8(arrowType) || arrow.DataType.isNull(arrowType)) {
1145
+ return _typeAnalyzer.DATA_TYPES.STRING;
1146
+ } else if (arrow.DataType.isBinary(arrowType) || arrow.DataType.isDictionary(arrowType) || arrow.DataType.isFixedSizeBinary(arrowType) || arrow.DataType.isFixedSizeList(arrowType) || arrow.DataType.isList(arrowType) || arrow.DataType.isMap(arrowType) || arrow.DataType.isStruct(arrowType)) {
1147
+ return _typeAnalyzer.DATA_TYPES.OBJECT;
1148
+ }
1149
+ _window.console.warn("Unsupported arrow type: ".concat(arrowType));
1150
+ return _typeAnalyzer.DATA_TYPES.STRING;
1151
+ }
1152
+ //# sourceMappingURL=arrow-data-container.js.map