@platforma-sdk/model 1.58.3 → 1.58.9
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/_virtual/_rolldown/runtime.cjs +43 -0
- package/dist/_virtual/_rolldown/runtime.js +18 -0
- package/dist/annotations/converter.cjs +15 -20
- package/dist/annotations/converter.cjs.map +1 -1
- package/dist/annotations/converter.d.ts +6 -2
- package/dist/annotations/converter.js +14 -18
- package/dist/annotations/converter.js.map +1 -1
- package/dist/annotations/index.cjs +1 -0
- package/dist/annotations/index.d.ts +2 -3
- package/dist/annotations/index.js +1 -0
- package/dist/annotations/types.d.ts +21 -16
- package/dist/bconfig/index.cjs +2 -0
- package/dist/bconfig/index.d.ts +5 -6
- package/dist/bconfig/index.js +2 -0
- package/dist/bconfig/lambdas.d.ts +52 -52
- package/dist/bconfig/normalization.cjs +13 -18
- package/dist/bconfig/normalization.cjs.map +1 -1
- package/dist/bconfig/normalization.d.ts +10 -6
- package/dist/bconfig/normalization.js +12 -16
- package/dist/bconfig/normalization.js.map +1 -1
- package/dist/bconfig/types.cjs +4 -3
- package/dist/bconfig/types.cjs.map +1 -1
- package/dist/bconfig/types.d.ts +10 -5
- package/dist/bconfig/types.js +4 -2
- package/dist/bconfig/types.js.map +1 -1
- package/dist/bconfig/util.d.ts +7 -4
- package/dist/bconfig/v3.d.ts +10 -6
- package/dist/block_api_v1.d.ts +62 -58
- package/dist/block_api_v2.d.ts +51 -47
- package/dist/block_api_v3.d.ts +33 -29
- package/dist/block_migrations.cjs +481 -413
- package/dist/block_migrations.cjs.map +1 -1
- package/dist/block_migrations.d.ts +258 -204
- package/dist/block_migrations.js +482 -408
- package/dist/block_migrations.js.map +1 -1
- package/dist/block_model.cjs +312 -343
- package/dist/block_model.cjs.map +1 -1
- package/dist/block_model.d.ts +143 -147
- package/dist/block_model.js +312 -341
- package/dist/block_model.js.map +1 -1
- package/dist/block_model_legacy.cjs +231 -255
- package/dist/block_model_legacy.cjs.map +1 -1
- package/dist/block_model_legacy.d.ts +108 -106
- package/dist/block_model_legacy.js +231 -253
- package/dist/block_model_legacy.js.map +1 -1
- package/dist/block_state_patch.d.ts +10 -10
- package/dist/block_state_util.cjs +15 -19
- package/dist/block_state_util.cjs.map +1 -1
- package/dist/block_state_util.d.ts +14 -13
- package/dist/block_state_util.js +15 -18
- package/dist/block_state_util.js.map +1 -1
- package/dist/block_storage.cjs +233 -238
- package/dist/block_storage.cjs.map +1 -1
- package/dist/block_storage.d.ts +62 -78
- package/dist/block_storage.js +234 -237
- package/dist/block_storage.js.map +1 -1
- package/dist/block_storage_callbacks.cjs +156 -195
- package/dist/block_storage_callbacks.cjs.map +1 -1
- package/dist/block_storage_callbacks.js +156 -192
- package/dist/block_storage_callbacks.js.map +1 -1
- package/dist/block_storage_facade.cjs +29 -85
- package/dist/block_storage_facade.cjs.map +1 -1
- package/dist/block_storage_facade.d.ts +83 -126
- package/dist/block_storage_facade.js +29 -83
- package/dist/block_storage_facade.js.map +1 -1
- package/dist/components/PFrameForGraphs.cjs +26 -24
- package/dist/components/PFrameForGraphs.cjs.map +1 -1
- package/dist/components/PFrameForGraphs.d.ts +12 -7
- package/dist/components/PFrameForGraphs.js +25 -22
- package/dist/components/PFrameForGraphs.js.map +1 -1
- package/dist/components/PlAnnotations/filter.d.ts +62 -79
- package/dist/components/PlAnnotations/filters_ui.cjs +135 -171
- package/dist/components/PlAnnotations/filters_ui.cjs.map +1 -1
- package/dist/components/PlAnnotations/filters_ui.d.ts +48 -46
- package/dist/components/PlAnnotations/filters_ui.js +135 -170
- package/dist/components/PlAnnotations/filters_ui.js.map +1 -1
- package/dist/components/PlAnnotations/index.d.ts +2 -3
- package/dist/components/PlDataTable/index.cjs +2 -0
- package/dist/components/PlDataTable/index.d.ts +3 -5
- package/dist/components/PlDataTable/index.js +2 -0
- package/dist/components/PlDataTable/labels.cjs +59 -81
- package/dist/components/PlDataTable/labels.cjs.map +1 -1
- package/dist/components/PlDataTable/labels.js +58 -79
- package/dist/components/PlDataTable/labels.js.map +1 -1
- package/dist/components/PlDataTable/state-migration.cjs +186 -144
- package/dist/components/PlDataTable/state-migration.cjs.map +1 -1
- package/dist/components/PlDataTable/state-migration.d.ts +85 -82
- package/dist/components/PlDataTable/state-migration.js +185 -142
- package/dist/components/PlDataTable/state-migration.js.map +1 -1
- package/dist/components/PlDataTable/table.cjs +172 -194
- package/dist/components/PlDataTable/table.cjs.map +1 -1
- package/dist/components/PlDataTable/table.d.ts +16 -12
- package/dist/components/PlDataTable/table.js +171 -192
- package/dist/components/PlDataTable/table.js.map +1 -1
- package/dist/components/PlDataTable/v4.d.ts +84 -119
- package/dist/components/PlDataTable/v5.d.ts +80 -103
- package/dist/components/PlMultiSequenceAlignment.cjs +27 -29
- package/dist/components/PlMultiSequenceAlignment.cjs.map +1 -1
- package/dist/components/PlMultiSequenceAlignment.d.ts +36 -27
- package/dist/components/PlMultiSequenceAlignment.js +26 -27
- package/dist/components/PlMultiSequenceAlignment.js.map +1 -1
- package/dist/components/PlSelectionModel.cjs +7 -6
- package/dist/components/PlSelectionModel.cjs.map +1 -1
- package/dist/components/PlSelectionModel.d.ts +10 -8
- package/dist/components/PlSelectionModel.js +7 -5
- package/dist/components/PlSelectionModel.js.map +1 -1
- package/dist/components/index.cjs +8 -0
- package/dist/components/index.d.ts +11 -6
- package/dist/components/index.js +8 -0
- package/dist/config/actions.cjs +138 -171
- package/dist/config/actions.cjs.map +1 -1
- package/dist/config/actions.d.ts +47 -47
- package/dist/config/actions.js +146 -178
- package/dist/config/actions.js.map +1 -1
- package/dist/config/actions_kinds.d.ts +114 -121
- package/dist/config/index.cjs +1 -0
- package/dist/config/index.d.ts +6 -7
- package/dist/config/index.js +1 -0
- package/dist/config/model.d.ts +131 -127
- package/dist/config/model_meta.d.ts +4 -1
- package/dist/config/type_engine.d.ts +22 -21
- package/dist/config/type_util.d.ts +12 -10
- package/dist/env_value.cjs +5 -6
- package/dist/env_value.cjs.map +1 -1
- package/dist/env_value.d.ts +4 -1
- package/dist/env_value.js +5 -5
- package/dist/env_value.js.map +1 -1
- package/dist/filters/converters/filterToQuery.cjs +273 -239
- package/dist/filters/converters/filterToQuery.cjs.map +1 -1
- package/dist/filters/converters/filterToQuery.d.ts +6 -2
- package/dist/filters/converters/filterToQuery.js +272 -237
- package/dist/filters/converters/filterToQuery.js.map +1 -1
- package/dist/filters/converters/filterUiToExpressionImpl.cjs +56 -85
- package/dist/filters/converters/filterUiToExpressionImpl.cjs.map +1 -1
- package/dist/filters/converters/filterUiToExpressionImpl.d.ts +8 -4
- package/dist/filters/converters/filterUiToExpressionImpl.js +55 -83
- package/dist/filters/converters/filterUiToExpressionImpl.js.map +1 -1
- package/dist/filters/converters/index.cjs +2 -0
- package/dist/filters/converters/index.d.ts +2 -3
- package/dist/filters/converters/index.js +2 -0
- package/dist/filters/distill.cjs +59 -50
- package/dist/filters/distill.cjs.map +1 -1
- package/dist/filters/distill.d.ts +6 -3
- package/dist/filters/distill.js +58 -48
- package/dist/filters/distill.js.map +1 -1
- package/dist/filters/index.cjs +4 -0
- package/dist/filters/index.d.ts +5 -4
- package/dist/filters/index.js +4 -0
- package/dist/filters/traverse.cjs +31 -40
- package/dist/filters/traverse.cjs.map +1 -1
- package/dist/filters/traverse.js +31 -39
- package/dist/filters/traverse.js.map +1 -1
- package/dist/filters/types.d.ts +10 -7
- package/dist/index.cjs +193 -187
- package/dist/index.d.ts +61 -28
- package/dist/index.js +49 -41
- package/dist/internal.cjs +48 -62
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.js +49 -60
- package/dist/internal.js.map +1 -1
- package/dist/package.cjs +12 -0
- package/dist/package.cjs.map +1 -0
- package/dist/package.js +6 -0
- package/dist/package.js.map +1 -0
- package/dist/pframe.cjs +32 -37
- package/dist/pframe.cjs.map +1 -1
- package/dist/pframe.d.ts +14 -10
- package/dist/pframe.js +32 -35
- package/dist/pframe.js.map +1 -1
- package/dist/pframe_utils/axes.cjs +81 -114
- package/dist/pframe_utils/axes.cjs.map +1 -1
- package/dist/pframe_utils/axes.d.ts +10 -13
- package/dist/pframe_utils/axes.js +80 -112
- package/dist/pframe_utils/axes.js.map +1 -1
- package/dist/pframe_utils/columns.cjs +61 -81
- package/dist/pframe_utils/columns.cjs.map +1 -1
- package/dist/pframe_utils/columns.d.ts +15 -6
- package/dist/pframe_utils/columns.js +60 -79
- package/dist/pframe_utils/columns.js.map +1 -1
- package/dist/pframe_utils/index.cjs +232 -253
- package/dist/pframe_utils/index.cjs.map +1 -1
- package/dist/pframe_utils/index.d.ts +39 -35
- package/dist/pframe_utils/index.js +231 -251
- package/dist/pframe_utils/index.js.map +1 -1
- package/dist/platforma.d.ts +48 -46
- package/dist/plugin_handle.cjs +6 -14
- package/dist/plugin_handle.cjs.map +1 -1
- package/dist/plugin_handle.d.ts +20 -25
- package/dist/plugin_handle.js +6 -13
- package/dist/plugin_handle.js.map +1 -1
- package/dist/plugin_model.cjs +364 -163
- package/dist/plugin_model.cjs.map +1 -1
- package/dist/plugin_model.d.ts +280 -129
- package/dist/plugin_model.js +362 -163
- package/dist/plugin_model.js.map +1 -1
- package/dist/raw_globals.cjs +10 -22
- package/dist/raw_globals.cjs.map +1 -1
- package/dist/raw_globals.d.ts +8 -5
- package/dist/raw_globals.js +10 -20
- package/dist/raw_globals.js.map +1 -1
- package/dist/ref_util.cjs +14 -13
- package/dist/ref_util.cjs.map +1 -1
- package/dist/ref_util.d.ts +18 -12
- package/dist/ref_util.js +14 -11
- package/dist/ref_util.js.map +1 -1
- package/dist/render/accessor.cjs +213 -226
- package/dist/render/accessor.cjs.map +1 -1
- package/dist/render/accessor.d.ts +115 -120
- package/dist/render/accessor.js +212 -224
- package/dist/render/accessor.js.map +1 -1
- package/dist/render/api.cjs +478 -580
- package/dist/render/api.cjs.map +1 -1
- package/dist/render/api.d.ts +207 -209
- package/dist/render/api.js +476 -578
- package/dist/render/api.js.map +1 -1
- package/dist/render/future.cjs +28 -32
- package/dist/render/future.cjs.map +1 -1
- package/dist/render/future.d.ts +15 -11
- package/dist/render/future.js +28 -30
- package/dist/render/future.js.map +1 -1
- package/dist/render/index.cjs +8 -0
- package/dist/render/index.d.ts +10 -8
- package/dist/render/index.js +8 -0
- package/dist/render/internal.cjs +33 -29
- package/dist/render/internal.cjs.map +1 -1
- package/dist/render/internal.d.ts +78 -72
- package/dist/render/internal.js +29 -26
- package/dist/render/internal.js.map +1 -1
- package/dist/render/traversal_ops.d.ts +42 -43
- package/dist/render/util/axis_filtering.cjs +63 -86
- package/dist/render/util/axis_filtering.cjs.map +1 -1
- package/dist/render/util/axis_filtering.d.ts +10 -7
- package/dist/render/util/axis_filtering.js +63 -85
- package/dist/render/util/axis_filtering.js.map +1 -1
- package/dist/render/util/column_collection.cjs +266 -321
- package/dist/render/util/column_collection.cjs.map +1 -1
- package/dist/render/util/column_collection.d.ts +47 -47
- package/dist/render/util/column_collection.js +264 -319
- package/dist/render/util/column_collection.js.map +1 -1
- package/dist/render/util/index.cjs +4 -0
- package/dist/render/util/index.d.ts +4 -5
- package/dist/render/util/index.js +4 -0
- package/dist/render/util/label.cjs +129 -163
- package/dist/render/util/label.cjs.map +1 -1
- package/dist/render/util/label.d.ts +45 -46
- package/dist/render/util/label.js +128 -161
- package/dist/render/util/label.js.map +1 -1
- package/dist/render/util/pcolumn_data.cjs +315 -375
- package/dist/render/util/pcolumn_data.cjs.map +1 -1
- package/dist/render/util/pcolumn_data.d.ts +33 -32
- package/dist/render/util/pcolumn_data.js +314 -373
- package/dist/render/util/pcolumn_data.js.map +1 -1
- package/dist/render/util/pframe_upgraders.cjs +37 -42
- package/dist/render/util/pframe_upgraders.cjs.map +1 -1
- package/dist/render/util/pframe_upgraders.js +37 -41
- package/dist/render/util/pframe_upgraders.js.map +1 -1
- package/dist/render/util/split_selectors.d.ts +13 -9
- package/dist/version.cjs +6 -8
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.ts +7 -4
- package/dist/version.js +5 -5
- package/dist/version.js.map +1 -1
- package/package.json +9 -3
- package/src/block_migrations.test.ts +184 -14
- package/src/block_migrations.ts +185 -30
- package/src/block_model.ts +111 -66
- package/src/block_storage.test.ts +147 -3
- package/src/block_storage.ts +43 -8
- package/src/block_storage_callbacks.ts +9 -4
- package/src/env_value.ts +0 -2
- package/src/filters/distill.ts +17 -6
- package/src/index.ts +12 -11
- package/src/internal.ts +0 -1
- package/src/platforma.ts +4 -4
- package/src/plugin_handle.ts +1 -1
- package/src/plugin_model.test.ts +217 -21
- package/src/plugin_model.ts +450 -55
- package/src/raw_globals.ts +0 -1
- package/dist/annotations/converter.d.ts.map +0 -1
- package/dist/annotations/index.d.ts.map +0 -1
- package/dist/annotations/types.d.ts.map +0 -1
- package/dist/bconfig/index.d.ts.map +0 -1
- package/dist/bconfig/lambdas.d.ts.map +0 -1
- package/dist/bconfig/normalization.d.ts.map +0 -1
- package/dist/bconfig/types.d.ts.map +0 -1
- package/dist/bconfig/util.d.ts.map +0 -1
- package/dist/bconfig/v3.d.ts.map +0 -1
- package/dist/block_api_v1.d.ts.map +0 -1
- package/dist/block_api_v2.d.ts.map +0 -1
- package/dist/block_api_v3.d.ts.map +0 -1
- package/dist/block_migrations.d.ts.map +0 -1
- package/dist/block_model.d.ts.map +0 -1
- package/dist/block_model_legacy.d.ts.map +0 -1
- package/dist/block_state_patch.d.ts.map +0 -1
- package/dist/block_state_util.d.ts.map +0 -1
- package/dist/block_storage.d.ts.map +0 -1
- package/dist/block_storage_callbacks.d.ts +0 -115
- package/dist/block_storage_callbacks.d.ts.map +0 -1
- package/dist/block_storage_facade.d.ts.map +0 -1
- package/dist/components/PFrameForGraphs.d.ts.map +0 -1
- package/dist/components/PlAnnotations/filter.d.ts.map +0 -1
- package/dist/components/PlAnnotations/filters_ui.d.ts.map +0 -1
- package/dist/components/PlAnnotations/index.d.ts.map +0 -1
- package/dist/components/PlAnnotations/types.d.ts +0 -3
- package/dist/components/PlAnnotations/types.d.ts.map +0 -1
- package/dist/components/PlDataTable/index.d.ts.map +0 -1
- package/dist/components/PlDataTable/labels.d.ts +0 -7
- package/dist/components/PlDataTable/labels.d.ts.map +0 -1
- package/dist/components/PlDataTable/state-migration.d.ts.map +0 -1
- package/dist/components/PlDataTable/table.d.ts.map +0 -1
- package/dist/components/PlDataTable/v4.d.ts.map +0 -1
- package/dist/components/PlDataTable/v5.d.ts.map +0 -1
- package/dist/components/PlMultiSequenceAlignment.d.ts.map +0 -1
- package/dist/components/PlSelectionModel.d.ts.map +0 -1
- package/dist/components/index.d.ts.map +0 -1
- package/dist/config/actions.d.ts.map +0 -1
- package/dist/config/actions_kinds.d.ts.map +0 -1
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/model.d.ts.map +0 -1
- package/dist/config/model_meta.d.ts.map +0 -1
- package/dist/config/type_engine.d.ts.map +0 -1
- package/dist/config/type_util.d.ts.map +0 -1
- package/dist/env_value.d.ts.map +0 -1
- package/dist/filters/converters/filterToQuery.d.ts.map +0 -1
- package/dist/filters/converters/filterUiToExpressionImpl.d.ts.map +0 -1
- package/dist/filters/converters/index.d.ts.map +0 -1
- package/dist/filters/distill.d.ts.map +0 -1
- package/dist/filters/index.d.ts.map +0 -1
- package/dist/filters/traverse.d.ts +0 -27
- package/dist/filters/traverse.d.ts.map +0 -1
- package/dist/filters/types.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/internal.d.ts +0 -36
- package/dist/internal.d.ts.map +0 -1
- package/dist/package.json.cjs +0 -6
- package/dist/package.json.cjs.map +0 -1
- package/dist/package.json.js +0 -4
- package/dist/package.json.js.map +0 -1
- package/dist/pframe.d.ts.map +0 -1
- package/dist/pframe_utils/axes.d.ts.map +0 -1
- package/dist/pframe_utils/columns.d.ts.map +0 -1
- package/dist/pframe_utils/index.d.ts.map +0 -1
- package/dist/pframe_utils/querySpec.d.ts +0 -2
- package/dist/pframe_utils/querySpec.d.ts.map +0 -1
- package/dist/platforma.d.ts.map +0 -1
- package/dist/plugin_handle.d.ts.map +0 -1
- package/dist/plugin_model.d.ts.map +0 -1
- package/dist/raw_globals.d.ts.map +0 -1
- package/dist/ref_util.d.ts.map +0 -1
- package/dist/render/accessor.d.ts.map +0 -1
- package/dist/render/api.d.ts.map +0 -1
- package/dist/render/future.d.ts.map +0 -1
- package/dist/render/index.d.ts.map +0 -1
- package/dist/render/internal.d.ts.map +0 -1
- package/dist/render/traversal_ops.d.ts.map +0 -1
- package/dist/render/util/axis_filtering.d.ts.map +0 -1
- package/dist/render/util/column_collection.d.ts.map +0 -1
- package/dist/render/util/index.d.ts.map +0 -1
- package/dist/render/util/label.d.ts.map +0 -1
- package/dist/render/util/pcolumn_data.d.ts.map +0 -1
- package/dist/render/util/pframe_upgraders.d.ts +0 -3
- package/dist/render/util/pframe_upgraders.d.ts.map +0 -1
- package/dist/render/util/split_selectors.d.ts.map +0 -1
- package/dist/version.d.ts.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { TreeNodeAccessor } from "../accessor.js";
|
|
2
|
+
import { dataInfoToEntries, isDataInfo, isDataInfoEntries, visitDataInfo } from "@milaboratories/pl-model-common";
|
|
3
3
|
|
|
4
|
+
//#region src/render/util/pcolumn_data.ts
|
|
4
5
|
const PCD_PREFIX = "PColumnData/";
|
|
5
6
|
const RT_RESOURCE_MAP = PCD_PREFIX + "ResourceMap";
|
|
6
7
|
const RT_RESOURCE_MAP_PARTITIONED = PCD_PREFIX + "Partitioned/ResourceMap";
|
|
@@ -12,399 +13,339 @@ const RT_JSON_SUPER_PARTITIONED = PCD_SUP_PREFIX + "JsonPartitioned";
|
|
|
12
13
|
const RT_BINARY_SUPER_PARTITIONED = PCD_SUP_PREFIX + "BinaryPartitioned";
|
|
13
14
|
const RT_PARQUET_SUPER_PARTITIONED = PCD_SUP_PREFIX + "ParquetPartitioned";
|
|
14
15
|
function populateResourceMapData(acc, resourceParser, data, keyPrefix = [], addEntriesWithNoData) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
16
|
+
if (acc === void 0) return false;
|
|
17
|
+
switch (acc.resourceType.name) {
|
|
18
|
+
case RT_RESOURCE_MAP: {
|
|
19
|
+
let isComplete = acc.getInputsLocked();
|
|
20
|
+
for (const keyStr of acc.listInputFields()) {
|
|
21
|
+
const value = acc.resolve({
|
|
22
|
+
field: keyStr,
|
|
23
|
+
assertFieldType: "Input"
|
|
24
|
+
});
|
|
25
|
+
const key = [...keyPrefix, ...JSON.parse(keyStr)];
|
|
26
|
+
const converted = value === void 0 ? void 0 : resourceParser(value);
|
|
27
|
+
if (converted === void 0) isComplete = false;
|
|
28
|
+
if (converted !== void 0 || addEntriesWithNoData) data.push({
|
|
29
|
+
key,
|
|
30
|
+
value: converted
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return isComplete;
|
|
34
|
+
}
|
|
35
|
+
case RT_RESOURCE_MAP_PARTITIONED: {
|
|
36
|
+
let isComplete = acc.getInputsLocked();
|
|
37
|
+
for (const keyStr of acc.listInputFields()) {
|
|
38
|
+
const value = acc.resolve({
|
|
39
|
+
field: keyStr,
|
|
40
|
+
assertFieldType: "Input"
|
|
41
|
+
});
|
|
42
|
+
if (value === void 0) isComplete = false;
|
|
43
|
+
else {
|
|
44
|
+
const populateResult = populateResourceMapData(value, resourceParser, data, [...keyPrefix, ...JSON.parse(keyStr)], addEntriesWithNoData);
|
|
45
|
+
isComplete = isComplete && populateResult;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return isComplete;
|
|
49
|
+
}
|
|
50
|
+
default: throw new Error(`Unknown resource type: ${acc.resourceType.name}`);
|
|
51
|
+
}
|
|
48
52
|
}
|
|
49
53
|
function parseResourceMap(acc, resourceParser, addEntriesWithNoData = false) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
const data = [];
|
|
55
|
+
return {
|
|
56
|
+
isComplete: populateResourceMapData(acc, resourceParser, data, [], addEntriesWithNoData),
|
|
57
|
+
data
|
|
58
|
+
};
|
|
53
59
|
}
|
|
54
60
|
const removeIndexSuffix = (keyStr) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
if (keyStr.endsWith(".index")) return {
|
|
62
|
+
baseKey: keyStr.substring(0, keyStr.length - 6),
|
|
63
|
+
type: "index"
|
|
64
|
+
};
|
|
65
|
+
else if (keyStr.endsWith(".values")) return {
|
|
66
|
+
baseKey: keyStr.substring(0, keyStr.length - 7),
|
|
67
|
+
type: "values"
|
|
68
|
+
};
|
|
69
|
+
else throw new Error(`key must ends on .index/.values for binary p-column, got: ${keyStr}`);
|
|
64
70
|
};
|
|
65
|
-
// @TODO define a class with various resource map operations
|
|
66
71
|
/** Returns a list of all partition keys appeared in the p-column */
|
|
67
72
|
function getPartitionKeysList(acc) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
return { data, keyLength };
|
|
73
|
+
if (!acc) return void 0;
|
|
74
|
+
const rt = acc.resourceType.name;
|
|
75
|
+
const meta = acc.getDataAsJson();
|
|
76
|
+
const data = [];
|
|
77
|
+
let keyLength = 0;
|
|
78
|
+
switch (rt) {
|
|
79
|
+
case RT_RESOURCE_MAP:
|
|
80
|
+
keyLength = meta["keyLength"];
|
|
81
|
+
break;
|
|
82
|
+
case RT_RESOURCE_MAP_PARTITIONED:
|
|
83
|
+
keyLength = meta["partitionKeyLength"] + meta["keyLength"];
|
|
84
|
+
break;
|
|
85
|
+
case RT_JSON_PARTITIONED:
|
|
86
|
+
case RT_BINARY_PARTITIONED:
|
|
87
|
+
case RT_PARQUET_PARTITIONED:
|
|
88
|
+
keyLength = meta["partitionKeyLength"];
|
|
89
|
+
break;
|
|
90
|
+
case RT_BINARY_SUPER_PARTITIONED:
|
|
91
|
+
case RT_JSON_SUPER_PARTITIONED:
|
|
92
|
+
case RT_PARQUET_SUPER_PARTITIONED:
|
|
93
|
+
keyLength = meta["superPartitionKeyLength"] + meta["partitionKeyLength"];
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
switch (rt) {
|
|
97
|
+
case RT_RESOURCE_MAP:
|
|
98
|
+
case RT_JSON_PARTITIONED:
|
|
99
|
+
case RT_BINARY_PARTITIONED:
|
|
100
|
+
case RT_PARQUET_PARTITIONED:
|
|
101
|
+
for (let keyStr of acc.listInputFields()) {
|
|
102
|
+
if (rt === RT_BINARY_PARTITIONED) keyStr = removeIndexSuffix(keyStr).baseKey;
|
|
103
|
+
const key = [...JSON.parse(keyStr)];
|
|
104
|
+
data.push(key);
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
case RT_RESOURCE_MAP_PARTITIONED:
|
|
108
|
+
case RT_BINARY_SUPER_PARTITIONED:
|
|
109
|
+
case RT_JSON_SUPER_PARTITIONED:
|
|
110
|
+
case RT_PARQUET_SUPER_PARTITIONED:
|
|
111
|
+
for (const supKeyStr of acc.listInputFields()) {
|
|
112
|
+
const keyPrefix = [...JSON.parse(supKeyStr)];
|
|
113
|
+
const value = acc.resolve({
|
|
114
|
+
field: supKeyStr,
|
|
115
|
+
assertFieldType: "Input"
|
|
116
|
+
});
|
|
117
|
+
if (value !== void 0) for (let keyStr of value.listInputFields()) {
|
|
118
|
+
if (rt === RT_BINARY_SUPER_PARTITIONED) keyStr = removeIndexSuffix(keyStr).baseKey;
|
|
119
|
+
const key = [...keyPrefix, ...JSON.parse(keyStr)];
|
|
120
|
+
data.push(key);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
data,
|
|
127
|
+
keyLength
|
|
128
|
+
};
|
|
126
129
|
}
|
|
127
130
|
function getUniquePartitionKeysForDataEntries(list) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const key = part.key;
|
|
139
|
-
if (key.length !== partitionKeyLength) {
|
|
140
|
-
throw new Error(`Key length (${key.length}) does not match partition length (${partitionKeyLength}) for key: ${JSON.stringify(key)}`);
|
|
141
|
-
}
|
|
142
|
-
for (let i = 0; i < partitionKeyLength; ++i) {
|
|
143
|
-
result[i].add(key[i]);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return result.map((s) => Array.from(s.values()));
|
|
131
|
+
if (list.type !== "JsonPartitioned" && list.type !== "BinaryPartitioned" && list.type !== "ParquetPartitioned") throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${list.type}`);
|
|
132
|
+
const { parts, partitionKeyLength } = list;
|
|
133
|
+
const result = [];
|
|
134
|
+
for (let i = 0; i < partitionKeyLength; ++i) result.push(/* @__PURE__ */ new Set());
|
|
135
|
+
for (const part of parts) {
|
|
136
|
+
const key = part.key;
|
|
137
|
+
if (key.length !== partitionKeyLength) throw new Error(`Key length (${key.length}) does not match partition length (${partitionKeyLength}) for key: ${JSON.stringify(key)}`);
|
|
138
|
+
for (let i = 0; i < partitionKeyLength; ++i) result[i].add(key[i]);
|
|
139
|
+
}
|
|
140
|
+
return result.map((s) => Array.from(s.values()));
|
|
147
141
|
}
|
|
148
142
|
function getUniquePartitionKeys(acc) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
for (const l of data) {
|
|
162
|
-
if (l.length !== keyLength) {
|
|
163
|
-
throw new Error("key length does not match partition length");
|
|
164
|
-
}
|
|
165
|
-
for (let i = 0; i < keyLength; ++i) {
|
|
166
|
-
result[i].add(l[i]);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return result.map((s) => Array.from(s.values()));
|
|
143
|
+
if (acc === void 0) return void 0;
|
|
144
|
+
if (isDataInfoEntries(acc)) return getUniquePartitionKeysForDataEntries(acc);
|
|
145
|
+
const list = getPartitionKeysList(acc);
|
|
146
|
+
if (!list) return void 0;
|
|
147
|
+
const { data, keyLength } = list;
|
|
148
|
+
const result = [];
|
|
149
|
+
for (let i = 0; i < keyLength; ++i) result.push(/* @__PURE__ */ new Set());
|
|
150
|
+
for (const l of data) {
|
|
151
|
+
if (l.length !== keyLength) throw new Error("key length does not match partition length");
|
|
152
|
+
for (let i = 0; i < keyLength; ++i) result[i].add(l[i]);
|
|
153
|
+
}
|
|
154
|
+
return result.map((s) => Array.from(s.values()));
|
|
170
155
|
}
|
|
171
156
|
/**
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
157
|
+
* Parses the PColumn data from a TreeNodeAccessor into a DataInfoEntries structure.
|
|
158
|
+
* Returns undefined if any required data is missing.
|
|
159
|
+
* Throws error on validation failures.
|
|
160
|
+
*
|
|
161
|
+
* @param acc - The TreeNodeAccessor containing PColumn data
|
|
162
|
+
* @param keyPrefix - Optional key prefix for recursive calls
|
|
163
|
+
* @returns DataInfoEntries representation of the PColumn data, or undefined if incomplete
|
|
164
|
+
*/
|
|
180
165
|
function parsePColumnData(acc, keyPrefix = []) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
case RT_PARQUET_SUPER_PARTITIONED: {
|
|
336
|
-
if (typeof meta?.superPartitionKeyLength !== "number" ||
|
|
337
|
-
typeof meta?.partitionKeyLength !== "number") {
|
|
338
|
-
throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`);
|
|
339
|
-
}
|
|
340
|
-
const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
|
|
341
|
-
const parts = [];
|
|
342
|
-
// Process all super partitions
|
|
343
|
-
for (const supKeyStr of acc.listInputFields()) {
|
|
344
|
-
const superPartition = acc.resolve({ field: supKeyStr, assertFieldType: "Input" });
|
|
345
|
-
if (superPartition === undefined)
|
|
346
|
-
return undefined;
|
|
347
|
-
// Validate inner type
|
|
348
|
-
if (superPartition.resourceType.name !== RT_PARQUET_PARTITIONED) {
|
|
349
|
-
throw new Error(`Expected ${RT_PARQUET_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`);
|
|
350
|
-
}
|
|
351
|
-
const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr));
|
|
352
|
-
if (innerResult === undefined)
|
|
353
|
-
return undefined;
|
|
354
|
-
if (innerResult.type !== "ParquetPartitioned")
|
|
355
|
-
throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
|
|
356
|
-
parts.push(...innerResult.parts);
|
|
357
|
-
}
|
|
358
|
-
return {
|
|
359
|
-
type: "ParquetPartitioned",
|
|
360
|
-
partitionKeyLength: totalKeyLength,
|
|
361
|
-
parts,
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
default:
|
|
365
|
-
throw new Error(`Unknown resource type: ${resourceType}`);
|
|
366
|
-
}
|
|
166
|
+
if (acc === void 0) return void 0;
|
|
167
|
+
if (!acc.getIsReadyOrError()) return void 0;
|
|
168
|
+
const resourceType = acc.resourceType.name;
|
|
169
|
+
const meta = acc.getDataAsJson();
|
|
170
|
+
if (keyPrefix.length > 0 && (resourceType === RT_JSON_SUPER_PARTITIONED || resourceType === RT_BINARY_SUPER_PARTITIONED || resourceType === RT_PARQUET_SUPER_PARTITIONED)) throw new Error(`Unexpected nested super-partitioned resource: ${resourceType}`);
|
|
171
|
+
switch (resourceType) {
|
|
172
|
+
case RT_RESOURCE_MAP:
|
|
173
|
+
case RT_RESOURCE_MAP_PARTITIONED: throw new Error(`Only data columns are supported, got: ${resourceType}`);
|
|
174
|
+
case RT_JSON_PARTITIONED: {
|
|
175
|
+
if (typeof meta?.partitionKeyLength !== "number") throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
|
|
176
|
+
const parts = [];
|
|
177
|
+
for (const keyStr of acc.listInputFields()) {
|
|
178
|
+
const value = acc.resolve({
|
|
179
|
+
field: keyStr,
|
|
180
|
+
assertFieldType: "Input"
|
|
181
|
+
});
|
|
182
|
+
if (value === void 0) return void 0;
|
|
183
|
+
const key = [...keyPrefix, ...JSON.parse(keyStr)];
|
|
184
|
+
parts.push({
|
|
185
|
+
key,
|
|
186
|
+
value
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
type: "JsonPartitioned",
|
|
191
|
+
partitionKeyLength: meta.partitionKeyLength,
|
|
192
|
+
parts
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
case RT_BINARY_PARTITIONED: {
|
|
196
|
+
if (typeof meta?.partitionKeyLength !== "number") throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
|
|
197
|
+
const parts = [];
|
|
198
|
+
const baseKeys = /* @__PURE__ */ new Map();
|
|
199
|
+
for (const keyStr of acc.listInputFields()) {
|
|
200
|
+
const suffix = removeIndexSuffix(keyStr);
|
|
201
|
+
const value = acc.resolve({
|
|
202
|
+
field: keyStr,
|
|
203
|
+
assertFieldType: "Input"
|
|
204
|
+
});
|
|
205
|
+
if (value === void 0) return void 0;
|
|
206
|
+
let entry = baseKeys.get(suffix.baseKey);
|
|
207
|
+
if (!entry) {
|
|
208
|
+
entry = {};
|
|
209
|
+
baseKeys.set(suffix.baseKey, entry);
|
|
210
|
+
}
|
|
211
|
+
if (suffix.type === "index") entry.index = value;
|
|
212
|
+
else entry.values = value;
|
|
213
|
+
}
|
|
214
|
+
for (const [baseKeyStr, entry] of baseKeys.entries()) {
|
|
215
|
+
if (!entry.index || !entry.values) return void 0;
|
|
216
|
+
const key = [...keyPrefix, ...JSON.parse(baseKeyStr)];
|
|
217
|
+
parts.push({
|
|
218
|
+
key,
|
|
219
|
+
value: {
|
|
220
|
+
index: entry.index,
|
|
221
|
+
values: entry.values
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
type: "BinaryPartitioned",
|
|
227
|
+
partitionKeyLength: meta.partitionKeyLength,
|
|
228
|
+
parts
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
case RT_PARQUET_PARTITIONED: {
|
|
232
|
+
if (typeof meta?.partitionKeyLength !== "number") throw new Error(`Missing partitionKeyLength in metadata for ${resourceType}`);
|
|
233
|
+
const parts = [];
|
|
234
|
+
for (const keyStr of acc.listInputFields()) {
|
|
235
|
+
const value = acc.resolve({
|
|
236
|
+
field: keyStr,
|
|
237
|
+
assertFieldType: "Input"
|
|
238
|
+
});
|
|
239
|
+
if (value === void 0) return void 0;
|
|
240
|
+
const key = [...keyPrefix, ...JSON.parse(keyStr)];
|
|
241
|
+
parts.push({
|
|
242
|
+
key,
|
|
243
|
+
value
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
type: "ParquetPartitioned",
|
|
248
|
+
partitionKeyLength: meta.partitionKeyLength,
|
|
249
|
+
parts
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
case RT_JSON_SUPER_PARTITIONED: {
|
|
253
|
+
if (typeof meta?.superPartitionKeyLength !== "number" || typeof meta?.partitionKeyLength !== "number") throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`);
|
|
254
|
+
const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
|
|
255
|
+
const parts = [];
|
|
256
|
+
for (const supKeyStr of acc.listInputFields()) {
|
|
257
|
+
const superPartition = acc.resolve({
|
|
258
|
+
field: supKeyStr,
|
|
259
|
+
assertFieldType: "Input"
|
|
260
|
+
});
|
|
261
|
+
if (superPartition === void 0) return void 0;
|
|
262
|
+
if (superPartition.resourceType.name !== RT_JSON_PARTITIONED) throw new Error(`Expected ${RT_JSON_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`);
|
|
263
|
+
const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr));
|
|
264
|
+
if (innerResult === void 0) return void 0;
|
|
265
|
+
if (innerResult.type !== "JsonPartitioned") throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
|
|
266
|
+
parts.push(...innerResult.parts);
|
|
267
|
+
}
|
|
268
|
+
return {
|
|
269
|
+
type: "JsonPartitioned",
|
|
270
|
+
partitionKeyLength: totalKeyLength,
|
|
271
|
+
parts
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
case RT_BINARY_SUPER_PARTITIONED: {
|
|
275
|
+
if (typeof meta?.superPartitionKeyLength !== "number" || typeof meta?.partitionKeyLength !== "number") throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`);
|
|
276
|
+
const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
|
|
277
|
+
const parts = [];
|
|
278
|
+
for (const supKeyStr of acc.listInputFields()) {
|
|
279
|
+
const superPartition = acc.resolve({
|
|
280
|
+
field: supKeyStr,
|
|
281
|
+
assertFieldType: "Input"
|
|
282
|
+
});
|
|
283
|
+
if (superPartition === void 0) return void 0;
|
|
284
|
+
if (superPartition.resourceType.name !== RT_BINARY_PARTITIONED) throw new Error(`Expected ${RT_BINARY_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`);
|
|
285
|
+
const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr));
|
|
286
|
+
if (innerResult === void 0) return void 0;
|
|
287
|
+
if (innerResult.type !== "BinaryPartitioned") throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
|
|
288
|
+
parts.push(...innerResult.parts);
|
|
289
|
+
}
|
|
290
|
+
return {
|
|
291
|
+
type: "BinaryPartitioned",
|
|
292
|
+
partitionKeyLength: totalKeyLength,
|
|
293
|
+
parts
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
case RT_PARQUET_SUPER_PARTITIONED: {
|
|
297
|
+
if (typeof meta?.superPartitionKeyLength !== "number" || typeof meta?.partitionKeyLength !== "number") throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${resourceType}`);
|
|
298
|
+
const totalKeyLength = meta.superPartitionKeyLength + meta.partitionKeyLength;
|
|
299
|
+
const parts = [];
|
|
300
|
+
for (const supKeyStr of acc.listInputFields()) {
|
|
301
|
+
const superPartition = acc.resolve({
|
|
302
|
+
field: supKeyStr,
|
|
303
|
+
assertFieldType: "Input"
|
|
304
|
+
});
|
|
305
|
+
if (superPartition === void 0) return void 0;
|
|
306
|
+
if (superPartition.resourceType.name !== RT_PARQUET_PARTITIONED) throw new Error(`Expected ${RT_PARQUET_PARTITIONED} inside ${resourceType}, but got ${superPartition.resourceType.name}`);
|
|
307
|
+
const innerResult = parsePColumnData(superPartition, JSON.parse(supKeyStr));
|
|
308
|
+
if (innerResult === void 0) return void 0;
|
|
309
|
+
if (innerResult.type !== "ParquetPartitioned") throw new Error(`Unexpected inner result type for ${resourceType}: ${innerResult.type}`);
|
|
310
|
+
parts.push(...innerResult.parts);
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
type: "ParquetPartitioned",
|
|
314
|
+
partitionKeyLength: totalKeyLength,
|
|
315
|
+
parts
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
default: throw new Error(`Unknown resource type: ${resourceType}`);
|
|
319
|
+
}
|
|
367
320
|
}
|
|
368
321
|
/**
|
|
369
|
-
|
|
322
|
+
* Converts or parses the input into DataInfoEntries format.
|
|
370
323
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
324
|
+
* @param acc - The input data, which can be TreeNodeAccessor, DataInfoEntries, DataInfo, or undefined.
|
|
325
|
+
* @returns The data in DataInfoEntries format, or undefined if the input was undefined or data is not ready.
|
|
326
|
+
*/
|
|
374
327
|
function convertOrParsePColumnData(acc) {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
return dataInfoToEntries(acc);
|
|
381
|
-
if (acc instanceof TreeNodeAccessor)
|
|
382
|
-
return parsePColumnData(acc);
|
|
383
|
-
throw new Error(`Unexpected input type: ${typeof acc}`);
|
|
328
|
+
if (acc === void 0) return void 0;
|
|
329
|
+
if (isDataInfoEntries(acc)) return acc;
|
|
330
|
+
if (isDataInfo(acc)) return dataInfoToEntries(acc);
|
|
331
|
+
if (acc instanceof TreeNodeAccessor) return parsePColumnData(acc);
|
|
332
|
+
throw new Error(`Unexpected input type: ${typeof acc}`);
|
|
384
333
|
}
|
|
385
334
|
function isPColumnReady(c) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}
|
|
396
|
-
else if (isDataInfo(data)) {
|
|
397
|
-
visitDataInfo(data, (v) => (ready &&= v.getIsReadyOrError()));
|
|
398
|
-
}
|
|
399
|
-
else if (!isValues(data)) {
|
|
400
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
401
|
-
throw Error(`unsupported column data type: ${data}`);
|
|
402
|
-
}
|
|
403
|
-
return ready;
|
|
335
|
+
const isValues = (d) => Array.isArray(d);
|
|
336
|
+
const isAccessor = (d) => d instanceof TreeNodeAccessor;
|
|
337
|
+
let ready = true;
|
|
338
|
+
const data = typeof c.data === "function" ? c.data() : c.data;
|
|
339
|
+
if (data == null) return false;
|
|
340
|
+
else if (isAccessor(data)) ready &&= data.getIsReadyOrError();
|
|
341
|
+
else if (isDataInfo(data)) visitDataInfo(data, (v) => ready &&= v.getIsReadyOrError());
|
|
342
|
+
else if (!isValues(data)) throw Error(`unsupported column data type: ${data}`);
|
|
343
|
+
return ready;
|
|
404
344
|
}
|
|
405
345
|
function allPColumnsReady(columns) {
|
|
406
|
-
|
|
346
|
+
return columns.every(isPColumnReady);
|
|
407
347
|
}
|
|
408
348
|
|
|
349
|
+
//#endregion
|
|
409
350
|
export { RT_BINARY_PARTITIONED, RT_BINARY_SUPER_PARTITIONED, RT_JSON_PARTITIONED, RT_JSON_SUPER_PARTITIONED, RT_PARQUET_PARTITIONED, RT_PARQUET_SUPER_PARTITIONED, RT_RESOURCE_MAP, RT_RESOURCE_MAP_PARTITIONED, allPColumnsReady, convertOrParsePColumnData, getPartitionKeysList, getUniquePartitionKeys, isPColumnReady, parsePColumnData, parseResourceMap };
|
|
410
|
-
//# sourceMappingURL=pcolumn_data.js.map
|
|
351
|
+
//# sourceMappingURL=pcolumn_data.js.map
|