@loaders.gl/schema 3.4.14 → 3.4.15
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.
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/category/mesh/convert-mesh.js +2 -7
- package/dist/es5/category/mesh/convert-mesh.js.map +1 -1
- package/dist/es5/category/mesh/deduce-mesh-schema.js +8 -8
- package/dist/es5/category/mesh/deduce-mesh-schema.js.map +1 -1
- package/dist/es5/category/mesh/mesh-to-arrow-table.js +17 -16
- package/dist/es5/category/mesh/mesh-to-arrow-table.js.map +1 -1
- package/dist/es5/category/mesh/mesh-utils.js +15 -15
- package/dist/es5/category/mesh/mesh-utils.js.map +1 -1
- package/dist/es5/category/table/deduce-table-schema.js +9 -9
- package/dist/es5/category/table/deduce-table-schema.js.map +1 -1
- package/dist/es5/index.js +51 -51
- package/dist/es5/lib/arrow/get-type-info.js +3 -3
- package/dist/es5/lib/arrow/get-type-info.js.map +1 -1
- package/dist/es5/lib/batches/base-table-batch-aggregator.js +38 -51
- package/dist/es5/lib/batches/base-table-batch-aggregator.js.map +1 -1
- package/dist/es5/lib/batches/columnar-table-batch-aggregator.js +60 -81
- package/dist/es5/lib/batches/columnar-table-batch-aggregator.js.map +1 -1
- package/dist/es5/lib/batches/row-table-batch-aggregator.js +53 -66
- package/dist/es5/lib/batches/row-table-batch-aggregator.js.map +1 -1
- package/dist/es5/lib/batches/table-batch-builder.js +101 -127
- package/dist/es5/lib/batches/table-batch-builder.js.map +1 -1
- package/dist/es5/lib/schema/impl/enum.js +1 -1
- package/dist/es5/lib/schema/impl/field.js +17 -30
- package/dist/es5/lib/schema/impl/field.js.map +1 -1
- package/dist/es5/lib/schema/impl/schema.js +55 -105
- package/dist/es5/lib/schema/impl/schema.js.map +1 -1
- package/dist/es5/lib/schema/impl/type.js +375 -675
- package/dist/es5/lib/schema/impl/type.js.map +1 -1
- package/dist/es5/lib/schema/schema.js +37 -37
- package/dist/es5/lib/utils/async-queue.js +72 -138
- package/dist/es5/lib/utils/async-queue.js.map +1 -1
- package/dist/es5/lib/utils/row-utils.js +4 -4
- package/dist/es5/lib/utils/row-utils.js.map +1 -1
- package/package.json +2 -2
package/dist/es5/index.js
CHANGED
|
@@ -6,307 +6,307 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
Object.defineProperty(exports, "AsyncQueue", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function
|
|
9
|
+
get: function () {
|
|
10
10
|
return _asyncQueue.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "Binary", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function
|
|
15
|
+
get: function () {
|
|
16
16
|
return _schema.Binary;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "Bool", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function
|
|
21
|
+
get: function () {
|
|
22
22
|
return _schema.Bool;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "ColumnarTableBatchAggregator", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function
|
|
27
|
+
get: function () {
|
|
28
28
|
return _columnarTableBatchAggregator.default;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "DataType", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function
|
|
33
|
+
get: function () {
|
|
34
34
|
return _schema.DataType;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "Date", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function
|
|
39
|
+
get: function () {
|
|
40
40
|
return _schema.Date;
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "DateDay", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function
|
|
45
|
+
get: function () {
|
|
46
46
|
return _schema.DateDay;
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "DateMillisecond", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function
|
|
51
|
+
get: function () {
|
|
52
52
|
return _schema.DateMillisecond;
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "Field", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function
|
|
57
|
+
get: function () {
|
|
58
58
|
return _schema.Field;
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
Object.defineProperty(exports, "FixedSizeList", {
|
|
62
62
|
enumerable: true,
|
|
63
|
-
get: function
|
|
63
|
+
get: function () {
|
|
64
64
|
return _schema.FixedSizeList;
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
Object.defineProperty(exports, "Float", {
|
|
68
68
|
enumerable: true,
|
|
69
|
-
get: function
|
|
69
|
+
get: function () {
|
|
70
70
|
return _schema.Float;
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
Object.defineProperty(exports, "Float16", {
|
|
74
74
|
enumerable: true,
|
|
75
|
-
get: function
|
|
75
|
+
get: function () {
|
|
76
76
|
return _schema.Float16;
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
Object.defineProperty(exports, "Float32", {
|
|
80
80
|
enumerable: true,
|
|
81
|
-
get: function
|
|
81
|
+
get: function () {
|
|
82
82
|
return _schema.Float32;
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
85
|
Object.defineProperty(exports, "Float64", {
|
|
86
86
|
enumerable: true,
|
|
87
|
-
get: function
|
|
87
|
+
get: function () {
|
|
88
88
|
return _schema.Float64;
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
Object.defineProperty(exports, "Int", {
|
|
92
92
|
enumerable: true,
|
|
93
|
-
get: function
|
|
93
|
+
get: function () {
|
|
94
94
|
return _schema.Int;
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
Object.defineProperty(exports, "Int16", {
|
|
98
98
|
enumerable: true,
|
|
99
|
-
get: function
|
|
99
|
+
get: function () {
|
|
100
100
|
return _schema.Int16;
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
Object.defineProperty(exports, "Int32", {
|
|
104
104
|
enumerable: true,
|
|
105
|
-
get: function
|
|
105
|
+
get: function () {
|
|
106
106
|
return _schema.Int32;
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
Object.defineProperty(exports, "Int64", {
|
|
110
110
|
enumerable: true,
|
|
111
|
-
get: function
|
|
111
|
+
get: function () {
|
|
112
112
|
return _schema.Int64;
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
Object.defineProperty(exports, "Int8", {
|
|
116
116
|
enumerable: true,
|
|
117
|
-
get: function
|
|
117
|
+
get: function () {
|
|
118
118
|
return _schema.Int8;
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
Object.defineProperty(exports, "Interval", {
|
|
122
122
|
enumerable: true,
|
|
123
|
-
get: function
|
|
123
|
+
get: function () {
|
|
124
124
|
return _schema.Interval;
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
127
|
Object.defineProperty(exports, "IntervalDayTime", {
|
|
128
128
|
enumerable: true,
|
|
129
|
-
get: function
|
|
129
|
+
get: function () {
|
|
130
130
|
return _schema.IntervalDayTime;
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
133
|
Object.defineProperty(exports, "IntervalYearMonth", {
|
|
134
134
|
enumerable: true,
|
|
135
|
-
get: function
|
|
135
|
+
get: function () {
|
|
136
136
|
return _schema.IntervalYearMonth;
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
Object.defineProperty(exports, "Null", {
|
|
140
140
|
enumerable: true,
|
|
141
|
-
get: function
|
|
141
|
+
get: function () {
|
|
142
142
|
return _schema.Null;
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
145
|
Object.defineProperty(exports, "RowTableBatchAggregator", {
|
|
146
146
|
enumerable: true,
|
|
147
|
-
get: function
|
|
147
|
+
get: function () {
|
|
148
148
|
return _rowTableBatchAggregator.default;
|
|
149
149
|
}
|
|
150
150
|
});
|
|
151
151
|
Object.defineProperty(exports, "Schema", {
|
|
152
152
|
enumerable: true,
|
|
153
|
-
get: function
|
|
153
|
+
get: function () {
|
|
154
154
|
return _schema.Schema;
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
157
|
Object.defineProperty(exports, "Struct", {
|
|
158
158
|
enumerable: true,
|
|
159
|
-
get: function
|
|
159
|
+
get: function () {
|
|
160
160
|
return _schema.Struct;
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
163
|
Object.defineProperty(exports, "TableBatchBuilder", {
|
|
164
164
|
enumerable: true,
|
|
165
|
-
get: function
|
|
165
|
+
get: function () {
|
|
166
166
|
return _tableBatchBuilder.default;
|
|
167
167
|
}
|
|
168
168
|
});
|
|
169
169
|
Object.defineProperty(exports, "Time", {
|
|
170
170
|
enumerable: true,
|
|
171
|
-
get: function
|
|
171
|
+
get: function () {
|
|
172
172
|
return _schema.Time;
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
175
|
Object.defineProperty(exports, "TimeMillisecond", {
|
|
176
176
|
enumerable: true,
|
|
177
|
-
get: function
|
|
177
|
+
get: function () {
|
|
178
178
|
return _schema.TimeMillisecond;
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
Object.defineProperty(exports, "TimeSecond", {
|
|
182
182
|
enumerable: true,
|
|
183
|
-
get: function
|
|
183
|
+
get: function () {
|
|
184
184
|
return _schema.TimeSecond;
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
187
|
Object.defineProperty(exports, "Timestamp", {
|
|
188
188
|
enumerable: true,
|
|
189
|
-
get: function
|
|
189
|
+
get: function () {
|
|
190
190
|
return _schema.Timestamp;
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
193
|
Object.defineProperty(exports, "TimestampMicrosecond", {
|
|
194
194
|
enumerable: true,
|
|
195
|
-
get: function
|
|
195
|
+
get: function () {
|
|
196
196
|
return _schema.TimestampMicrosecond;
|
|
197
197
|
}
|
|
198
198
|
});
|
|
199
199
|
Object.defineProperty(exports, "TimestampMillisecond", {
|
|
200
200
|
enumerable: true,
|
|
201
|
-
get: function
|
|
201
|
+
get: function () {
|
|
202
202
|
return _schema.TimestampMillisecond;
|
|
203
203
|
}
|
|
204
204
|
});
|
|
205
205
|
Object.defineProperty(exports, "TimestampNanosecond", {
|
|
206
206
|
enumerable: true,
|
|
207
|
-
get: function
|
|
207
|
+
get: function () {
|
|
208
208
|
return _schema.TimestampNanosecond;
|
|
209
209
|
}
|
|
210
210
|
});
|
|
211
211
|
Object.defineProperty(exports, "TimestampSecond", {
|
|
212
212
|
enumerable: true,
|
|
213
|
-
get: function
|
|
213
|
+
get: function () {
|
|
214
214
|
return _schema.TimestampSecond;
|
|
215
215
|
}
|
|
216
216
|
});
|
|
217
217
|
Object.defineProperty(exports, "Uint16", {
|
|
218
218
|
enumerable: true,
|
|
219
|
-
get: function
|
|
219
|
+
get: function () {
|
|
220
220
|
return _schema.Uint16;
|
|
221
221
|
}
|
|
222
222
|
});
|
|
223
223
|
Object.defineProperty(exports, "Uint32", {
|
|
224
224
|
enumerable: true,
|
|
225
|
-
get: function
|
|
225
|
+
get: function () {
|
|
226
226
|
return _schema.Uint32;
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
229
|
Object.defineProperty(exports, "Uint64", {
|
|
230
230
|
enumerable: true,
|
|
231
|
-
get: function
|
|
231
|
+
get: function () {
|
|
232
232
|
return _schema.Uint64;
|
|
233
233
|
}
|
|
234
234
|
});
|
|
235
235
|
Object.defineProperty(exports, "Uint8", {
|
|
236
236
|
enumerable: true,
|
|
237
|
-
get: function
|
|
237
|
+
get: function () {
|
|
238
238
|
return _schema.Uint8;
|
|
239
239
|
}
|
|
240
240
|
});
|
|
241
241
|
Object.defineProperty(exports, "Utf8", {
|
|
242
242
|
enumerable: true,
|
|
243
|
-
get: function
|
|
243
|
+
get: function () {
|
|
244
244
|
return _schema.Utf8;
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
Object.defineProperty(exports, "convertToArrayRow", {
|
|
248
248
|
enumerable: true,
|
|
249
|
-
get: function
|
|
249
|
+
get: function () {
|
|
250
250
|
return _rowUtils.convertToArrayRow;
|
|
251
251
|
}
|
|
252
252
|
});
|
|
253
253
|
Object.defineProperty(exports, "convertToObjectRow", {
|
|
254
254
|
enumerable: true,
|
|
255
|
-
get: function
|
|
255
|
+
get: function () {
|
|
256
256
|
return _rowUtils.convertToObjectRow;
|
|
257
257
|
}
|
|
258
258
|
});
|
|
259
259
|
Object.defineProperty(exports, "deduceMeshField", {
|
|
260
260
|
enumerable: true,
|
|
261
|
-
get: function
|
|
261
|
+
get: function () {
|
|
262
262
|
return _deduceMeshSchema.deduceMeshField;
|
|
263
263
|
}
|
|
264
264
|
});
|
|
265
265
|
Object.defineProperty(exports, "deduceMeshSchema", {
|
|
266
266
|
enumerable: true,
|
|
267
|
-
get: function
|
|
267
|
+
get: function () {
|
|
268
268
|
return _deduceMeshSchema.deduceMeshSchema;
|
|
269
269
|
}
|
|
270
270
|
});
|
|
271
271
|
Object.defineProperty(exports, "deduceTypeFromColumn", {
|
|
272
272
|
enumerable: true,
|
|
273
|
-
get: function
|
|
273
|
+
get: function () {
|
|
274
274
|
return _deduceColumnType.deduceTypeFromColumn;
|
|
275
275
|
}
|
|
276
276
|
});
|
|
277
277
|
Object.defineProperty(exports, "deduceTypeFromValue", {
|
|
278
278
|
enumerable: true,
|
|
279
|
-
get: function
|
|
279
|
+
get: function () {
|
|
280
280
|
return _deduceColumnType.deduceTypeFromValue;
|
|
281
281
|
}
|
|
282
282
|
});
|
|
283
283
|
Object.defineProperty(exports, "getArrowTypeFromTypedArray", {
|
|
284
284
|
enumerable: true,
|
|
285
|
-
get: function
|
|
285
|
+
get: function () {
|
|
286
286
|
return _arrowLikeTypeUtils.getArrowTypeFromTypedArray;
|
|
287
287
|
}
|
|
288
288
|
});
|
|
289
289
|
Object.defineProperty(exports, "getMeshBoundingBox", {
|
|
290
290
|
enumerable: true,
|
|
291
|
-
get: function
|
|
291
|
+
get: function () {
|
|
292
292
|
return _meshUtils.getMeshBoundingBox;
|
|
293
293
|
}
|
|
294
294
|
});
|
|
295
295
|
Object.defineProperty(exports, "getMeshSize", {
|
|
296
296
|
enumerable: true,
|
|
297
|
-
get: function
|
|
297
|
+
get: function () {
|
|
298
298
|
return _meshUtils.getMeshSize;
|
|
299
299
|
}
|
|
300
300
|
});
|
|
301
301
|
Object.defineProperty(exports, "getTypeInfo", {
|
|
302
302
|
enumerable: true,
|
|
303
|
-
get: function
|
|
303
|
+
get: function () {
|
|
304
304
|
return _getTypeInfo.getTypeInfo;
|
|
305
305
|
}
|
|
306
306
|
});
|
|
307
307
|
Object.defineProperty(exports, "makeMeshAttributeMetadata", {
|
|
308
308
|
enumerable: true,
|
|
309
|
-
get: function
|
|
309
|
+
get: function () {
|
|
310
310
|
return _deduceMeshSchema.makeMeshAttributeMetadata;
|
|
311
311
|
}
|
|
312
312
|
});
|
|
@@ -14,12 +14,12 @@ function getTypeInfo(arrowTypeLike) {
|
|
|
14
14
|
precision: arrowTypeLike.precision
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
let ReverseType = null;
|
|
18
18
|
function getTypeKey(typeKey) {
|
|
19
19
|
if (!ReverseType) {
|
|
20
20
|
ReverseType = {};
|
|
21
|
-
for (
|
|
22
|
-
ReverseType[_schema.Type[
|
|
21
|
+
for (const key in _schema.Type) {
|
|
22
|
+
ReverseType[_schema.Type[key]] = key;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
return ReverseType[typeKey];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-type-info.js","names":["_schema","require","getTypeInfo","arrowTypeLike","typeId","ArrayType","typeName","toString","typeEnumName","getTypeKey","precision","ReverseType","typeKey","key","Type"],"sources":["../../../../src/lib/arrow/get-type-info.ts"],"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"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAOO,SAASC,WAAWA,CAACC,aAAkB,EAM5C;EACA,OAAO;IACLC,MAAM,EAAED,aAAa,CAACC,MAAM;IAC5BC,SAAS,EAAEF,aAAa,CAACE,SAAS;IAClCC,QAAQ,EAAEH,aAAa,CAACI,QAAQ,CAAC,CAAC;IAClCC,YAAY,EAAEC,UAAU,CAACN,aAAa,CAACC,MAAM,CAAC;IAC9CM,SAAS,EAAEP,aAAa,CAACO;EAC3B,CAAC;AACH;AAEA,IAAIC,WAA2C,GAAG,IAAI;AAEtD,SAASF,UAAUA,CAACG,OAAO,EAAE;EAC3B,IAAI,CAACD,WAAW,EAAE;IAChBA,WAAW,GAAG,CAAC,CAAC;IAChB,KAAK,
|
|
1
|
+
{"version":3,"file":"get-type-info.js","names":["_schema","require","getTypeInfo","arrowTypeLike","typeId","ArrayType","typeName","toString","typeEnumName","getTypeKey","precision","ReverseType","typeKey","key","Type"],"sources":["../../../../src/lib/arrow/get-type-info.ts"],"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"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAOO,SAASC,WAAWA,CAACC,aAAkB,EAM5C;EACA,OAAO;IACLC,MAAM,EAAED,aAAa,CAACC,MAAM;IAC5BC,SAAS,EAAEF,aAAa,CAACE,SAAS;IAClCC,QAAQ,EAAEH,aAAa,CAACI,QAAQ,CAAC,CAAC;IAClCC,YAAY,EAAEC,UAAU,CAACN,aAAa,CAACC,MAAM,CAAC;IAC9CM,SAAS,EAAEP,aAAa,CAACO;EAC3B,CAAC;AACH;AAEA,IAAIC,WAA2C,GAAG,IAAI;AAEtD,SAASF,UAAUA,CAACG,OAAO,EAAE;EAC3B,IAAI,CAACD,WAAW,EAAE;IAChBA,WAAW,GAAG,CAAC,CAAC;IAChB,KAAK,MAAME,GAAG,IAAIC,YAAI,EAAE;MACtBH,WAAW,CAACG,YAAI,CAACD,GAAG,CAAC,CAAC,GAAGA,GAAG;IAC9B;EACF;EAEA,OAAOF,WAAW,CAACC,OAAO,CAAC;AAC7B"}
|
|
@@ -5,13 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
(0, _classCallCheck2.default)(this, RowTableBatchAggregator);
|
|
9
|
+
const DEFAULT_ROW_COUNT = 100;
|
|
10
|
+
class RowTableBatchAggregator {
|
|
11
|
+
constructor(schema, options) {
|
|
15
12
|
(0, _defineProperty2.default)(this, "schema", void 0);
|
|
16
13
|
(0, _defineProperty2.default)(this, "options", void 0);
|
|
17
14
|
(0, _defineProperty2.default)(this, "length", 0);
|
|
@@ -22,57 +19,47 @@ var RowTableBatchAggregator = function () {
|
|
|
22
19
|
this.schema = schema;
|
|
23
20
|
if (!Array.isArray(schema)) {
|
|
24
21
|
this._headers = [];
|
|
25
|
-
for (
|
|
22
|
+
for (const key in schema) {
|
|
26
23
|
this._headers[schema[key].index] = schema[key].name;
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
|
-
(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
key: "addArrayRow",
|
|
37
|
-
value: function addArrayRow(row, cursor) {
|
|
38
|
-
if (Number.isFinite(cursor)) {
|
|
39
|
-
this.cursor = cursor;
|
|
40
|
-
}
|
|
41
|
-
this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
|
|
42
|
-
this.rows[this.length] = row;
|
|
43
|
-
this.length++;
|
|
27
|
+
rowCount() {
|
|
28
|
+
return this.length;
|
|
29
|
+
}
|
|
30
|
+
addArrayRow(row, cursor) {
|
|
31
|
+
if (Number.isFinite(cursor)) {
|
|
32
|
+
this.cursor = cursor;
|
|
44
33
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
this.rows[this.length] = row;
|
|
53
|
-
this.length++;
|
|
34
|
+
this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
|
|
35
|
+
this.rows[this.length] = row;
|
|
36
|
+
this.length++;
|
|
37
|
+
}
|
|
38
|
+
addObjectRow(row, cursor) {
|
|
39
|
+
if (Number.isFinite(cursor)) {
|
|
40
|
+
this.cursor = cursor;
|
|
54
41
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this.rows = null;
|
|
64
|
-
var batch = {
|
|
65
|
-
shape: this.options.shape,
|
|
66
|
-
batchType: 'data',
|
|
67
|
-
data: rows,
|
|
68
|
-
length: this.length,
|
|
69
|
-
schema: this.schema,
|
|
70
|
-
cursor: this.cursor
|
|
71
|
-
};
|
|
72
|
-
return batch;
|
|
42
|
+
this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
|
|
43
|
+
this.rows[this.length] = row;
|
|
44
|
+
this.length++;
|
|
45
|
+
}
|
|
46
|
+
getBatch() {
|
|
47
|
+
let rows = this.rows;
|
|
48
|
+
if (!rows) {
|
|
49
|
+
return null;
|
|
73
50
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
51
|
+
rows = rows.slice(0, this.length);
|
|
52
|
+
this.rows = null;
|
|
53
|
+
const batch = {
|
|
54
|
+
shape: this.options.shape,
|
|
55
|
+
batchType: 'data',
|
|
56
|
+
data: rows,
|
|
57
|
+
length: this.length,
|
|
58
|
+
schema: this.schema,
|
|
59
|
+
cursor: this.cursor
|
|
60
|
+
};
|
|
61
|
+
return batch;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
77
64
|
exports.default = RowTableBatchAggregator;
|
|
78
65
|
//# sourceMappingURL=base-table-batch-aggregator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-table-batch-aggregator.js","names":["DEFAULT_ROW_COUNT","RowTableBatchAggregator","schema","options","
|
|
1
|
+
{"version":3,"file":"base-table-batch-aggregator.js","names":["DEFAULT_ROW_COUNT","RowTableBatchAggregator","constructor","schema","options","_defineProperty2","default","Array","isArray","_headers","key","index","name","rowCount","length","addArrayRow","row","cursor","Number","isFinite","rows","addObjectRow","getBatch","slice","batch","shape","batchType","data","exports"],"sources":["../../../../src/lib/batches/base-table-batch-aggregator.ts"],"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"],"mappings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