@platforma-sdk/model 1.42.8 → 1.42.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/components/PlDataTable.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +171 -157
- package/dist/index.mjs.map +1 -1
- package/dist/render/util/axis_filtering.d.ts +3 -2
- package/dist/render/util/axis_filtering.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/PlDataTable.ts +3 -0
- package/src/render/util/axis_filtering.ts +63 -50
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JsonDataInfoEntries, JsonPartitionedDataInfoEntries, BinaryPartitionedDataInfoEntries, AxisFilterByIdx } from '@milaboratories/pl-model-common';
|
|
1
|
+
import { JsonDataInfoEntries, JsonPartitionedDataInfoEntries, BinaryPartitionedDataInfoEntries, ParquetPartitionedDataInfoEntries, PartitionedDataInfoEntries, AxisFilterByIdx } from '@milaboratories/pl-model-common';
|
|
2
2
|
/**
|
|
3
3
|
* Filters DataInfoEntries using axis filters, removing specified axes from keys and
|
|
4
4
|
* only keeping entries that match the filter values.
|
|
@@ -7,8 +7,9 @@ import { JsonDataInfoEntries, JsonPartitionedDataInfoEntries, BinaryPartitionedD
|
|
|
7
7
|
* @param axisFilters - Array of axis filters (index, value pairs)
|
|
8
8
|
* @throws Error if any filter axis is outside the partitioning axes or data axes for Json data
|
|
9
9
|
*/
|
|
10
|
+
export declare function filterDataInfoEntries<Blob>(dataInfoEntries: ParquetPartitionedDataInfoEntries<Blob>, axisFilters: AxisFilterByIdx[]): ParquetPartitionedDataInfoEntries<Blob>;
|
|
10
11
|
export declare function filterDataInfoEntries<Blob>(dataInfoEntries: BinaryPartitionedDataInfoEntries<Blob>, axisFilters: AxisFilterByIdx[]): BinaryPartitionedDataInfoEntries<Blob>;
|
|
11
12
|
export declare function filterDataInfoEntries<Blob>(dataInfoEntries: JsonPartitionedDataInfoEntries<Blob>, axisFilters: AxisFilterByIdx[]): JsonPartitionedDataInfoEntries<Blob>;
|
|
12
|
-
export declare function filterDataInfoEntries<Blob>(dataInfoEntries:
|
|
13
|
+
export declare function filterDataInfoEntries<Blob>(dataInfoEntries: PartitionedDataInfoEntries<Blob>, axisFilters: AxisFilterByIdx[]): PartitionedDataInfoEntries<Blob>;
|
|
13
14
|
export declare function filterDataInfoEntries(dataInfoEntries: JsonDataInfoEntries, axisFilters: AxisFilterByIdx[]): JsonDataInfoEntries;
|
|
14
15
|
//# sourceMappingURL=axis_filtering.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axis_filtering.d.ts","sourceRoot":"","sources":["../../../src/render/util/axis_filtering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAMV,mBAAmB,EACnB,8BAA8B,EAC9B,gCAAgC,EACjC,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EACxC,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"axis_filtering.d.ts","sourceRoot":"","sources":["../../../src/render/util/axis_filtering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAMV,mBAAmB,EACnB,8BAA8B,EAC9B,gCAAgC,EAChC,iCAAiC,EACjC,0BAA0B,EAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EACxC,eAAe,EAAE,iCAAiC,CAAC,IAAI,CAAC,EACxD,WAAW,EAAE,eAAe,EAAE,GAC7B,iCAAiC,CAAC,IAAI,CAAC,CAAC;AAC3C,wBAAgB,qBAAqB,CAAC,IAAI,EACxC,eAAe,EAAE,gCAAgC,CAAC,IAAI,CAAC,EACvD,WAAW,EAAE,eAAe,EAAE,GAC7B,gCAAgC,CAAC,IAAI,CAAC,CAAC;AAC1C,wBAAgB,qBAAqB,CAAC,IAAI,EACxC,eAAe,EAAE,8BAA8B,CAAC,IAAI,CAAC,EACrD,WAAW,EAAE,eAAe,EAAE,GAC7B,8BAA8B,CAAC,IAAI,CAAC,CAAC;AACxC,wBAAgB,qBAAqB,CAAC,IAAI,EACxC,eAAe,EAAE,0BAA0B,CAAC,IAAI,CAAC,EACjD,WAAW,EAAE,eAAe,EAAE,GAC7B,0BAA0B,CAAC,IAAI,CAAC,CAAC;AACpC,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,mBAAmB,EACpC,WAAW,EAAE,eAAe,EAAE,GAC7B,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/model",
|
|
3
|
-
"version": "1.42.
|
|
3
|
+
"version": "1.42.15",
|
|
4
4
|
"description": "Platforma.bio SDK / Block Model",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"utility-types": "^3.11.0",
|
|
23
23
|
"canonicalize": "~2.1.0",
|
|
24
24
|
"zod": "~3.23.8",
|
|
25
|
-
"@milaboratories/pl-
|
|
26
|
-
"@milaboratories/pl-
|
|
25
|
+
"@milaboratories/pl-model-common": "^1.19.4",
|
|
26
|
+
"@milaboratories/pl-error-like": "^1.12.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"typescript": "~5.6.3",
|
|
@@ -587,6 +587,9 @@ export function allColumnsComputed(
|
|
|
587
587
|
case 'BinaryPartitioned':
|
|
588
588
|
return Object.values(d.parts)
|
|
589
589
|
.every((p) => p.index.getIsReadyOrError() && p.values.getIsReadyOrError());
|
|
590
|
+
case 'ParquetPartitioned':
|
|
591
|
+
return Object.values(d.parts)
|
|
592
|
+
.every((p) => p.getIsReadyOrError());
|
|
590
593
|
}
|
|
591
594
|
} else {
|
|
592
595
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
@@ -7,6 +7,8 @@ import type {
|
|
|
7
7
|
JsonDataInfoEntries,
|
|
8
8
|
JsonPartitionedDataInfoEntries,
|
|
9
9
|
BinaryPartitionedDataInfoEntries,
|
|
10
|
+
ParquetPartitionedDataInfoEntries,
|
|
11
|
+
PartitionedDataInfoEntries,
|
|
10
12
|
} from '@milaboratories/pl-model-common';
|
|
11
13
|
import type { AxisFilterByIdx } from '@milaboratories/pl-model-common';
|
|
12
14
|
|
|
@@ -18,6 +20,10 @@ import type { AxisFilterByIdx } from '@milaboratories/pl-model-common';
|
|
|
18
20
|
* @param axisFilters - Array of axis filters (index, value pairs)
|
|
19
21
|
* @throws Error if any filter axis is outside the partitioning axes or data axes for Json data
|
|
20
22
|
*/
|
|
23
|
+
export function filterDataInfoEntries<Blob>(
|
|
24
|
+
dataInfoEntries: ParquetPartitionedDataInfoEntries<Blob>,
|
|
25
|
+
axisFilters: AxisFilterByIdx[],
|
|
26
|
+
): ParquetPartitionedDataInfoEntries<Blob>;
|
|
21
27
|
export function filterDataInfoEntries<Blob>(
|
|
22
28
|
dataInfoEntries: BinaryPartitionedDataInfoEntries<Blob>,
|
|
23
29
|
axisFilters: AxisFilterByIdx[],
|
|
@@ -27,9 +33,9 @@ export function filterDataInfoEntries<Blob>(
|
|
|
27
33
|
axisFilters: AxisFilterByIdx[],
|
|
28
34
|
): JsonPartitionedDataInfoEntries<Blob>;
|
|
29
35
|
export function filterDataInfoEntries<Blob>(
|
|
30
|
-
dataInfoEntries:
|
|
36
|
+
dataInfoEntries: PartitionedDataInfoEntries<Blob>,
|
|
31
37
|
axisFilters: AxisFilterByIdx[],
|
|
32
|
-
):
|
|
38
|
+
): PartitionedDataInfoEntries<Blob>;
|
|
33
39
|
export function filterDataInfoEntries(
|
|
34
40
|
dataInfoEntries: JsonDataInfoEntries,
|
|
35
41
|
axisFilters: AxisFilterByIdx[],
|
|
@@ -42,16 +48,27 @@ export function filterDataInfoEntries<Blob>(
|
|
|
42
48
|
const sortedFilters = [...axisFilters].sort((a, b) => b[0] - a[0]);
|
|
43
49
|
|
|
44
50
|
// Check for invalid filter axes
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
const { type } = dataInfoEntries;
|
|
52
|
+
switch (type) {
|
|
53
|
+
case 'Json': {
|
|
54
|
+
const { keyLength } = dataInfoEntries;
|
|
55
|
+
for (const [axisIdx] of axisFilters)
|
|
56
|
+
if (axisIdx >= keyLength)
|
|
57
|
+
throw new Error(`Can't filter on non-data axis ${axisIdx}. Must be >= ${keyLength}`);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
case 'JsonPartitioned':
|
|
61
|
+
case 'BinaryPartitioned':
|
|
62
|
+
case 'ParquetPartitioned': {
|
|
63
|
+
const { partitionKeyLength } = dataInfoEntries;
|
|
64
|
+
for (const [axisIdx] of axisFilters)
|
|
65
|
+
if (axisIdx >= partitionKeyLength)
|
|
66
|
+
throw new Error(`Can't filter on non-partitioned axis ${axisIdx}. Must be >= ${partitionKeyLength}`);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
default:
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
71
|
+
throw new Error(`Unsupported data info type: ${type satisfies never}`);
|
|
55
72
|
}
|
|
56
73
|
|
|
57
74
|
const keyMatchesFilters = (key: PColumnKey): boolean => {
|
|
@@ -72,49 +89,45 @@ export function filterDataInfoEntries<Blob>(
|
|
|
72
89
|
};
|
|
73
90
|
|
|
74
91
|
switch (dataInfoEntries.type) {
|
|
75
|
-
case 'Json': {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
92
|
+
case 'Json': return {
|
|
93
|
+
type: 'Json',
|
|
94
|
+
keyLength: dataInfoEntries.keyLength - axisFilters.length,
|
|
95
|
+
data: dataInfoEntries.data
|
|
96
|
+
.filter((entry) => keyMatchesFilters(entry.key))
|
|
97
|
+
.map((entry) => ({
|
|
79
98
|
key: removeFilteredAxes(entry.key),
|
|
80
99
|
value: entry.value,
|
|
81
|
-
}))
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
case 'JsonPartitioned': {
|
|
91
|
-
const filteredParts = dataInfoEntries.parts
|
|
92
|
-
.filter((entry: PColumnDataEntry<Blob>) => keyMatchesFilters(entry.key))
|
|
93
|
-
.map((entry: PColumnDataEntry<Blob>) => ({
|
|
100
|
+
} satisfies PColumnDataEntry<PColumnValue>)),
|
|
101
|
+
};
|
|
102
|
+
case 'JsonPartitioned': return {
|
|
103
|
+
type: 'JsonPartitioned',
|
|
104
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
|
|
105
|
+
parts: dataInfoEntries.parts
|
|
106
|
+
.filter((entry) => keyMatchesFilters(entry.key))
|
|
107
|
+
.map((entry) => ({
|
|
94
108
|
key: removeFilteredAxes(entry.key),
|
|
95
109
|
value: entry.value,
|
|
96
|
-
}))
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
case 'BinaryPartitioned': {
|
|
106
|
-
const filteredParts = dataInfoEntries.parts
|
|
107
|
-
.filter((entry: PColumnDataEntry<BinaryChunk<Blob>>) => keyMatchesFilters(entry.key))
|
|
108
|
-
.map((entry: PColumnDataEntry<BinaryChunk<Blob>>) => ({
|
|
110
|
+
} satisfies PColumnDataEntry<Blob>)),
|
|
111
|
+
};
|
|
112
|
+
case 'BinaryPartitioned': return {
|
|
113
|
+
type: 'BinaryPartitioned',
|
|
114
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
|
|
115
|
+
parts: dataInfoEntries.parts
|
|
116
|
+
.filter((entry) => keyMatchesFilters(entry.key))
|
|
117
|
+
.map((entry) => ({
|
|
109
118
|
key: removeFilteredAxes(entry.key),
|
|
110
119
|
value: entry.value,
|
|
111
|
-
}))
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
} satisfies PColumnDataEntry<BinaryChunk<Blob>>)),
|
|
121
|
+
};
|
|
122
|
+
case 'ParquetPartitioned': return {
|
|
123
|
+
type: 'ParquetPartitioned',
|
|
124
|
+
partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
|
|
125
|
+
parts: dataInfoEntries.parts
|
|
126
|
+
.filter((entry) => keyMatchesFilters(entry.key))
|
|
127
|
+
.map((entry) => ({
|
|
128
|
+
key: removeFilteredAxes(entry.key),
|
|
129
|
+
value: entry.value,
|
|
130
|
+
} satisfies PColumnDataEntry<Blob>)),
|
|
131
|
+
};
|
|
119
132
|
}
|
|
120
133
|
}
|