@loaders.gl/schema 3.1.0-alpha.3 → 3.1.0-beta.2

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 (250) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +1288 -4
  4. package/dist/category/common.d.ts +20 -0
  5. package/dist/category/common.d.ts.map +1 -0
  6. package/dist/category/common.js +10 -2
  7. package/dist/category/gis.d.ts +50 -0
  8. package/dist/category/gis.d.ts.map +1 -0
  9. package/dist/category/gis.js +2 -2
  10. package/dist/category/mesh/convert-mesh.d.ts +15 -0
  11. package/dist/category/mesh/convert-mesh.d.ts.map +1 -0
  12. package/dist/category/mesh/convert-mesh.js +37 -31
  13. package/dist/category/mesh/deduce-mesh-schema.d.ts +24 -0
  14. package/dist/category/mesh/deduce-mesh-schema.d.ts.map +1 -0
  15. package/dist/category/mesh/deduce-mesh-schema.js +57 -37
  16. package/dist/category/mesh/mesh-to-arrow-table.d.ts +1 -0
  17. package/dist/category/mesh/mesh-to-arrow-table.d.ts.map +1 -0
  18. package/dist/category/mesh/mesh-to-arrow-table.js +28 -15
  19. package/dist/category/mesh/mesh-types.d.ts +50 -0
  20. package/dist/category/mesh/mesh-types.d.ts.map +1 -0
  21. package/dist/category/mesh/mesh-types.js +2 -2
  22. package/dist/category/mesh/mesh-utils.d.ts +23 -0
  23. package/dist/category/mesh/mesh-utils.d.ts.map +1 -0
  24. package/dist/category/mesh/mesh-utils.js +48 -35
  25. package/dist/category/table/deduce-table-schema.d.ts +9 -0
  26. package/dist/category/table/deduce-table-schema.d.ts.map +1 -0
  27. package/dist/category/table/deduce-table-schema.js +94 -39
  28. package/dist/category/table/table-types.d.ts +78 -0
  29. package/dist/category/table/table-types.d.ts.map +1 -0
  30. package/dist/category/table/table-types.js +2 -2
  31. package/dist/es5/bundle.js +7 -0
  32. package/dist/es5/bundle.js.map +1 -0
  33. package/dist/es5/category/common.js +2 -0
  34. package/dist/{category → es5/category}/common.js.map +0 -0
  35. package/dist/es5/category/gis.js +2 -0
  36. package/dist/{category → es5/category}/gis.js.map +0 -0
  37. package/dist/es5/category/mesh/convert-mesh.js +35 -0
  38. package/dist/es5/category/mesh/convert-mesh.js.map +1 -0
  39. package/dist/es5/category/mesh/deduce-mesh-schema.js +54 -0
  40. package/dist/es5/category/mesh/deduce-mesh-schema.js.map +1 -0
  41. package/dist/es5/category/mesh/mesh-to-arrow-table.js +2 -0
  42. package/dist/es5/category/mesh/mesh-to-arrow-table.js.map +1 -0
  43. package/dist/es5/category/mesh/mesh-types.js +2 -0
  44. package/dist/{category → es5/category}/mesh/mesh-types.js.map +0 -0
  45. package/dist/es5/category/mesh/mesh-utils.js +47 -0
  46. package/dist/es5/category/mesh/mesh-utils.js.map +1 -0
  47. package/dist/es5/category/table/deduce-table-schema.js +58 -0
  48. package/dist/es5/category/table/deduce-table-schema.js.map +1 -0
  49. package/dist/es5/category/table/table-types.js +2 -0
  50. package/dist/{category → es5/category}/table/table-types.js.map +0 -0
  51. package/dist/es5/index.js +344 -0
  52. package/dist/es5/index.js.map +1 -0
  53. package/dist/es5/lib/arrow/arrow-like-type-utils.js +40 -0
  54. package/dist/es5/lib/arrow/arrow-like-type-utils.js.map +1 -0
  55. package/dist/es5/lib/arrow/arrow-type-utils.js +2 -0
  56. package/dist/es5/lib/arrow/arrow-type-utils.js.map +1 -0
  57. package/dist/es5/lib/arrow/get-type-info.js +33 -0
  58. package/dist/es5/lib/arrow/get-type-info.js.map +1 -0
  59. package/dist/es5/lib/batches/base-table-batch-aggregator.js +81 -0
  60. package/dist/es5/lib/batches/base-table-batch-aggregator.js.map +1 -0
  61. package/dist/es5/lib/batches/columnar-table-batch-aggregator.js +109 -0
  62. package/dist/es5/lib/batches/columnar-table-batch-aggregator.js.map +1 -0
  63. package/dist/es5/lib/batches/row-table-batch-aggregator.js +102 -0
  64. package/dist/es5/lib/batches/row-table-batch-aggregator.js.map +1 -0
  65. package/dist/es5/lib/batches/table-batch-aggregator.js +2 -0
  66. package/dist/{lib → es5/lib}/batches/table-batch-aggregator.js.map +0 -0
  67. package/dist/es5/lib/batches/table-batch-builder.js +187 -0
  68. package/dist/es5/lib/batches/table-batch-builder.js.map +1 -0
  69. package/dist/es5/lib/schema/impl/enum.js +56 -0
  70. package/dist/es5/lib/schema/impl/enum.js.map +1 -0
  71. package/dist/es5/lib/schema/impl/field.js +43 -0
  72. package/dist/es5/lib/schema/impl/field.js.map +1 -0
  73. package/dist/es5/lib/schema/impl/schema.js +103 -0
  74. package/dist/es5/lib/schema/impl/schema.js.map +1 -0
  75. package/dist/es5/lib/schema/impl/type.js +594 -0
  76. package/dist/es5/lib/schema/impl/type.js.map +1 -0
  77. package/dist/es5/lib/schema/schema.js +236 -0
  78. package/dist/es5/lib/schema/schema.js.map +1 -0
  79. package/dist/es5/lib/schema-utils/deduce-column-type.js +32 -0
  80. package/dist/es5/lib/schema-utils/deduce-column-type.js.map +1 -0
  81. package/dist/es5/lib/utils/assert.js +13 -0
  82. package/dist/es5/lib/utils/assert.js.map +1 -0
  83. package/dist/es5/lib/utils/async-queue.js +130 -0
  84. package/dist/es5/lib/utils/async-queue.js.map +1 -0
  85. package/dist/es5/lib/utils/row-utils.js +44 -0
  86. package/dist/es5/lib/utils/row-utils.js.map +1 -0
  87. package/dist/es5/types.js +2 -0
  88. package/dist/{types.js.map → es5/types.js.map} +0 -0
  89. package/dist/esm/bundle.js +5 -0
  90. package/dist/esm/bundle.js.map +1 -0
  91. package/dist/esm/category/common.js +2 -0
  92. package/dist/esm/category/common.js.map +1 -0
  93. package/dist/esm/category/gis.js +2 -0
  94. package/dist/esm/category/gis.js.map +1 -0
  95. package/dist/esm/category/mesh/convert-mesh.js +26 -0
  96. package/dist/esm/category/mesh/convert-mesh.js.map +1 -0
  97. package/dist/esm/category/mesh/deduce-mesh-schema.js +42 -0
  98. package/dist/esm/category/mesh/deduce-mesh-schema.js.map +1 -0
  99. package/dist/esm/category/mesh/mesh-to-arrow-table.js +2 -0
  100. package/dist/esm/category/mesh/mesh-to-arrow-table.js.map +1 -0
  101. package/dist/esm/category/mesh/mesh-types.js +2 -0
  102. package/dist/esm/category/mesh/mesh-types.js.map +1 -0
  103. package/dist/esm/category/mesh/mesh-utils.js +38 -0
  104. package/dist/esm/category/mesh/mesh-utils.js.map +1 -0
  105. package/dist/esm/category/table/deduce-table-schema.js +51 -0
  106. package/dist/esm/category/table/deduce-table-schema.js.map +1 -0
  107. package/dist/esm/category/table/table-types.js +2 -0
  108. package/dist/esm/category/table/table-types.js.map +1 -0
  109. package/dist/esm/index.js +13 -0
  110. package/dist/esm/index.js.map +1 -0
  111. package/dist/esm/lib/arrow/arrow-like-type-utils.js +32 -0
  112. package/dist/esm/lib/arrow/arrow-like-type-utils.js.map +1 -0
  113. package/dist/esm/lib/arrow/arrow-type-utils.js +2 -0
  114. package/dist/esm/lib/arrow/arrow-type-utils.js.map +1 -0
  115. package/dist/esm/lib/arrow/get-type-info.js +24 -0
  116. package/dist/esm/lib/arrow/get-type-info.js.map +1 -0
  117. package/dist/esm/lib/batches/base-table-batch-aggregator.js +74 -0
  118. package/dist/esm/lib/batches/base-table-batch-aggregator.js.map +1 -0
  119. package/dist/esm/lib/batches/columnar-table-batch-aggregator.js +100 -0
  120. package/dist/esm/lib/batches/columnar-table-batch-aggregator.js.map +1 -0
  121. package/dist/esm/lib/batches/row-table-batch-aggregator.js +95 -0
  122. package/dist/esm/lib/batches/row-table-batch-aggregator.js.map +1 -0
  123. package/dist/esm/lib/batches/table-batch-aggregator.js +2 -0
  124. package/dist/esm/lib/batches/table-batch-aggregator.js.map +1 -0
  125. package/dist/esm/lib/batches/table-batch-builder.js +182 -0
  126. package/dist/esm/lib/batches/table-batch-builder.js.map +1 -0
  127. package/dist/esm/lib/schema/impl/enum.js +49 -0
  128. package/dist/esm/lib/schema/impl/enum.js.map +1 -0
  129. package/dist/esm/lib/schema/impl/field.js +35 -0
  130. package/dist/esm/lib/schema/impl/field.js.map +1 -0
  131. package/dist/esm/lib/schema/impl/schema.js +92 -0
  132. package/dist/esm/lib/schema/impl/schema.js.map +1 -0
  133. package/dist/esm/lib/schema/impl/type.js +498 -0
  134. package/dist/esm/lib/schema/impl/type.js.map +1 -0
  135. package/dist/{lib/schema/index.js → esm/lib/schema/schema.js} +1 -1
  136. package/dist/esm/lib/schema/schema.js.map +1 -0
  137. package/dist/esm/lib/schema-utils/deduce-column-type.js +23 -0
  138. package/dist/esm/lib/schema-utils/deduce-column-type.js.map +1 -0
  139. package/dist/esm/lib/utils/assert.js +6 -0
  140. package/dist/esm/lib/utils/assert.js.map +1 -0
  141. package/dist/esm/lib/utils/async-queue.js +119 -0
  142. package/dist/esm/lib/utils/async-queue.js.map +1 -0
  143. package/dist/esm/lib/utils/row-utils.js +35 -0
  144. package/dist/esm/lib/utils/row-utils.js.map +1 -0
  145. package/dist/esm/types.js +2 -0
  146. package/dist/esm/types.js.map +1 -0
  147. package/dist/index.d.ts +23 -0
  148. package/dist/index.d.ts.map +1 -0
  149. package/dist/index.js +75 -13
  150. package/dist/lib/arrow/arrow-like-type-utils.d.ts +4 -0
  151. package/dist/lib/arrow/arrow-like-type-utils.d.ts.map +1 -0
  152. package/dist/lib/arrow/arrow-like-type-utils.js +26 -31
  153. package/dist/lib/arrow/arrow-type-utils.d.ts +1 -0
  154. package/dist/lib/arrow/arrow-type-utils.d.ts.map +1 -0
  155. package/dist/lib/arrow/arrow-type-utils.js +28 -20
  156. package/dist/lib/arrow/get-type-info.d.ts +14 -0
  157. package/dist/lib/arrow/get-type-info.d.ts.map +1 -0
  158. package/dist/lib/arrow/get-type-info.js +23 -19
  159. package/dist/lib/batches/base-table-batch-aggregator.d.ts +19 -0
  160. package/dist/lib/batches/base-table-batch-aggregator.d.ts.map +1 -0
  161. package/dist/lib/batches/base-table-batch-aggregator.js +52 -68
  162. package/dist/lib/batches/columnar-table-batch-aggregator.d.ts +23 -0
  163. package/dist/lib/batches/columnar-table-batch-aggregator.d.ts.map +1 -0
  164. package/dist/lib/batches/columnar-table-batch-aggregator.js +82 -92
  165. package/dist/lib/batches/row-table-batch-aggregator.d.ts +22 -0
  166. package/dist/lib/batches/row-table-batch-aggregator.d.ts.map +1 -0
  167. package/dist/lib/batches/row-table-batch-aggregator.js +72 -88
  168. package/dist/lib/batches/table-batch-aggregator.d.ts +25 -0
  169. package/dist/lib/batches/table-batch-aggregator.d.ts.map +1 -0
  170. package/dist/lib/batches/table-batch-aggregator.js +2 -2
  171. package/dist/lib/batches/table-batch-builder.d.ts +53 -0
  172. package/dist/lib/batches/table-batch-builder.d.ts.map +1 -0
  173. package/dist/lib/batches/table-batch-builder.js +137 -166
  174. package/dist/lib/schema/impl/enum.d.ts +92 -0
  175. package/dist/lib/schema/impl/enum.d.ts.map +1 -0
  176. package/dist/lib/schema/impl/enum.js +96 -48
  177. package/dist/lib/schema/impl/field.d.ts +19 -0
  178. package/dist/lib/schema/impl/field.d.ts.map +1 -0
  179. package/dist/lib/schema/impl/field.js +31 -34
  180. package/dist/lib/schema/impl/schema.d.ts +16 -0
  181. package/dist/lib/schema/impl/schema.d.ts.map +1 -0
  182. package/dist/lib/schema/impl/schema.js +72 -81
  183. package/dist/lib/schema/impl/type.d.ts +176 -0
  184. package/dist/lib/schema/impl/type.d.ts.map +1 -0
  185. package/dist/lib/schema/impl/type.js +454 -490
  186. package/dist/lib/schema/schema.d.ts +5 -0
  187. package/dist/lib/schema/schema.d.ts.map +1 -0
  188. package/dist/lib/schema/schema.js +90 -0
  189. package/dist/lib/schema-utils/deduce-column-type.d.ts +3 -0
  190. package/dist/lib/schema-utils/deduce-column-type.d.ts.map +1 -0
  191. package/dist/lib/schema-utils/deduce-column-type.js +89 -20
  192. package/dist/lib/utils/assert.d.ts +2 -0
  193. package/dist/lib/utils/assert.d.ts.map +1 -0
  194. package/dist/lib/utils/assert.js +11 -5
  195. package/dist/lib/utils/async-queue.d.ts +18 -0
  196. package/dist/lib/utils/async-queue.d.ts.map +1 -0
  197. package/dist/lib/utils/async-queue.js +82 -109
  198. package/dist/lib/utils/row-utils.d.ts +9 -0
  199. package/dist/lib/utils/row-utils.d.ts.map +1 -0
  200. package/dist/lib/utils/row-utils.js +31 -33
  201. package/dist/types.d.ts +8 -0
  202. package/dist/types.d.ts.map +1 -0
  203. package/dist/types.js +2 -2
  204. package/package.json +7 -9
  205. package/src/category/common.ts +2 -1
  206. package/src/category/mesh/convert-mesh.ts +6 -6
  207. package/src/category/mesh/deduce-mesh-schema.ts +1 -1
  208. package/src/category/mesh/mesh-to-arrow-table.ts +4 -2
  209. package/src/category/mesh/mesh-types.ts +1 -1
  210. package/src/category/table/deduce-table-schema.ts +1 -1
  211. package/src/category/table/table-types.ts +5 -2
  212. package/src/index.ts +1 -1
  213. package/src/lib/arrow/arrow-like-type-utils.ts +11 -1
  214. package/src/lib/arrow/arrow-type-utils.ts +3 -1
  215. package/src/lib/arrow/get-type-info.ts +1 -1
  216. package/src/lib/batches/base-table-batch-aggregator.ts +1 -1
  217. package/src/lib/batches/columnar-table-batch-aggregator.ts +1 -1
  218. package/src/lib/batches/row-table-batch-aggregator.ts +1 -1
  219. package/src/lib/batches/table-batch-aggregator.ts +1 -1
  220. package/src/lib/batches/table-batch-builder.ts +2 -2
  221. package/src/lib/schema/impl/schema.ts +2 -2
  222. package/src/lib/schema/impl/type.ts +2 -2
  223. package/src/lib/schema/{index.ts → schema.ts} +0 -0
  224. package/src/lib/schema-utils/deduce-column-type.ts +6 -2
  225. package/src/lib/utils/async-queue.ts +7 -4
  226. package/dist/bundle.js.map +0 -1
  227. package/dist/category/mesh/convert-mesh.js.map +0 -1
  228. package/dist/category/mesh/deduce-mesh-schema.js.map +0 -1
  229. package/dist/category/mesh/mesh-to-arrow-table.js.map +0 -1
  230. package/dist/category/mesh/mesh-utils.js.map +0 -1
  231. package/dist/category/table/deduce-table-schema.js.map +0 -1
  232. package/dist/dist.min.js +0 -2
  233. package/dist/dist.min.js.map +0 -1
  234. package/dist/index.js.map +0 -1
  235. package/dist/lib/arrow/arrow-like-type-utils.js.map +0 -1
  236. package/dist/lib/arrow/arrow-type-utils.js.map +0 -1
  237. package/dist/lib/arrow/get-type-info.js.map +0 -1
  238. package/dist/lib/batches/base-table-batch-aggregator.js.map +0 -1
  239. package/dist/lib/batches/columnar-table-batch-aggregator.js.map +0 -1
  240. package/dist/lib/batches/row-table-batch-aggregator.js.map +0 -1
  241. package/dist/lib/batches/table-batch-builder.js.map +0 -1
  242. package/dist/lib/schema/impl/enum.js.map +0 -1
  243. package/dist/lib/schema/impl/field.js.map +0 -1
  244. package/dist/lib/schema/impl/schema.js.map +0 -1
  245. package/dist/lib/schema/impl/type.js.map +0 -1
  246. package/dist/lib/schema/index.js.map +0 -1
  247. package/dist/lib/schema-utils/deduce-column-type.js.map +0 -1
  248. package/dist/lib/utils/assert.js.map +0 -1
  249. package/dist/lib/utils/async-queue.js.map +0 -1
  250. package/dist/lib/utils/row-utils.js.map +0 -1
@@ -0,0 +1,344 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "TableBatchBuilder", {
9
+ enumerable: true,
10
+ get: function () {
11
+ return _tableBatchBuilder.default;
12
+ }
13
+ });
14
+ Object.defineProperty(exports, "RowTableBatchAggregator", {
15
+ enumerable: true,
16
+ get: function () {
17
+ return _rowTableBatchAggregator.default;
18
+ }
19
+ });
20
+ Object.defineProperty(exports, "ColumnarTableBatchAggregator", {
21
+ enumerable: true,
22
+ get: function () {
23
+ return _columnarTableBatchAggregator.default;
24
+ }
25
+ });
26
+ Object.defineProperty(exports, "convertToObjectRow", {
27
+ enumerable: true,
28
+ get: function () {
29
+ return _rowUtils.convertToObjectRow;
30
+ }
31
+ });
32
+ Object.defineProperty(exports, "convertToArrayRow", {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _rowUtils.convertToArrayRow;
36
+ }
37
+ });
38
+ Object.defineProperty(exports, "getMeshSize", {
39
+ enumerable: true,
40
+ get: function () {
41
+ return _meshUtils.getMeshSize;
42
+ }
43
+ });
44
+ Object.defineProperty(exports, "getMeshBoundingBox", {
45
+ enumerable: true,
46
+ get: function () {
47
+ return _meshUtils.getMeshBoundingBox;
48
+ }
49
+ });
50
+ Object.defineProperty(exports, "convertMesh", {
51
+ enumerable: true,
52
+ get: function () {
53
+ return _convertMesh.convertMesh;
54
+ }
55
+ });
56
+ Object.defineProperty(exports, "deduceMeshSchema", {
57
+ enumerable: true,
58
+ get: function () {
59
+ return _deduceMeshSchema.deduceMeshSchema;
60
+ }
61
+ });
62
+ Object.defineProperty(exports, "deduceMeshField", {
63
+ enumerable: true,
64
+ get: function () {
65
+ return _deduceMeshSchema.deduceMeshField;
66
+ }
67
+ });
68
+ Object.defineProperty(exports, "makeMeshAttributeMetadata", {
69
+ enumerable: true,
70
+ get: function () {
71
+ return _deduceMeshSchema.makeMeshAttributeMetadata;
72
+ }
73
+ });
74
+ Object.defineProperty(exports, "Schema", {
75
+ enumerable: true,
76
+ get: function () {
77
+ return _schema.Schema;
78
+ }
79
+ });
80
+ Object.defineProperty(exports, "Field", {
81
+ enumerable: true,
82
+ get: function () {
83
+ return _schema.Field;
84
+ }
85
+ });
86
+ Object.defineProperty(exports, "DataType", {
87
+ enumerable: true,
88
+ get: function () {
89
+ return _schema.DataType;
90
+ }
91
+ });
92
+ Object.defineProperty(exports, "Null", {
93
+ enumerable: true,
94
+ get: function () {
95
+ return _schema.Null;
96
+ }
97
+ });
98
+ Object.defineProperty(exports, "Binary", {
99
+ enumerable: true,
100
+ get: function () {
101
+ return _schema.Binary;
102
+ }
103
+ });
104
+ Object.defineProperty(exports, "Bool", {
105
+ enumerable: true,
106
+ get: function () {
107
+ return _schema.Bool;
108
+ }
109
+ });
110
+ Object.defineProperty(exports, "Int", {
111
+ enumerable: true,
112
+ get: function () {
113
+ return _schema.Int;
114
+ }
115
+ });
116
+ Object.defineProperty(exports, "Int8", {
117
+ enumerable: true,
118
+ get: function () {
119
+ return _schema.Int8;
120
+ }
121
+ });
122
+ Object.defineProperty(exports, "Int16", {
123
+ enumerable: true,
124
+ get: function () {
125
+ return _schema.Int16;
126
+ }
127
+ });
128
+ Object.defineProperty(exports, "Int32", {
129
+ enumerable: true,
130
+ get: function () {
131
+ return _schema.Int32;
132
+ }
133
+ });
134
+ Object.defineProperty(exports, "Int64", {
135
+ enumerable: true,
136
+ get: function () {
137
+ return _schema.Int64;
138
+ }
139
+ });
140
+ Object.defineProperty(exports, "Uint8", {
141
+ enumerable: true,
142
+ get: function () {
143
+ return _schema.Uint8;
144
+ }
145
+ });
146
+ Object.defineProperty(exports, "Uint16", {
147
+ enumerable: true,
148
+ get: function () {
149
+ return _schema.Uint16;
150
+ }
151
+ });
152
+ Object.defineProperty(exports, "Uint32", {
153
+ enumerable: true,
154
+ get: function () {
155
+ return _schema.Uint32;
156
+ }
157
+ });
158
+ Object.defineProperty(exports, "Uint64", {
159
+ enumerable: true,
160
+ get: function () {
161
+ return _schema.Uint64;
162
+ }
163
+ });
164
+ Object.defineProperty(exports, "Float", {
165
+ enumerable: true,
166
+ get: function () {
167
+ return _schema.Float;
168
+ }
169
+ });
170
+ Object.defineProperty(exports, "Float16", {
171
+ enumerable: true,
172
+ get: function () {
173
+ return _schema.Float16;
174
+ }
175
+ });
176
+ Object.defineProperty(exports, "Float32", {
177
+ enumerable: true,
178
+ get: function () {
179
+ return _schema.Float32;
180
+ }
181
+ });
182
+ Object.defineProperty(exports, "Float64", {
183
+ enumerable: true,
184
+ get: function () {
185
+ return _schema.Float64;
186
+ }
187
+ });
188
+ Object.defineProperty(exports, "Utf8", {
189
+ enumerable: true,
190
+ get: function () {
191
+ return _schema.Utf8;
192
+ }
193
+ });
194
+ Object.defineProperty(exports, "Date", {
195
+ enumerable: true,
196
+ get: function () {
197
+ return _schema.Date;
198
+ }
199
+ });
200
+ Object.defineProperty(exports, "DateDay", {
201
+ enumerable: true,
202
+ get: function () {
203
+ return _schema.DateDay;
204
+ }
205
+ });
206
+ Object.defineProperty(exports, "DateMillisecond", {
207
+ enumerable: true,
208
+ get: function () {
209
+ return _schema.DateMillisecond;
210
+ }
211
+ });
212
+ Object.defineProperty(exports, "Time", {
213
+ enumerable: true,
214
+ get: function () {
215
+ return _schema.Time;
216
+ }
217
+ });
218
+ Object.defineProperty(exports, "TimeMillisecond", {
219
+ enumerable: true,
220
+ get: function () {
221
+ return _schema.TimeMillisecond;
222
+ }
223
+ });
224
+ Object.defineProperty(exports, "TimeSecond", {
225
+ enumerable: true,
226
+ get: function () {
227
+ return _schema.TimeSecond;
228
+ }
229
+ });
230
+ Object.defineProperty(exports, "Timestamp", {
231
+ enumerable: true,
232
+ get: function () {
233
+ return _schema.Timestamp;
234
+ }
235
+ });
236
+ Object.defineProperty(exports, "TimestampSecond", {
237
+ enumerable: true,
238
+ get: function () {
239
+ return _schema.TimestampSecond;
240
+ }
241
+ });
242
+ Object.defineProperty(exports, "TimestampMillisecond", {
243
+ enumerable: true,
244
+ get: function () {
245
+ return _schema.TimestampMillisecond;
246
+ }
247
+ });
248
+ Object.defineProperty(exports, "TimestampMicrosecond", {
249
+ enumerable: true,
250
+ get: function () {
251
+ return _schema.TimestampMicrosecond;
252
+ }
253
+ });
254
+ Object.defineProperty(exports, "TimestampNanosecond", {
255
+ enumerable: true,
256
+ get: function () {
257
+ return _schema.TimestampNanosecond;
258
+ }
259
+ });
260
+ Object.defineProperty(exports, "Interval", {
261
+ enumerable: true,
262
+ get: function () {
263
+ return _schema.Interval;
264
+ }
265
+ });
266
+ Object.defineProperty(exports, "IntervalDayTime", {
267
+ enumerable: true,
268
+ get: function () {
269
+ return _schema.IntervalDayTime;
270
+ }
271
+ });
272
+ Object.defineProperty(exports, "IntervalYearMonth", {
273
+ enumerable: true,
274
+ get: function () {
275
+ return _schema.IntervalYearMonth;
276
+ }
277
+ });
278
+ Object.defineProperty(exports, "FixedSizeList", {
279
+ enumerable: true,
280
+ get: function () {
281
+ return _schema.FixedSizeList;
282
+ }
283
+ });
284
+ Object.defineProperty(exports, "Struct", {
285
+ enumerable: true,
286
+ get: function () {
287
+ return _schema.Struct;
288
+ }
289
+ });
290
+ Object.defineProperty(exports, "deduceTypeFromColumn", {
291
+ enumerable: true,
292
+ get: function () {
293
+ return _deduceColumnType.deduceTypeFromColumn;
294
+ }
295
+ });
296
+ Object.defineProperty(exports, "deduceTypeFromValue", {
297
+ enumerable: true,
298
+ get: function () {
299
+ return _deduceColumnType.deduceTypeFromValue;
300
+ }
301
+ });
302
+ Object.defineProperty(exports, "getTypeInfo", {
303
+ enumerable: true,
304
+ get: function () {
305
+ return _getTypeInfo.getTypeInfo;
306
+ }
307
+ });
308
+ Object.defineProperty(exports, "getArrowTypeFromTypedArray", {
309
+ enumerable: true,
310
+ get: function () {
311
+ return _arrowLikeTypeUtils.getArrowTypeFromTypedArray;
312
+ }
313
+ });
314
+ Object.defineProperty(exports, "AsyncQueue", {
315
+ enumerable: true,
316
+ get: function () {
317
+ return _asyncQueue.default;
318
+ }
319
+ });
320
+
321
+ var _tableBatchBuilder = _interopRequireDefault(require("./lib/batches/table-batch-builder"));
322
+
323
+ var _rowTableBatchAggregator = _interopRequireDefault(require("./lib/batches/row-table-batch-aggregator"));
324
+
325
+ var _columnarTableBatchAggregator = _interopRequireDefault(require("./lib/batches/columnar-table-batch-aggregator"));
326
+
327
+ var _rowUtils = require("./lib/utils/row-utils");
328
+
329
+ var _meshUtils = require("./category/mesh/mesh-utils");
330
+
331
+ var _convertMesh = require("./category/mesh/convert-mesh");
332
+
333
+ var _deduceMeshSchema = require("./category/mesh/deduce-mesh-schema");
334
+
335
+ var _schema = require("./lib/schema/schema");
336
+
337
+ var _deduceColumnType = require("./lib/schema-utils/deduce-column-type");
338
+
339
+ var _getTypeInfo = require("./lib/arrow/get-type-info");
340
+
341
+ var _arrowLikeTypeUtils = require("./lib/arrow/arrow-like-type-utils");
342
+
343
+ var _asyncQueue = _interopRequireDefault(require("./lib/utils/async-queue"));
344
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA;;AAEA;;AACA;;AAEA;;AAYA;;AACA;;AACA;;AAmCA;;AA0CA;;AACA;;AACA;;AAEA","sourcesContent":["// COMMON CATEGORY\nexport type {TypedArray, NumberArray, AnyArray} from './types';\n\nexport type {Batch} from './category/common';\n\n// TABLE CATEGORY TYPES\n\nexport type {\n Table,\n ArrayRowTable,\n ObjectRowTable,\n ColumnarTable,\n ArrowTable\n} from './category/table/table-types';\nexport type {\n TableBatch,\n RowArrayTableBatch,\n RowObjectTableBatch,\n ColumnarTableBatch,\n ArrowTableBatch\n} from './category/table/table-types';\n\n// TABLE CATEGORY UTILS\nexport {default as TableBatchBuilder} from './lib/batches/table-batch-builder';\nexport type {TableBatchAggregator} from './lib/batches/table-batch-aggregator';\nexport {default as RowTableBatchAggregator} from './lib/batches/row-table-batch-aggregator';\nexport {default as ColumnarTableBatchAggregator} from './lib/batches/columnar-table-batch-aggregator';\n\nexport {convertToObjectRow, convertToArrayRow} from './lib/utils/row-utils';\n\n// MESH CATEGORY\nexport type {\n MeshTable,\n MeshArrowTable,\n Mesh,\n MeshGeometry,\n MeshAttribute,\n MeshAttributes\n} from './category/mesh/mesh-types';\n\nexport {getMeshSize, getMeshBoundingBox} from './category/mesh/mesh-utils';\nexport {convertMesh} from './category/mesh/convert-mesh';\nexport {\n deduceMeshSchema,\n deduceMeshField,\n makeMeshAttributeMetadata\n} from './category/mesh/deduce-mesh-schema';\n\n// TYPES\n// GIS CATEGORY - GEOJSON\nexport type {GeoJSON, Feature, Geometry, Position, GeoJsonProperties} from './category/gis';\nexport type {\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n Polygon,\n MultiPolygon\n} from './category/gis';\n\n// GIS CATEGORY - BINARY\nexport type {\n BinaryGeometryType,\n BinaryGeometry,\n BinaryPointGeometry,\n BinaryLineGeometry,\n BinaryPolygonGeometry,\n BinaryAttribute\n} from './category/gis';\nexport type {\n BinaryFeatures,\n BinaryPointFeatures,\n BinaryLineFeatures,\n BinaryPolygonFeatures\n} from './category/gis';\n\n// SCHEMA\nexport {\n Schema,\n Field,\n DataType,\n Null,\n Binary,\n Bool,\n Int,\n Int8,\n Int16,\n Int32,\n Int64,\n Uint8,\n Uint16,\n Uint32,\n Uint64,\n Float,\n Float16,\n Float32,\n Float64,\n Utf8,\n Date,\n DateDay,\n DateMillisecond,\n Time,\n TimeMillisecond,\n TimeSecond,\n Timestamp,\n TimestampSecond,\n TimestampMillisecond,\n TimestampMicrosecond,\n TimestampNanosecond,\n Interval,\n IntervalDayTime,\n IntervalYearMonth,\n FixedSizeList,\n Struct\n} from './lib/schema/schema';\n\n// EXPERIMENTAL APIs\n\n// SCHEMA UTILS\nexport {deduceTypeFromColumn, deduceTypeFromValue} from './lib/schema-utils/deduce-column-type';\nexport {getTypeInfo} from './lib/arrow/get-type-info';\nexport {getArrowTypeFromTypedArray} from './lib/arrow/arrow-like-type-utils';\n\nexport {default as AsyncQueue} from './lib/utils/async-queue';\n"],"file":"index.js"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getArrowTypeFromTypedArray = getArrowTypeFromTypedArray;
7
+
8
+ var _schema = require("../schema/schema");
9
+
10
+ function getArrowTypeFromTypedArray(array) {
11
+ switch (array.constructor) {
12
+ case Int8Array:
13
+ return new _schema.Int8();
14
+
15
+ case Uint8Array:
16
+ return new _schema.Uint8();
17
+
18
+ case Int16Array:
19
+ return new _schema.Int16();
20
+
21
+ case Uint16Array:
22
+ return new _schema.Uint16();
23
+
24
+ case Int32Array:
25
+ return new _schema.Int32();
26
+
27
+ case Uint32Array:
28
+ return new _schema.Uint32();
29
+
30
+ case Float32Array:
31
+ return new _schema.Float32();
32
+
33
+ case Float64Array:
34
+ return new _schema.Float64();
35
+
36
+ default:
37
+ throw new Error('array type not supported');
38
+ }
39
+ }
40
+ //# sourceMappingURL=arrow-like-type-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lib/arrow/arrow-like-type-utils.ts"],"names":["getArrowTypeFromTypedArray","array","constructor","Int8Array","Int8","Uint8Array","Uint8","Int16Array","Int16","Uint16Array","Uint16","Int32Array","Int32","Uint32Array","Uint32","Float32Array","Float32","Float64Array","Float64","Error"],"mappings":";;;;;;;AACA;;AAYO,SAASA,0BAAT,CAAoCC,KAApC,EAAiE;AACtE,UAAQA,KAAK,CAACC,WAAd;AACE,SAAKC,SAAL;AACE,aAAO,IAAIC,YAAJ,EAAP;;AACF,SAAKC,UAAL;AACE,aAAO,IAAIC,aAAJ,EAAP;;AACF,SAAKC,UAAL;AACE,aAAO,IAAIC,aAAJ,EAAP;;AACF,SAAKC,WAAL;AACE,aAAO,IAAIC,cAAJ,EAAP;;AACF,SAAKC,UAAL;AACE,aAAO,IAAIC,aAAJ,EAAP;;AACF,SAAKC,WAAL;AACE,aAAO,IAAIC,cAAJ,EAAP;;AACF,SAAKC,YAAL;AACE,aAAO,IAAIC,eAAJ,EAAP;;AACF,SAAKC,YAAL;AACE,aAAO,IAAIC,eAAJ,EAAP;;AACF;AACE,YAAM,IAAIC,KAAJ,CAAU,0BAAV,CAAN;AAlBJ;AAoBD","sourcesContent":["import type {TypedArray} from '../../types';\nimport {\n DataType,\n Float32,\n Float64,\n Int16,\n Int32,\n Int8,\n Uint16,\n Uint32,\n Uint8\n} from '../schema/schema';\n\nexport function getArrowTypeFromTypedArray(array: TypedArray): DataType {\n switch (array.constructor) {\n case Int8Array:\n return new Int8();\n case Uint8Array:\n return new Uint8();\n case Int16Array:\n return new Int16();\n case Uint16Array:\n return new Uint16();\n case Int32Array:\n return new Int32();\n case Uint32Array:\n return new Uint32();\n case Float32Array:\n return new Float32();\n case Float64Array:\n return new Float64();\n default:\n throw new Error('array type not supported');\n }\n}\n"],"file":"arrow-like-type-utils.js"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=arrow-type-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"arrow-type-utils.js"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getTypeInfo = getTypeInfo;
7
+
8
+ var _schema = require("../schema/schema");
9
+
10
+ function getTypeInfo(arrowTypeLike) {
11
+ return {
12
+ typeId: arrowTypeLike.typeId,
13
+ ArrayType: arrowTypeLike.ArrayType,
14
+ typeName: arrowTypeLike.toString(),
15
+ typeEnumName: getTypeKey(arrowTypeLike.typeId),
16
+ precision: arrowTypeLike.precision
17
+ };
18
+ }
19
+
20
+ let ReverseType = null;
21
+
22
+ function getTypeKey(typeKey) {
23
+ if (!ReverseType) {
24
+ ReverseType = {};
25
+
26
+ for (const key in _schema.Type) {
27
+ ReverseType[_schema.Type[key]] = key;
28
+ }
29
+ }
30
+
31
+ return ReverseType[typeKey];
32
+ }
33
+ //# sourceMappingURL=get-type-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lib/arrow/get-type-info.ts"],"names":["getTypeInfo","arrowTypeLike","typeId","ArrayType","typeName","toString","typeEnumName","getTypeKey","precision","ReverseType","typeKey","key","Type"],"mappings":";;;;;;;AAAA;;AAOO,SAASA,WAAT,CAAqBC,aAArB,EAML;AACA,SAAO;AACLC,IAAAA,MAAM,EAAED,aAAa,CAACC,MADjB;AAELC,IAAAA,SAAS,EAAEF,aAAa,CAACE,SAFpB;AAGLC,IAAAA,QAAQ,EAAEH,aAAa,CAACI,QAAd,EAHL;AAILC,IAAAA,YAAY,EAAEC,UAAU,CAACN,aAAa,CAACC,MAAf,CAJnB;AAKLM,IAAAA,SAAS,EAAEP,aAAa,CAACO;AALpB,GAAP;AAOD;;AAED,IAAIC,WAA2C,GAAG,IAAlD;;AAEA,SAASF,UAAT,CAAoBG,OAApB,EAA6B;AAC3B,MAAI,CAACD,WAAL,EAAkB;AAChBA,IAAAA,WAAW,GAAG,EAAd;;AACA,SAAK,MAAME,GAAX,IAAkBC,YAAlB,EAAwB;AACtBH,MAAAA,WAAW,CAACG,aAAKD,GAAL,CAAD,CAAX,GAAyBA,GAAzB;AACD;AACF;;AAED,SAAOF,WAAW,CAACC,OAAD,CAAlB;AACD","sourcesContent":["import {Type} from '../schema/schema';\nimport {AnyArray} from '../../types';\n\n/**\n * Gets type information from an Arrow type object or \"mock\" Arrow type object\n * @param arrowTypeLike Arrow Type or type object of similar shape\n */\nexport function getTypeInfo(arrowTypeLike: any): {\n typeId: Type;\n ArrayType: AnyArray;\n typeName: string;\n typeEnumName?: string;\n precision?: number;\n} {\n return {\n typeId: arrowTypeLike.typeId,\n ArrayType: arrowTypeLike.ArrayType,\n typeName: arrowTypeLike.toString(),\n typeEnumName: getTypeKey(arrowTypeLike.typeId),\n precision: arrowTypeLike.precision\n };\n}\n\nlet ReverseType: {[key: string]: string} | null = null;\n\nfunction getTypeKey(typeKey) {\n if (!ReverseType) {\n ReverseType = {};\n for (const key in Type) {\n ReverseType[Type[key]] = key;\n }\n }\n\n return ReverseType[typeKey];\n}\n"],"file":"get-type-info.js"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ const DEFAULT_ROW_COUNT = 100;
13
+
14
+ class RowTableBatchAggregator {
15
+ constructor(schema, options) {
16
+ (0, _defineProperty2.default)(this, "schema", void 0);
17
+ (0, _defineProperty2.default)(this, "options", void 0);
18
+ (0, _defineProperty2.default)(this, "length", 0);
19
+ (0, _defineProperty2.default)(this, "rows", null);
20
+ (0, _defineProperty2.default)(this, "cursor", 0);
21
+ (0, _defineProperty2.default)(this, "_headers", []);
22
+ this.options = options;
23
+ this.schema = schema;
24
+
25
+ if (!Array.isArray(schema)) {
26
+ this._headers = [];
27
+
28
+ for (const key in schema) {
29
+ this._headers[schema[key].index] = schema[key].name;
30
+ }
31
+ }
32
+ }
33
+
34
+ rowCount() {
35
+ return this.length;
36
+ }
37
+
38
+ addArrayRow(row, cursor) {
39
+ if (Number.isFinite(cursor)) {
40
+ this.cursor = cursor;
41
+ }
42
+
43
+ this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
44
+ this.rows[this.length] = row;
45
+ this.length++;
46
+ }
47
+
48
+ addObjectRow(row, cursor) {
49
+ if (Number.isFinite(cursor)) {
50
+ this.cursor = cursor;
51
+ }
52
+
53
+ this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
54
+ this.rows[this.length] = row;
55
+ this.length++;
56
+ }
57
+
58
+ getBatch() {
59
+ let rows = this.rows;
60
+
61
+ if (!rows) {
62
+ return null;
63
+ }
64
+
65
+ rows = rows.slice(0, this.length);
66
+ this.rows = null;
67
+ const batch = {
68
+ shape: this.options.shape,
69
+ batchType: 'data',
70
+ data: rows,
71
+ length: this.length,
72
+ schema: this.schema,
73
+ cursor: this.cursor
74
+ };
75
+ return batch;
76
+ }
77
+
78
+ }
79
+
80
+ exports.default = RowTableBatchAggregator;
81
+ //# sourceMappingURL=base-table-batch-aggregator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lib/batches/base-table-batch-aggregator.ts"],"names":["DEFAULT_ROW_COUNT","RowTableBatchAggregator","constructor","schema","options","Array","isArray","_headers","key","index","name","rowCount","length","addArrayRow","row","cursor","Number","isFinite","rows","addObjectRow","getBatch","slice","batch","shape","batchType","data"],"mappings":";;;;;;;;;;;AAIA,MAAMA,iBAAiB,GAAG,GAA1B;;AAEe,MAAMC,uBAAN,CAA8D;AAS3EC,EAAAA,WAAW,CAACC,MAAD,EAAiBC,OAAjB,EAA6C;AAAA;AAAA;AAAA,kDALvC,CAKuC;AAAA,gDAJnC,IAImC;AAAA,kDAHvC,CAGuC;AAAA,oDAF3B,EAE2B;AACtD,SAAKA,OAAL,GAAeA,OAAf;AACA,SAAKD,MAAL,GAAcA,MAAd;;AAIA,QAAI,CAACE,KAAK,CAACC,OAAN,CAAcH,MAAd,CAAL,EAA4B;AAC1B,WAAKI,QAAL,GAAgB,EAAhB;;AACA,WAAK,MAAMC,GAAX,IAAkBL,MAAlB,EAA0B;AACxB,aAAKI,QAAL,CAAcJ,MAAM,CAACK,GAAD,CAAN,CAAYC,KAA1B,IAAmCN,MAAM,CAACK,GAAD,CAAN,CAAYE,IAA/C;AACD;AACF;AACF;;AAEDC,EAAAA,QAAQ,GAAW;AACjB,WAAO,KAAKC,MAAZ;AACD;;AAEDC,EAAAA,WAAW,CAACC,GAAD,EAAaC,MAAb,EAAoC;AAC7C,QAAIC,MAAM,CAACC,QAAP,CAAgBF,MAAhB,CAAJ,EAA6B;AAC3B,WAAKA,MAAL,GAAcA,MAAd;AACD;;AAED,SAAKG,IAAL,GAAY,KAAKA,IAAL,IAAa,IAAIb,KAAJ,CAAUL,iBAAV,CAAzB;AACA,SAAKkB,IAAL,CAAU,KAAKN,MAAf,IAAyBE,GAAzB;AACA,SAAKF,MAAL;AACD;;AAEDO,EAAAA,YAAY,CAACL,GAAD,EAAmCC,MAAnC,EAA0D;AACpE,QAAIC,MAAM,CAACC,QAAP,CAAgBF,MAAhB,CAAJ,EAA6B;AAC3B,WAAKA,MAAL,GAAcA,MAAd;AACD;;AAED,SAAKG,IAAL,GAAY,KAAKA,IAAL,IAAa,IAAIb,KAAJ,CAAUL,iBAAV,CAAzB;AACA,SAAKkB,IAAL,CAAU,KAAKN,MAAf,IAAyBE,GAAzB;AACA,SAAKF,MAAL;AACD;;AAEDQ,EAAAA,QAAQ,GAAsB;AAC5B,QAAIF,IAAI,GAAG,KAAKA,IAAhB;;AACA,QAAI,CAACA,IAAL,EAAW;AACT,aAAO,IAAP;AACD;;AAEDA,IAAAA,IAAI,GAAGA,IAAI,CAACG,KAAL,CAAW,CAAX,EAAc,KAAKT,MAAnB,CAAP;AACA,SAAKM,IAAL,GAAY,IAAZ;AAEA,UAAMI,KAAiB,GAAG;AACxBC,MAAAA,KAAK,EAAE,KAAKnB,OAAL,CAAamB,KADI;AAExBC,MAAAA,SAAS,EAAE,MAFa;AAGxBC,MAAAA,IAAI,EAAEP,IAHkB;AAIxBN,MAAAA,MAAM,EAAE,KAAKA,MAJW;AAKxBT,MAAAA,MAAM,EAAE,KAAKA,MALW;AAMxBY,MAAAA,MAAM,EAAE,KAAKA;AANW,KAA1B;AASA,WAAOO,KAAP;AACD;;AAlE0E","sourcesContent":["import type {Schema} from '../schema/schema';\nimport type {TableBatch} from '../../category/table/table-types';\nimport {TableBatchAggregator, TableBatchOptions} from './table-batch-aggregator';\n\nconst DEFAULT_ROW_COUNT = 100;\n\nexport default class RowTableBatchAggregator implements TableBatchAggregator {\n schema: Schema;\n options: TableBatchOptions;\n\n length: number = 0;\n rows: any[] | null = null;\n cursor: number = 0;\n private _headers: string[] = [];\n\n constructor(schema: Schema, options: TableBatchOptions) {\n this.options = options;\n this.schema = schema;\n\n // schema is an array if there're no headers\n // object if there are headers\n if (!Array.isArray(schema)) {\n this._headers = [];\n for (const key in schema) {\n this._headers[schema[key].index] = schema[key].name;\n }\n }\n }\n\n rowCount(): number {\n return this.length;\n }\n\n addArrayRow(row: any[], cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);\n this.rows[this.length] = row;\n this.length++;\n }\n\n addObjectRow(row: {[columnName: string]: any}, cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);\n this.rows[this.length] = row;\n this.length++;\n }\n\n getBatch(): TableBatch | null {\n let rows = this.rows;\n if (!rows) {\n return null;\n }\n\n rows = rows.slice(0, this.length);\n this.rows = null;\n\n const batch: TableBatch = {\n shape: this.options.shape,\n batchType: 'data',\n data: rows,\n length: this.length,\n schema: this.schema,\n cursor: this.cursor\n };\n\n return batch;\n }\n}\n"],"file":"base-table-batch-aggregator.js"}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ const DEFAULT_ROW_COUNT = 100;
13
+
14
+ class ColumnarTableBatchAggregator {
15
+ constructor(schema, options) {
16
+ (0, _defineProperty2.default)(this, "schema", void 0);
17
+ (0, _defineProperty2.default)(this, "length", 0);
18
+ (0, _defineProperty2.default)(this, "allocated", 0);
19
+ (0, _defineProperty2.default)(this, "columns", {});
20
+ this.schema = schema;
21
+
22
+ this._reallocateColumns();
23
+ }
24
+
25
+ rowCount() {
26
+ return this.length;
27
+ }
28
+
29
+ addArrayRow(row) {
30
+ this._reallocateColumns();
31
+
32
+ let i = 0;
33
+
34
+ for (const fieldName in this.columns) {
35
+ this.columns[fieldName][this.length] = row[i++];
36
+ }
37
+
38
+ this.length++;
39
+ }
40
+
41
+ addObjectRow(row) {
42
+ this._reallocateColumns();
43
+
44
+ for (const fieldName in row) {
45
+ this.columns[fieldName][this.length] = row[fieldName];
46
+ }
47
+
48
+ this.length++;
49
+ }
50
+
51
+ getBatch() {
52
+ this._pruneColumns();
53
+
54
+ const columns = Array.isArray(this.schema) ? this.columns : {};
55
+
56
+ if (!Array.isArray(this.schema)) {
57
+ for (const fieldName in this.schema) {
58
+ const field = this.schema[fieldName];
59
+ columns[field.name] = this.columns[field.index];
60
+ }
61
+ }
62
+
63
+ this.columns = {};
64
+ const batch = {
65
+ shape: 'columnar-table',
66
+ batchType: 'data',
67
+ data: columns,
68
+ schema: this.schema,
69
+ length: this.length
70
+ };
71
+ return batch;
72
+ }
73
+
74
+ _reallocateColumns() {
75
+ if (this.length < this.allocated) {
76
+ return;
77
+ }
78
+
79
+ this.allocated = this.allocated > 0 ? this.allocated *= 2 : DEFAULT_ROW_COUNT;
80
+ this.columns = {};
81
+
82
+ for (const fieldName in this.schema) {
83
+ const field = this.schema[fieldName];
84
+ const ArrayType = field.type || Float32Array;
85
+ const oldColumn = this.columns[field.index];
86
+
87
+ if (oldColumn && ArrayBuffer.isView(oldColumn)) {
88
+ const typedArray = new ArrayType(this.allocated);
89
+ typedArray.set(oldColumn);
90
+ this.columns[field.index] = typedArray;
91
+ } else if (oldColumn) {
92
+ oldColumn.length = this.allocated;
93
+ this.columns[field.index] = oldColumn;
94
+ } else {
95
+ this.columns[field.index] = new ArrayType(this.allocated);
96
+ }
97
+ }
98
+ }
99
+
100
+ _pruneColumns() {
101
+ for (const [columnName, column] of Object.entries(this.columns)) {
102
+ this.columns[columnName] = column.slice(0, this.length);
103
+ }
104
+ }
105
+
106
+ }
107
+
108
+ exports.default = ColumnarTableBatchAggregator;
109
+ //# sourceMappingURL=columnar-table-batch-aggregator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lib/batches/columnar-table-batch-aggregator.ts"],"names":["DEFAULT_ROW_COUNT","ColumnarTableBatchAggregator","constructor","schema","options","_reallocateColumns","rowCount","length","addArrayRow","row","i","fieldName","columns","addObjectRow","getBatch","_pruneColumns","Array","isArray","field","name","index","batch","shape","batchType","data","allocated","ArrayType","type","Float32Array","oldColumn","ArrayBuffer","isView","typedArray","set","columnName","column","Object","entries","slice"],"mappings":"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","sourcesContent":["import type {Schema} from '../schema/schema';\nimport type {ColumnarTableBatch, ArrowTableBatch} from '../../category/table/table-types';\nimport {TableBatchAggregator} from './table-batch-aggregator';\n\ntype ColumnarTableBatchOptions = {};\n\nconst DEFAULT_ROW_COUNT = 100;\n\nexport default class ColumnarTableBatchAggregator implements TableBatchAggregator {\n schema: Schema;\n length: number = 0;\n allocated: number = 0;\n columns: {[columnName: string]: any[]} = {};\n\n constructor(schema: Schema, options: ColumnarTableBatchOptions) {\n this.schema = schema;\n this._reallocateColumns();\n }\n\n rowCount(): number {\n return this.length;\n }\n\n addArrayRow(row: any[]) {\n // If user keeps pushing rows beyond batch size, reallocate\n this._reallocateColumns();\n let i = 0;\n // TODO what if no csv header, columns not populated?\n for (const fieldName in this.columns) {\n this.columns[fieldName][this.length] = row[i++];\n }\n this.length++;\n }\n\n addObjectRow(row: {[columnName: string]: any}): void {\n // If user keeps pushing rows beyond batch size, reallocate\n this._reallocateColumns();\n for (const fieldName in row) {\n this.columns[fieldName][this.length] = row[fieldName];\n }\n this.length++;\n }\n\n getBatch(): ColumnarTableBatch | ArrowTableBatch | null {\n this._pruneColumns();\n const columns = Array.isArray(this.schema) ? this.columns : {};\n\n // schema is an array if there're no headers\n // object if there are headers\n // columns should match schema format\n if (!Array.isArray(this.schema)) {\n for (const fieldName in this.schema) {\n const field = this.schema[fieldName];\n columns[field.name] = this.columns[field.index];\n }\n }\n\n this.columns = {};\n\n const batch: ColumnarTableBatch = {\n shape: 'columnar-table',\n batchType: 'data',\n data: columns,\n schema: this.schema,\n length: this.length\n };\n\n return batch;\n }\n\n // HELPERS\n\n _reallocateColumns() {\n if (this.length < this.allocated) {\n return;\n }\n\n // @ts-ignore TODO\n this.allocated = this.allocated > 0 ? (this.allocated *= 2) : DEFAULT_ROW_COUNT;\n this.columns = {};\n\n for (const fieldName in this.schema) {\n const field = this.schema[fieldName];\n const ArrayType = field.type || Float32Array;\n const oldColumn = this.columns[field.index];\n\n if (oldColumn && ArrayBuffer.isView(oldColumn)) {\n // Copy the old data to the new array\n const typedArray = new ArrayType(this.allocated);\n typedArray.set(oldColumn);\n this.columns[field.index] = typedArray;\n } else if (oldColumn) {\n // Plain array\n oldColumn.length = this.allocated;\n this.columns[field.index] = oldColumn;\n } else {\n // Create new\n this.columns[field.index] = new ArrayType(this.allocated);\n }\n }\n }\n\n _pruneColumns() {\n for (const [columnName, column] of Object.entries(this.columns)) {\n this.columns[columnName] = column.slice(0, this.length);\n }\n }\n}\n"],"file":"columnar-table-batch-aggregator.js"}