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

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 (183) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +1289 -0
  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 -0
  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 -0
  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 +39 -0
  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 +62 -0
  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 +44 -0
  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 -0
  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 +51 -0
  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 +106 -0
  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 -0
  31. package/dist/es5/bundle.js +1 -1
  32. package/dist/es5/bundle.js.map +1 -1
  33. package/dist/es5/category/mesh/convert-mesh.js +2 -18
  34. package/dist/es5/category/mesh/convert-mesh.js.map +1 -1
  35. package/dist/es5/category/mesh/deduce-mesh-schema.js +9 -9
  36. package/dist/es5/category/mesh/deduce-mesh-schema.js.map +1 -1
  37. package/dist/es5/category/mesh/mesh-to-arrow-table.js +0 -38
  38. package/dist/es5/category/mesh/mesh-to-arrow-table.js.map +1 -1
  39. package/dist/es5/category/mesh/mesh-utils.js +16 -16
  40. package/dist/es5/category/mesh/mesh-utils.js.map +1 -1
  41. package/dist/es5/category/table/deduce-table-schema.js +9 -9
  42. package/dist/es5/category/table/deduce-table-schema.js.map +1 -1
  43. package/dist/es5/index.js +53 -53
  44. package/dist/es5/index.js.map +1 -1
  45. package/dist/es5/lib/arrow/arrow-like-type-utils.js +1 -1
  46. package/dist/es5/lib/arrow/arrow-like-type-utils.js.map +1 -1
  47. package/dist/es5/lib/arrow/arrow-type-utils.js +0 -70
  48. package/dist/es5/lib/arrow/arrow-type-utils.js.map +1 -1
  49. package/dist/es5/lib/arrow/get-type-info.js +4 -4
  50. package/dist/es5/lib/arrow/get-type-info.js.map +1 -1
  51. package/dist/es5/lib/batches/base-table-batch-aggregator.js +42 -53
  52. package/dist/es5/lib/batches/base-table-batch-aggregator.js.map +1 -1
  53. package/dist/es5/lib/batches/columnar-table-batch-aggregator.js +71 -90
  54. package/dist/es5/lib/batches/columnar-table-batch-aggregator.js.map +1 -1
  55. package/dist/es5/lib/batches/row-table-batch-aggregator.js +59 -70
  56. package/dist/es5/lib/batches/row-table-batch-aggregator.js.map +1 -1
  57. package/dist/es5/lib/batches/table-batch-builder.js +113 -133
  58. package/dist/es5/lib/batches/table-batch-builder.js.map +1 -1
  59. package/dist/es5/lib/schema/impl/enum.js +1 -1
  60. package/dist/es5/lib/schema/impl/field.js +19 -32
  61. package/dist/es5/lib/schema/impl/field.js.map +1 -1
  62. package/dist/es5/lib/schema/impl/schema.js +54 -119
  63. package/dist/es5/lib/schema/impl/schema.js.map +1 -1
  64. package/dist/es5/lib/schema/impl/type.js +395 -728
  65. package/dist/es5/lib/schema/impl/type.js.map +1 -1
  66. package/dist/es5/lib/schema/{index.js → schema.js} +38 -38
  67. package/dist/es5/lib/schema/schema.js.map +1 -0
  68. package/dist/es5/lib/schema-utils/deduce-column-type.js.map +1 -1
  69. package/dist/es5/lib/utils/async-queue.js +81 -164
  70. package/dist/es5/lib/utils/async-queue.js.map +1 -1
  71. package/dist/es5/lib/utils/row-utils.js +4 -4
  72. package/dist/es5/lib/utils/row-utils.js.map +1 -1
  73. package/dist/esm/category/mesh/convert-mesh.js +1 -8
  74. package/dist/esm/category/mesh/convert-mesh.js.map +1 -1
  75. package/dist/esm/category/mesh/deduce-mesh-schema.js +1 -1
  76. package/dist/esm/category/mesh/deduce-mesh-schema.js.map +1 -1
  77. package/dist/esm/category/mesh/mesh-to-arrow-table.js +0 -29
  78. package/dist/esm/category/mesh/mesh-to-arrow-table.js.map +1 -1
  79. package/dist/esm/category/table/deduce-table-schema.js.map +1 -1
  80. package/dist/esm/index.js +1 -1
  81. package/dist/esm/index.js.map +1 -1
  82. package/dist/esm/lib/arrow/arrow-like-type-utils.js +1 -1
  83. package/dist/esm/lib/arrow/arrow-like-type-utils.js.map +1 -1
  84. package/dist/esm/lib/arrow/arrow-type-utils.js +0 -60
  85. package/dist/esm/lib/arrow/arrow-type-utils.js.map +1 -1
  86. package/dist/esm/lib/arrow/get-type-info.js +1 -1
  87. package/dist/esm/lib/arrow/get-type-info.js.map +1 -1
  88. package/dist/esm/lib/batches/base-table-batch-aggregator.js.map +1 -1
  89. package/dist/esm/lib/batches/columnar-table-batch-aggregator.js.map +1 -1
  90. package/dist/esm/lib/batches/row-table-batch-aggregator.js.map +1 -1
  91. package/dist/esm/lib/batches/table-batch-builder.js.map +1 -1
  92. package/dist/esm/lib/schema/impl/field.js +1 -1
  93. package/dist/esm/lib/schema/impl/field.js.map +1 -1
  94. package/dist/esm/lib/schema/impl/schema.js.map +1 -1
  95. package/dist/esm/lib/schema/impl/type.js +8 -8
  96. package/dist/esm/lib/schema/impl/type.js.map +1 -1
  97. package/dist/esm/lib/schema/{index.js → schema.js} +1 -1
  98. package/dist/esm/lib/schema/schema.js.map +1 -0
  99. package/dist/esm/lib/schema-utils/deduce-column-type.js.map +1 -1
  100. package/dist/esm/lib/utils/async-queue.js.map +1 -1
  101. package/dist/index.d.ts +23 -0
  102. package/dist/index.d.ts.map +1 -0
  103. package/dist/index.js +75 -0
  104. package/dist/lib/arrow/arrow-like-type-utils.d.ts +4 -0
  105. package/dist/lib/arrow/arrow-like-type-utils.d.ts.map +1 -0
  106. package/dist/lib/arrow/arrow-like-type-utils.js +27 -0
  107. package/dist/lib/arrow/arrow-type-utils.d.ts +1 -0
  108. package/dist/lib/arrow/arrow-type-utils.d.ts.map +1 -0
  109. package/dist/lib/arrow/arrow-type-utils.js +70 -0
  110. package/dist/lib/arrow/get-type-info.d.ts +14 -0
  111. package/dist/lib/arrow/get-type-info.d.ts.map +1 -0
  112. package/dist/lib/arrow/get-type-info.js +28 -0
  113. package/dist/lib/batches/base-table-batch-aggregator.d.ts +19 -0
  114. package/dist/lib/batches/base-table-batch-aggregator.d.ts.map +1 -0
  115. package/dist/lib/batches/base-table-batch-aggregator.js +58 -0
  116. package/dist/lib/batches/columnar-table-batch-aggregator.d.ts +23 -0
  117. package/dist/lib/batches/columnar-table-batch-aggregator.d.ts.map +1 -0
  118. package/dist/lib/batches/columnar-table-batch-aggregator.js +90 -0
  119. package/dist/lib/batches/row-table-batch-aggregator.d.ts +22 -0
  120. package/dist/lib/batches/row-table-batch-aggregator.d.ts.map +1 -0
  121. package/dist/lib/batches/row-table-batch-aggregator.js +79 -0
  122. package/dist/lib/batches/table-batch-aggregator.d.ts +25 -0
  123. package/dist/lib/batches/table-batch-aggregator.d.ts.map +1 -0
  124. package/dist/lib/batches/table-batch-aggregator.js +2 -0
  125. package/dist/lib/batches/table-batch-builder.d.ts +53 -0
  126. package/dist/lib/batches/table-batch-builder.d.ts.map +1 -0
  127. package/dist/lib/batches/table-batch-builder.js +153 -0
  128. package/dist/lib/schema/impl/enum.d.ts +92 -0
  129. package/dist/lib/schema/impl/enum.d.ts.map +1 -0
  130. package/dist/lib/schema/impl/enum.js +97 -0
  131. package/dist/lib/schema/impl/field.d.ts +19 -0
  132. package/dist/lib/schema/impl/field.d.ts.map +1 -0
  133. package/dist/lib/schema/impl/field.js +32 -0
  134. package/dist/lib/schema/impl/schema.d.ts +16 -0
  135. package/dist/lib/schema/impl/schema.d.ts.map +1 -0
  136. package/dist/lib/schema/impl/schema.js +83 -0
  137. package/dist/lib/schema/impl/type.d.ts +176 -0
  138. package/dist/lib/schema/impl/type.d.ts.map +1 -0
  139. package/dist/lib/schema/impl/type.js +462 -0
  140. package/dist/lib/schema/schema.d.ts +5 -0
  141. package/dist/lib/schema/schema.d.ts.map +1 -0
  142. package/dist/lib/schema/schema.js +90 -0
  143. package/dist/lib/schema-utils/deduce-column-type.d.ts +3 -0
  144. package/dist/lib/schema-utils/deduce-column-type.d.ts.map +1 -0
  145. package/dist/lib/schema-utils/deduce-column-type.js +92 -0
  146. package/dist/lib/utils/assert.d.ts +2 -0
  147. package/dist/lib/utils/assert.d.ts.map +1 -0
  148. package/dist/lib/utils/assert.js +12 -0
  149. package/dist/lib/utils/async-queue.d.ts +18 -0
  150. package/dist/lib/utils/async-queue.d.ts.map +1 -0
  151. package/dist/lib/utils/async-queue.js +92 -0
  152. package/dist/lib/utils/row-utils.d.ts +9 -0
  153. package/dist/lib/utils/row-utils.d.ts.map +1 -0
  154. package/dist/lib/utils/row-utils.js +33 -0
  155. package/dist/types.d.ts +8 -0
  156. package/dist/types.d.ts.map +1 -0
  157. package/dist/types.js +2 -0
  158. package/package.json +5 -7
  159. package/src/category/common.ts +2 -1
  160. package/src/category/mesh/convert-mesh.ts +6 -6
  161. package/src/category/mesh/deduce-mesh-schema.ts +1 -1
  162. package/src/category/mesh/mesh-to-arrow-table.ts +4 -2
  163. package/src/category/mesh/mesh-types.ts +1 -1
  164. package/src/category/table/deduce-table-schema.ts +1 -1
  165. package/src/category/table/table-types.ts +5 -2
  166. package/src/index.ts +1 -1
  167. package/src/lib/arrow/arrow-like-type-utils.ts +11 -1
  168. package/src/lib/arrow/arrow-type-utils.ts +2 -0
  169. package/src/lib/arrow/get-type-info.ts +1 -1
  170. package/src/lib/batches/base-table-batch-aggregator.ts +1 -1
  171. package/src/lib/batches/columnar-table-batch-aggregator.ts +1 -1
  172. package/src/lib/batches/row-table-batch-aggregator.ts +1 -1
  173. package/src/lib/batches/table-batch-aggregator.ts +1 -1
  174. package/src/lib/batches/table-batch-builder.ts +2 -2
  175. package/src/lib/schema/impl/schema.ts +2 -2
  176. package/src/lib/schema/impl/type.ts +2 -2
  177. package/src/lib/schema/{index.ts → schema.ts} +0 -0
  178. package/src/lib/schema-utils/deduce-column-type.ts +6 -2
  179. package/src/lib/utils/async-queue.ts +7 -4
  180. package/dist/dist.min.js +0 -2
  181. package/dist/dist.min.js.map +0 -1
  182. package/dist/es5/lib/schema/index.js.map +0 -1
  183. package/dist/esm/lib/schema/index.js.map +0 -1
package/dist/index.js ADDED
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getTypeInfo = exports.deduceTypeFromValue = exports.deduceTypeFromColumn = exports.Struct = exports.FixedSizeList = exports.IntervalYearMonth = exports.IntervalDayTime = exports.Interval = exports.TimestampNanosecond = exports.TimestampMicrosecond = exports.TimestampMillisecond = exports.TimestampSecond = exports.Timestamp = exports.TimeSecond = exports.TimeMillisecond = exports.Time = exports.DateMillisecond = exports.DateDay = exports.Date = exports.Utf8 = exports.Float64 = exports.Float32 = exports.Float16 = exports.Float = exports.Uint64 = exports.Uint32 = exports.Uint16 = exports.Uint8 = exports.Int64 = exports.Int32 = exports.Int16 = exports.Int8 = exports.Int = exports.Bool = exports.Binary = exports.Null = exports.DataType = exports.Field = exports.Schema = exports.makeMeshAttributeMetadata = exports.deduceMeshField = exports.deduceMeshSchema = exports.convertMesh = exports.getMeshBoundingBox = exports.getMeshSize = exports.convertToArrayRow = exports.convertToObjectRow = exports.ColumnarTableBatchAggregator = exports.RowTableBatchAggregator = exports.TableBatchBuilder = void 0;
7
+ exports.AsyncQueue = exports.getArrowTypeFromTypedArray = void 0;
8
+ // TABLE CATEGORY UTILS
9
+ var table_batch_builder_1 = require("./lib/batches/table-batch-builder");
10
+ Object.defineProperty(exports, "TableBatchBuilder", { enumerable: true, get: function () { return __importDefault(table_batch_builder_1).default; } });
11
+ var row_table_batch_aggregator_1 = require("./lib/batches/row-table-batch-aggregator");
12
+ Object.defineProperty(exports, "RowTableBatchAggregator", { enumerable: true, get: function () { return __importDefault(row_table_batch_aggregator_1).default; } });
13
+ var columnar_table_batch_aggregator_1 = require("./lib/batches/columnar-table-batch-aggregator");
14
+ Object.defineProperty(exports, "ColumnarTableBatchAggregator", { enumerable: true, get: function () { return __importDefault(columnar_table_batch_aggregator_1).default; } });
15
+ var row_utils_1 = require("./lib/utils/row-utils");
16
+ Object.defineProperty(exports, "convertToObjectRow", { enumerable: true, get: function () { return row_utils_1.convertToObjectRow; } });
17
+ Object.defineProperty(exports, "convertToArrayRow", { enumerable: true, get: function () { return row_utils_1.convertToArrayRow; } });
18
+ var mesh_utils_1 = require("./category/mesh/mesh-utils");
19
+ Object.defineProperty(exports, "getMeshSize", { enumerable: true, get: function () { return mesh_utils_1.getMeshSize; } });
20
+ Object.defineProperty(exports, "getMeshBoundingBox", { enumerable: true, get: function () { return mesh_utils_1.getMeshBoundingBox; } });
21
+ var convert_mesh_1 = require("./category/mesh/convert-mesh");
22
+ Object.defineProperty(exports, "convertMesh", { enumerable: true, get: function () { return convert_mesh_1.convertMesh; } });
23
+ var deduce_mesh_schema_1 = require("./category/mesh/deduce-mesh-schema");
24
+ Object.defineProperty(exports, "deduceMeshSchema", { enumerable: true, get: function () { return deduce_mesh_schema_1.deduceMeshSchema; } });
25
+ Object.defineProperty(exports, "deduceMeshField", { enumerable: true, get: function () { return deduce_mesh_schema_1.deduceMeshField; } });
26
+ Object.defineProperty(exports, "makeMeshAttributeMetadata", { enumerable: true, get: function () { return deduce_mesh_schema_1.makeMeshAttributeMetadata; } });
27
+ // SCHEMA
28
+ var schema_1 = require("./lib/schema/schema");
29
+ Object.defineProperty(exports, "Schema", { enumerable: true, get: function () { return schema_1.Schema; } });
30
+ Object.defineProperty(exports, "Field", { enumerable: true, get: function () { return schema_1.Field; } });
31
+ Object.defineProperty(exports, "DataType", { enumerable: true, get: function () { return schema_1.DataType; } });
32
+ Object.defineProperty(exports, "Null", { enumerable: true, get: function () { return schema_1.Null; } });
33
+ Object.defineProperty(exports, "Binary", { enumerable: true, get: function () { return schema_1.Binary; } });
34
+ Object.defineProperty(exports, "Bool", { enumerable: true, get: function () { return schema_1.Bool; } });
35
+ Object.defineProperty(exports, "Int", { enumerable: true, get: function () { return schema_1.Int; } });
36
+ Object.defineProperty(exports, "Int8", { enumerable: true, get: function () { return schema_1.Int8; } });
37
+ Object.defineProperty(exports, "Int16", { enumerable: true, get: function () { return schema_1.Int16; } });
38
+ Object.defineProperty(exports, "Int32", { enumerable: true, get: function () { return schema_1.Int32; } });
39
+ Object.defineProperty(exports, "Int64", { enumerable: true, get: function () { return schema_1.Int64; } });
40
+ Object.defineProperty(exports, "Uint8", { enumerable: true, get: function () { return schema_1.Uint8; } });
41
+ Object.defineProperty(exports, "Uint16", { enumerable: true, get: function () { return schema_1.Uint16; } });
42
+ Object.defineProperty(exports, "Uint32", { enumerable: true, get: function () { return schema_1.Uint32; } });
43
+ Object.defineProperty(exports, "Uint64", { enumerable: true, get: function () { return schema_1.Uint64; } });
44
+ Object.defineProperty(exports, "Float", { enumerable: true, get: function () { return schema_1.Float; } });
45
+ Object.defineProperty(exports, "Float16", { enumerable: true, get: function () { return schema_1.Float16; } });
46
+ Object.defineProperty(exports, "Float32", { enumerable: true, get: function () { return schema_1.Float32; } });
47
+ Object.defineProperty(exports, "Float64", { enumerable: true, get: function () { return schema_1.Float64; } });
48
+ Object.defineProperty(exports, "Utf8", { enumerable: true, get: function () { return schema_1.Utf8; } });
49
+ Object.defineProperty(exports, "Date", { enumerable: true, get: function () { return schema_1.Date; } });
50
+ Object.defineProperty(exports, "DateDay", { enumerable: true, get: function () { return schema_1.DateDay; } });
51
+ Object.defineProperty(exports, "DateMillisecond", { enumerable: true, get: function () { return schema_1.DateMillisecond; } });
52
+ Object.defineProperty(exports, "Time", { enumerable: true, get: function () { return schema_1.Time; } });
53
+ Object.defineProperty(exports, "TimeMillisecond", { enumerable: true, get: function () { return schema_1.TimeMillisecond; } });
54
+ Object.defineProperty(exports, "TimeSecond", { enumerable: true, get: function () { return schema_1.TimeSecond; } });
55
+ Object.defineProperty(exports, "Timestamp", { enumerable: true, get: function () { return schema_1.Timestamp; } });
56
+ Object.defineProperty(exports, "TimestampSecond", { enumerable: true, get: function () { return schema_1.TimestampSecond; } });
57
+ Object.defineProperty(exports, "TimestampMillisecond", { enumerable: true, get: function () { return schema_1.TimestampMillisecond; } });
58
+ Object.defineProperty(exports, "TimestampMicrosecond", { enumerable: true, get: function () { return schema_1.TimestampMicrosecond; } });
59
+ Object.defineProperty(exports, "TimestampNanosecond", { enumerable: true, get: function () { return schema_1.TimestampNanosecond; } });
60
+ Object.defineProperty(exports, "Interval", { enumerable: true, get: function () { return schema_1.Interval; } });
61
+ Object.defineProperty(exports, "IntervalDayTime", { enumerable: true, get: function () { return schema_1.IntervalDayTime; } });
62
+ Object.defineProperty(exports, "IntervalYearMonth", { enumerable: true, get: function () { return schema_1.IntervalYearMonth; } });
63
+ Object.defineProperty(exports, "FixedSizeList", { enumerable: true, get: function () { return schema_1.FixedSizeList; } });
64
+ Object.defineProperty(exports, "Struct", { enumerable: true, get: function () { return schema_1.Struct; } });
65
+ // EXPERIMENTAL APIs
66
+ // SCHEMA UTILS
67
+ var deduce_column_type_1 = require("./lib/schema-utils/deduce-column-type");
68
+ Object.defineProperty(exports, "deduceTypeFromColumn", { enumerable: true, get: function () { return deduce_column_type_1.deduceTypeFromColumn; } });
69
+ Object.defineProperty(exports, "deduceTypeFromValue", { enumerable: true, get: function () { return deduce_column_type_1.deduceTypeFromValue; } });
70
+ var get_type_info_1 = require("./lib/arrow/get-type-info");
71
+ Object.defineProperty(exports, "getTypeInfo", { enumerable: true, get: function () { return get_type_info_1.getTypeInfo; } });
72
+ var arrow_like_type_utils_1 = require("./lib/arrow/arrow-like-type-utils");
73
+ Object.defineProperty(exports, "getArrowTypeFromTypedArray", { enumerable: true, get: function () { return arrow_like_type_utils_1.getArrowTypeFromTypedArray; } });
74
+ var async_queue_1 = require("./lib/utils/async-queue");
75
+ Object.defineProperty(exports, "AsyncQueue", { enumerable: true, get: function () { return __importDefault(async_queue_1).default; } });
@@ -0,0 +1,4 @@
1
+ import type { TypedArray } from '../../types';
2
+ import { DataType } from '../schema/schema';
3
+ export declare function getArrowTypeFromTypedArray(array: TypedArray): DataType;
4
+ //# sourceMappingURL=arrow-like-type-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrow-like-type-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/arrow/arrow-like-type-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,QAAQ,EAST,MAAM,kBAAkB,CAAC;AAE1B,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAqBtE"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getArrowTypeFromTypedArray = void 0;
4
+ const schema_1 = require("../schema/schema");
5
+ function getArrowTypeFromTypedArray(array) {
6
+ switch (array.constructor) {
7
+ case Int8Array:
8
+ return new schema_1.Int8();
9
+ case Uint8Array:
10
+ return new schema_1.Uint8();
11
+ case Int16Array:
12
+ return new schema_1.Int16();
13
+ case Uint16Array:
14
+ return new schema_1.Uint16();
15
+ case Int32Array:
16
+ return new schema_1.Int32();
17
+ case Uint32Array:
18
+ return new schema_1.Uint32();
19
+ case Float32Array:
20
+ return new schema_1.Float32();
21
+ case Float64Array:
22
+ return new schema_1.Float64();
23
+ default:
24
+ throw new Error('array type not supported');
25
+ }
26
+ }
27
+ exports.getArrowTypeFromTypedArray = getArrowTypeFromTypedArray;
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=arrow-type-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrow-type-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/arrow/arrow-type-utils.ts"],"names":[],"mappings":""}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ /*
3
+ import type {TypedArray} from '../../types';
4
+ import {
5
+ DataType,
6
+ Float32,
7
+ Float64,
8
+ Int16,
9
+ Int32,
10
+ Int8,
11
+ Uint16,
12
+ Uint32,
13
+ Uint8,
14
+ Int8Vector,
15
+ Uint8Vector,
16
+ Int16Vector,
17
+ Uint16Vector,
18
+ Int32Vector,
19
+ Uint32Vector,
20
+ Float32Vector,
21
+ Float64Vector
22
+ } from 'apache-arrow/Arrow.dom';
23
+ import {AbstractVector} from 'apache-arrow/vector';
24
+
25
+ export function getArrowType(array: TypedArray): DataType {
26
+ switch (array.constructor) {
27
+ case Int8Array:
28
+ return new Int8();
29
+ case Uint8Array:
30
+ return new Uint8();
31
+ case Int16Array:
32
+ return new Int16();
33
+ case Uint16Array:
34
+ return new Uint16();
35
+ case Int32Array:
36
+ return new Int32();
37
+ case Uint32Array:
38
+ return new Uint32();
39
+ case Float32Array:
40
+ return new Float32();
41
+ case Float64Array:
42
+ return new Float64();
43
+ default:
44
+ throw new Error('array type not supported');
45
+ }
46
+ }
47
+
48
+ export function getArrowVector(array: TypedArray): AbstractVector {
49
+ switch (array.constructor) {
50
+ case Int8Array:
51
+ return Int8Vector.from(array);
52
+ case Uint8Array:
53
+ return Uint8Vector.from(array);
54
+ case Int16Array:
55
+ return Int16Vector.from(array);
56
+ case Uint16Array:
57
+ return Uint16Vector.from(array);
58
+ case Int32Array:
59
+ return Int32Vector.from(array);
60
+ case Uint32Array:
61
+ return Uint32Vector.from(array);
62
+ case Float32Array:
63
+ return Float32Vector.from(array);
64
+ case Float64Array:
65
+ return Float64Vector.from(array);
66
+ default:
67
+ throw new Error('array type not supported');
68
+ }
69
+ }
70
+ */
@@ -0,0 +1,14 @@
1
+ import { Type } from '../schema/schema';
2
+ import { AnyArray } from '../../types';
3
+ /**
4
+ * Gets type information from an Arrow type object or "mock" Arrow type object
5
+ * @param arrowTypeLike Arrow Type or type object of similar shape
6
+ */
7
+ export declare function getTypeInfo(arrowTypeLike: any): {
8
+ typeId: Type;
9
+ ArrayType: AnyArray;
10
+ typeName: string;
11
+ typeEnumName?: string;
12
+ precision?: number;
13
+ };
14
+ //# sourceMappingURL=get-type-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-type-info.d.ts","sourceRoot":"","sources":["../../../src/lib/arrow/get-type-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAErC;;;GAGG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,GAAG,GAAG;IAC/C,MAAM,EAAE,IAAI,CAAC;IACb,SAAS,EAAE,QAAQ,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAQA"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTypeInfo = void 0;
4
+ const schema_1 = require("../schema/schema");
5
+ /**
6
+ * Gets type information from an Arrow type object or "mock" Arrow type object
7
+ * @param arrowTypeLike Arrow Type or type object of similar shape
8
+ */
9
+ function getTypeInfo(arrowTypeLike) {
10
+ return {
11
+ typeId: arrowTypeLike.typeId,
12
+ ArrayType: arrowTypeLike.ArrayType,
13
+ typeName: arrowTypeLike.toString(),
14
+ typeEnumName: getTypeKey(arrowTypeLike.typeId),
15
+ precision: arrowTypeLike.precision
16
+ };
17
+ }
18
+ exports.getTypeInfo = getTypeInfo;
19
+ let ReverseType = null;
20
+ function getTypeKey(typeKey) {
21
+ if (!ReverseType) {
22
+ ReverseType = {};
23
+ for (const key in schema_1.Type) {
24
+ ReverseType[schema_1.Type[key]] = key;
25
+ }
26
+ }
27
+ return ReverseType[typeKey];
28
+ }
@@ -0,0 +1,19 @@
1
+ import type { Schema } from '../schema/schema';
2
+ import type { TableBatch } from '../../category/table/table-types';
3
+ import { TableBatchAggregator, TableBatchOptions } from './table-batch-aggregator';
4
+ export default class RowTableBatchAggregator implements TableBatchAggregator {
5
+ schema: Schema;
6
+ options: TableBatchOptions;
7
+ length: number;
8
+ rows: any[] | null;
9
+ cursor: number;
10
+ private _headers;
11
+ constructor(schema: Schema, options: TableBatchOptions);
12
+ rowCount(): number;
13
+ addArrayRow(row: any[], cursor?: number): void;
14
+ addObjectRow(row: {
15
+ [columnName: string]: any;
16
+ }, cursor?: number): void;
17
+ getBatch(): TableBatch | null;
18
+ }
19
+ //# sourceMappingURL=base-table-batch-aggregator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-table-batch-aggregator.d.ts","sourceRoot":"","sources":["../../../src/lib/batches/base-table-batch-aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAIjF,MAAM,CAAC,OAAO,OAAO,uBAAwB,YAAW,oBAAoB;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,iBAAiB,CAAC;IAE3B,MAAM,EAAE,MAAM,CAAK;IACnB,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAQ;IAC1B,MAAM,EAAE,MAAM,CAAK;IACnB,OAAO,CAAC,QAAQ,CAAgB;gBAEpB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB;IActD,QAAQ,IAAI,MAAM;IAIlB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAU9C,YAAY,CAAC,GAAG,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAUrE,QAAQ,IAAI,UAAU,GAAG,IAAI;CAoB9B"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const DEFAULT_ROW_COUNT = 100;
4
+ class RowTableBatchAggregator {
5
+ constructor(schema, options) {
6
+ this.length = 0;
7
+ this.rows = null;
8
+ this.cursor = 0;
9
+ this._headers = [];
10
+ this.options = options;
11
+ this.schema = schema;
12
+ // schema is an array if there're no headers
13
+ // object if there are headers
14
+ if (!Array.isArray(schema)) {
15
+ this._headers = [];
16
+ for (const key in schema) {
17
+ this._headers[schema[key].index] = schema[key].name;
18
+ }
19
+ }
20
+ }
21
+ rowCount() {
22
+ return this.length;
23
+ }
24
+ addArrayRow(row, cursor) {
25
+ if (Number.isFinite(cursor)) {
26
+ this.cursor = cursor;
27
+ }
28
+ this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
29
+ this.rows[this.length] = row;
30
+ this.length++;
31
+ }
32
+ addObjectRow(row, cursor) {
33
+ if (Number.isFinite(cursor)) {
34
+ this.cursor = cursor;
35
+ }
36
+ this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
37
+ this.rows[this.length] = row;
38
+ this.length++;
39
+ }
40
+ getBatch() {
41
+ let rows = this.rows;
42
+ if (!rows) {
43
+ return null;
44
+ }
45
+ rows = rows.slice(0, this.length);
46
+ this.rows = null;
47
+ const batch = {
48
+ shape: this.options.shape,
49
+ batchType: 'data',
50
+ data: rows,
51
+ length: this.length,
52
+ schema: this.schema,
53
+ cursor: this.cursor
54
+ };
55
+ return batch;
56
+ }
57
+ }
58
+ exports.default = RowTableBatchAggregator;
@@ -0,0 +1,23 @@
1
+ import type { Schema } from '../schema/schema';
2
+ import type { ColumnarTableBatch, ArrowTableBatch } from '../../category/table/table-types';
3
+ import { TableBatchAggregator } from './table-batch-aggregator';
4
+ declare type ColumnarTableBatchOptions = {};
5
+ export default class ColumnarTableBatchAggregator implements TableBatchAggregator {
6
+ schema: Schema;
7
+ length: number;
8
+ allocated: number;
9
+ columns: {
10
+ [columnName: string]: any[];
11
+ };
12
+ constructor(schema: Schema, options: ColumnarTableBatchOptions);
13
+ rowCount(): number;
14
+ addArrayRow(row: any[]): void;
15
+ addObjectRow(row: {
16
+ [columnName: string]: any;
17
+ }): void;
18
+ getBatch(): ColumnarTableBatch | ArrowTableBatch | null;
19
+ _reallocateColumns(): void;
20
+ _pruneColumns(): void;
21
+ }
22
+ export {};
23
+ //# sourceMappingURL=columnar-table-batch-aggregator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columnar-table-batch-aggregator.d.ts","sourceRoot":"","sources":["../../../src/lib/batches/columnar-table-batch-aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAC,kBAAkB,EAAE,eAAe,EAAC,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAC,oBAAoB,EAAC,MAAM,0BAA0B,CAAC;AAE9D,aAAK,yBAAyB,GAAG,EAAE,CAAC;AAIpC,MAAM,CAAC,OAAO,OAAO,4BAA6B,YAAW,oBAAoB;IAC/E,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAK;IACnB,SAAS,EAAE,MAAM,CAAK;IACtB,OAAO,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,EAAE,CAAA;KAAC,CAAM;gBAEhC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,yBAAyB;IAK9D,QAAQ,IAAI,MAAM;IAIlB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;IAWtB,YAAY,CAAC,GAAG,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,GAAG,IAAI;IASpD,QAAQ,IAAI,kBAAkB,GAAG,eAAe,GAAG,IAAI;IA6BvD,kBAAkB;IA8BlB,aAAa;CAKd"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const DEFAULT_ROW_COUNT = 100;
4
+ class ColumnarTableBatchAggregator {
5
+ constructor(schema, options) {
6
+ this.length = 0;
7
+ this.allocated = 0;
8
+ this.columns = {};
9
+ this.schema = schema;
10
+ this._reallocateColumns();
11
+ }
12
+ rowCount() {
13
+ return this.length;
14
+ }
15
+ addArrayRow(row) {
16
+ // If user keeps pushing rows beyond batch size, reallocate
17
+ this._reallocateColumns();
18
+ let i = 0;
19
+ // TODO what if no csv header, columns not populated?
20
+ for (const fieldName in this.columns) {
21
+ this.columns[fieldName][this.length] = row[i++];
22
+ }
23
+ this.length++;
24
+ }
25
+ addObjectRow(row) {
26
+ // If user keeps pushing rows beyond batch size, reallocate
27
+ this._reallocateColumns();
28
+ for (const fieldName in row) {
29
+ this.columns[fieldName][this.length] = row[fieldName];
30
+ }
31
+ this.length++;
32
+ }
33
+ getBatch() {
34
+ this._pruneColumns();
35
+ const columns = Array.isArray(this.schema) ? this.columns : {};
36
+ // schema is an array if there're no headers
37
+ // object if there are headers
38
+ // columns should match schema format
39
+ if (!Array.isArray(this.schema)) {
40
+ for (const fieldName in this.schema) {
41
+ const field = this.schema[fieldName];
42
+ columns[field.name] = this.columns[field.index];
43
+ }
44
+ }
45
+ this.columns = {};
46
+ const batch = {
47
+ shape: 'columnar-table',
48
+ batchType: 'data',
49
+ data: columns,
50
+ schema: this.schema,
51
+ length: this.length
52
+ };
53
+ return batch;
54
+ }
55
+ // HELPERS
56
+ _reallocateColumns() {
57
+ if (this.length < this.allocated) {
58
+ return;
59
+ }
60
+ // @ts-ignore TODO
61
+ this.allocated = this.allocated > 0 ? (this.allocated *= 2) : DEFAULT_ROW_COUNT;
62
+ this.columns = {};
63
+ for (const fieldName in this.schema) {
64
+ const field = this.schema[fieldName];
65
+ const ArrayType = field.type || Float32Array;
66
+ const oldColumn = this.columns[field.index];
67
+ if (oldColumn && ArrayBuffer.isView(oldColumn)) {
68
+ // Copy the old data to the new array
69
+ const typedArray = new ArrayType(this.allocated);
70
+ typedArray.set(oldColumn);
71
+ this.columns[field.index] = typedArray;
72
+ }
73
+ else if (oldColumn) {
74
+ // Plain array
75
+ oldColumn.length = this.allocated;
76
+ this.columns[field.index] = oldColumn;
77
+ }
78
+ else {
79
+ // Create new
80
+ this.columns[field.index] = new ArrayType(this.allocated);
81
+ }
82
+ }
83
+ }
84
+ _pruneColumns() {
85
+ for (const [columnName, column] of Object.entries(this.columns)) {
86
+ this.columns[columnName] = column.slice(0, this.length);
87
+ }
88
+ }
89
+ }
90
+ exports.default = ColumnarTableBatchAggregator;
@@ -0,0 +1,22 @@
1
+ import type { Schema } from '../schema/schema';
2
+ import type { TableBatch } from '../../category/table/table-types';
3
+ import { TableBatchAggregator, TableBatchOptions } from './table-batch-aggregator';
4
+ export default class RowTableBatchAggregator implements TableBatchAggregator {
5
+ schema: Schema;
6
+ options: TableBatchOptions;
7
+ length: number;
8
+ objectRows: {
9
+ [columnName: string]: any;
10
+ } | null;
11
+ arrayRows: any[] | null;
12
+ cursor: number;
13
+ private _headers;
14
+ constructor(schema: Schema, options: TableBatchOptions);
15
+ rowCount(): number;
16
+ addArrayRow(row: any[], cursor?: number): void;
17
+ addObjectRow(row: {
18
+ [columnName: string]: any;
19
+ }, cursor?: number): void;
20
+ getBatch(): TableBatch | null;
21
+ }
22
+ //# sourceMappingURL=row-table-batch-aggregator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row-table-batch-aggregator.d.ts","sourceRoot":"","sources":["../../../src/lib/batches/row-table-batch-aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kCAAkC,CAAC;AAGjE,OAAO,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAIjF,MAAM,CAAC,OAAO,OAAO,uBAAwB,YAAW,oBAAoB;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,iBAAiB,CAAC;IAE3B,MAAM,EAAE,MAAM,CAAK;IACnB,UAAU,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,GAAG,IAAI,CAAQ;IACtD,SAAS,EAAE,GAAG,EAAE,GAAG,IAAI,CAAQ;IAC/B,MAAM,EAAE,MAAM,CAAK;IACnB,OAAO,CAAC,QAAQ,CAAgB;gBAEpB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB;IActD,QAAQ,IAAI,MAAM;IAIlB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAmB9C,YAAY,CAAC,GAAG,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAmBrE,QAAQ,IAAI,UAAU,GAAG,IAAI;CAmB9B"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // import type {ArrayRowTableBatch, ObjectRowTableBatch} from '../../category/table';
4
+ const row_utils_1 = require("../utils/row-utils");
5
+ const DEFAULT_ROW_COUNT = 100;
6
+ class RowTableBatchAggregator {
7
+ constructor(schema, options) {
8
+ this.length = 0;
9
+ this.objectRows = null;
10
+ this.arrayRows = null;
11
+ this.cursor = 0;
12
+ this._headers = [];
13
+ this.options = options;
14
+ this.schema = schema;
15
+ // schema is an array if there're no headers
16
+ // object if there are headers
17
+ if (!Array.isArray(schema)) {
18
+ this._headers = [];
19
+ for (const key in schema) {
20
+ this._headers[schema[key].index] = schema[key].name;
21
+ }
22
+ }
23
+ }
24
+ rowCount() {
25
+ return this.length;
26
+ }
27
+ addArrayRow(row, cursor) {
28
+ if (Number.isFinite(cursor)) {
29
+ this.cursor = cursor;
30
+ }
31
+ // eslint-disable-next-line default-case
32
+ switch (this.options.shape) {
33
+ case 'object-row-table':
34
+ const rowObject = (0, row_utils_1.convertToObjectRow)(row, this._headers);
35
+ this.addObjectRow(rowObject, cursor);
36
+ break;
37
+ case 'array-row-table':
38
+ this.arrayRows = this.arrayRows || new Array(DEFAULT_ROW_COUNT);
39
+ this.arrayRows[this.length] = row;
40
+ this.length++;
41
+ break;
42
+ }
43
+ }
44
+ addObjectRow(row, cursor) {
45
+ if (Number.isFinite(cursor)) {
46
+ this.cursor = cursor;
47
+ }
48
+ // eslint-disable-next-line default-case
49
+ switch (this.options.shape) {
50
+ case 'array-row-table':
51
+ const rowArray = (0, row_utils_1.convertToArrayRow)(row, this._headers);
52
+ this.addArrayRow(rowArray, cursor);
53
+ break;
54
+ case 'object-row-table':
55
+ this.objectRows = this.objectRows || new Array(DEFAULT_ROW_COUNT);
56
+ this.objectRows[this.length] = row;
57
+ this.length++;
58
+ break;
59
+ }
60
+ }
61
+ getBatch() {
62
+ let rows = this.arrayRows || this.objectRows;
63
+ if (!rows) {
64
+ return null;
65
+ }
66
+ rows = rows.slice(0, this.length);
67
+ this.arrayRows = null;
68
+ this.objectRows = null;
69
+ return {
70
+ shape: this.options.shape,
71
+ batchType: 'data',
72
+ data: rows,
73
+ length: this.length,
74
+ schema: this.schema,
75
+ cursor: this.cursor
76
+ };
77
+ }
78
+ }
79
+ exports.default = RowTableBatchAggregator;
@@ -0,0 +1,25 @@
1
+ import type { Schema } from '../schema/schema';
2
+ import type { TableBatch } from '../../category/table/table-types';
3
+ export interface TableBatchOptions {
4
+ batchSize: number | string;
5
+ [key: string]: any;
6
+ }
7
+ export interface TableBatchConstructor {
8
+ new (schema: Schema, options: TableBatchOptions): TableBatchAggregator;
9
+ }
10
+ /**
11
+ * TableBatchBuilder delegates batch building to this interface
12
+ */
13
+ export interface TableBatchAggregator {
14
+ /** Number of rows */
15
+ rowCount(): number;
16
+ /** Add one row */
17
+ addArrayRow(row: any[]): void;
18
+ /** Add one row */
19
+ addObjectRow(row: {
20
+ [columnName: string]: any;
21
+ }): void;
22
+ /** return a batch object */
23
+ getBatch(): TableBatch | null;
24
+ }
25
+ //# sourceMappingURL=table-batch-aggregator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-batch-aggregator.d.ts","sourceRoot":"","sources":["../../../src/lib/batches/table-batch-aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kCAAkC,CAAC;AAEjE,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,oBAAoB,CAAC;CACxE;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,qBAAqB;IACrB,QAAQ,IAAI,MAAM,CAAC;IACnB,kBAAkB;IAClB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC9B,kBAAkB;IAClB,YAAY,CAAC,GAAG,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,GAAG,IAAI,CAAC;IACrD,4BAA4B;IAC5B,QAAQ,IAAI,UAAU,GAAG,IAAI,CAAC;CAC/B"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,53 @@
1
+ import type { Schema } from '../schema/schema';
2
+ import type { TableBatch } from '../../category/table/table-types';
3
+ import type { TableBatchConstructor } from './table-batch-aggregator';
4
+ declare type TableBatchBuilderOptions = {
5
+ shape: 'row-table' | 'array-row-table' | 'object-row-table' | 'columnar-table' | 'arrow-table';
6
+ batchSize?: number | 'auto';
7
+ batchDebounceMs?: number;
8
+ limit: number;
9
+ _limitMB: number;
10
+ };
11
+ declare type GetBatchOptions = {
12
+ bytesUsed?: number;
13
+ [key: string]: any;
14
+ };
15
+ /** Incrementally builds batches from a stream of rows */
16
+ export default class TableBatchBuilder {
17
+ schema: Schema;
18
+ options: Required<TableBatchBuilderOptions>;
19
+ private aggregator;
20
+ private batchCount;
21
+ private bytesUsed;
22
+ private isChunkComplete;
23
+ private lastBatchEmittedMs;
24
+ private totalLength;
25
+ private totalBytes;
26
+ private rowBytes;
27
+ static ArrowBatch?: TableBatchConstructor;
28
+ constructor(schema: Schema, options?: TableBatchBuilderOptions);
29
+ limitReached(): boolean;
30
+ /** @deprecated Use addArrayRow or addObjectRow */
31
+ addRow(row: any[] | {
32
+ [columnName: string]: any;
33
+ }): void;
34
+ /** Add one row to the batch */
35
+ protected addArrayRow(row: any[]): void;
36
+ /** Add one row to the batch */
37
+ protected addObjectRow(row: {
38
+ [columnName: string]: any;
39
+ }): void;
40
+ /** Mark an incoming raw memory chunk has completed */
41
+ chunkComplete(chunk: ArrayBuffer | string): void;
42
+ getFullBatch(options?: GetBatchOptions): TableBatch | null;
43
+ getFinalBatch(options?: GetBatchOptions): TableBatch | null;
44
+ _estimateRowMB(row: any[] | object): number;
45
+ private _isFull;
46
+ /**
47
+ * bytesUsed can be set via chunkComplete or via getBatch*
48
+ */
49
+ private _getBatch;
50
+ private _getTableBatchType;
51
+ }
52
+ export {};
53
+ //# sourceMappingURL=table-batch-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-batch-builder.d.ts","sourceRoot":"","sources":["../../../src/lib/batches/table-batch-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kCAAkC,CAAC;AACjE,OAAO,KAAK,EAAuB,qBAAqB,EAAC,MAAM,0BAA0B,CAAC;AAM1F,aAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,WAAW,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,aAAa,CAAC;IAC/F,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,aAAK,eAAe,GAAG;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAYF,yDAAyD;AACzD,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,QAAQ,CAAC,wBAAwB,CAAC,CAAC;IAE5C,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,kBAAkB,CAAsB;IAChD,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAa;IAE7B,MAAM,CAAC,UAAU,CAAC,EAAE,qBAAqB,CAAC;gBAE9B,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB;IAK9D,YAAY,IAAI,OAAO;IAUvB,kDAAkD;IAClD,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,GAAG,IAAI;IActD,+BAA+B;IAC/B,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;IAQhC,+BAA+B;IAC/B,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,GAAG,IAAI;IAQ9D,sDAAsD;IACtD,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI;IAUhD,YAAY,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,UAAU,GAAG,IAAI;IAI1D,aAAa,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,UAAU,GAAG,IAAI;IAM3D,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,MAAM,GAAG,MAAM;IAI3C,OAAO,CAAC,OAAO;IA2Bf;;OAEG;IACH,OAAO,CAAC,SAAS;IAmBjB,OAAO,CAAC,kBAAkB;CAkB3B"}