@finos/legend-query-builder 4.18.0 → 4.18.1
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/lib/__test__.d.ts +1 -0
- package/lib/__test__.d.ts.map +1 -1
- package/lib/__test__.js +1 -0
- package/lib/__test__.js.map +1 -1
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts +5 -0
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts.map +1 -1
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js +28 -2
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js +8 -2
- package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js.map +1 -1
- package/lib/components/workflows/AccessorQueryBuilder.js +1 -1
- package/lib/components/workflows/AccessorQueryBuilder.js.map +1 -1
- package/lib/components/workflows/DataProductQueryBuilder.d.ts.map +1 -1
- package/lib/components/workflows/DataProductQueryBuilder.js +13 -12
- package/lib/components/workflows/DataProductQueryBuilder.js.map +1 -1
- package/lib/data-access-overview.css +1 -1
- package/lib/graph/QueryBuilderMetaModelConst.d.ts +2 -0
- package/lib/graph/QueryBuilderMetaModelConst.d.ts.map +1 -1
- package/lib/graph/QueryBuilderMetaModelConst.js +2 -0
- package/lib/graph/QueryBuilderMetaModelConst.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryBuilderStateHashUtils.d.ts +1 -0
- package/lib/stores/QueryBuilderStateHashUtils.d.ts.map +1 -1
- package/lib/stores/QueryBuilderStateHashUtils.js +1 -0
- package/lib/stores/QueryBuilderStateHashUtils.js.map +1 -1
- package/lib/stores/QueryBuilderTypeaheadHelper.js +4 -4
- package/lib/stores/QueryBuilderTypeaheadHelper.js.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +1 -1
- package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationHelper.js +2 -2
- package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
- package/lib/stores/__test-utils__/TEST_DATA__QueryBuilder_Accessors.d.ts +374 -0
- package/lib/stores/__test-utils__/TEST_DATA__QueryBuilder_Accessors.d.ts.map +1 -0
- package/lib/stores/__test-utils__/TEST_DATA__QueryBuilder_Accessors.js +625 -0
- package/lib/stores/__test-utils__/TEST_DATA__QueryBuilder_Accessors.js.map +1 -0
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +3 -2
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
- package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderRelationAggregationValueSpecBuilder.js +2 -2
- package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderRelationAggregationValueSpecBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js +8 -6
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuilder.js +2 -2
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowGroupByOperatorLoader.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowGroupByOperatorLoader.js +2 -0
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowGroupByOperatorLoader.js.map +1 -1
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.js +40 -14
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.js +72 -30
- package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator.d.ts +1 -1
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.js +1 -1
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.js.map +1 -1
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.js +1 -1
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.js.map +1 -1
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.js +1 -1
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.js.map +1 -1
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.js +1 -1
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.js.map +1 -1
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_PercentRank.d.ts +25 -0
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_PercentRank.d.ts.map +1 -0
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_PercentRank.js +54 -0
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_PercentRank.js.map +1 -0
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.js +1 -1
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.js.map +1 -1
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.js +1 -1
- package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.js.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.js +3 -3
- package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/workflows/accessor/AccessorQueryBuilderState.d.ts +1 -0
- package/lib/stores/workflows/accessor/AccessorQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/workflows/accessor/AccessorQueryBuilderState.js +4 -0
- package/lib/stores/workflows/accessor/AccessorQueryBuilderState.js.map +1 -1
- package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.d.ts +31 -6
- package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.js +162 -15
- package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.js.map +1 -1
- package/package.json +5 -5
- package/src/__test__.ts +1 -0
- package/src/components/__test-utils__/QueryBuilderComponentTestUtils.tsx +73 -1
- package/src/components/fetch-structure/QueryBuilderTDSWindowPanel.tsx +10 -4
- package/src/components/workflows/AccessorQueryBuilder.tsx +2 -2
- package/src/components/workflows/DataProductQueryBuilder.tsx +40 -62
- package/src/graph/QueryBuilderMetaModelConst.ts +2 -0
- package/src/index.ts +3 -0
- package/src/stores/QueryBuilderStateHashUtils.ts +1 -0
- package/src/stores/QueryBuilderTypeaheadHelper.ts +4 -4
- package/src/stores/QueryBuilderValueSpecificationHelper.ts +5 -3
- package/src/stores/__test-utils__/TEST_DATA__QueryBuilder_Accessors.ts +630 -0
- package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +3 -2
- package/src/stores/fetch-structure/tds/aggregation/QueryBuilderRelationAggregationValueSpecBuilder.ts +2 -2
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.ts +1 -1
- package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +8 -6
- package/src/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuilder.ts +2 -2
- package/src/stores/fetch-structure/tds/window/QueryBuilderWindowGroupByOperatorLoader.ts +2 -0
- package/src/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.ts +85 -25
- package/src/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.ts +141 -38
- package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator.ts +1 -1
- package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.ts +1 -1
- package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.ts +1 -1
- package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.ts +1 -1
- package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.ts +1 -1
- package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_PercentRank.ts +57 -0
- package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.ts +1 -1
- package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.ts +1 -1
- package/src/stores/filter/QueryBuilderFilterValueSpecificationBuilder.ts +3 -3
- package/src/stores/workflows/accessor/AccessorQueryBuilderState.ts +5 -0
- package/src/stores/workflows/dataProduct/DataProductQueryBuilderState.ts +275 -24
- package/tsconfig.json +2 -0
|
@@ -40,8 +40,19 @@ import {
|
|
|
40
40
|
type QueryExecutionContext,
|
|
41
41
|
QueryDataProductNativeExecutionContext,
|
|
42
42
|
QueryDataProductModelAccessExecutionContext,
|
|
43
|
+
QueryDataProductLakehouseExecutionContext,
|
|
44
|
+
LakehouseAccessPoint,
|
|
43
45
|
type RawLambda,
|
|
44
46
|
buildRawLambdaFromLambdaFunction,
|
|
47
|
+
type Accessor,
|
|
48
|
+
type RelationTypeMetadata,
|
|
49
|
+
DataProductAccessor,
|
|
50
|
+
RelationType,
|
|
51
|
+
RelationColumn,
|
|
52
|
+
GenericType,
|
|
53
|
+
GenericTypeExplicitReference,
|
|
54
|
+
findLakehouseAccessPointGroup,
|
|
55
|
+
type PureModel,
|
|
45
56
|
} from '@finos/legend-graph';
|
|
46
57
|
import { QueryBuilderState } from '../../QueryBuilderState.js';
|
|
47
58
|
|
|
@@ -68,6 +79,35 @@ import { compareLabelFn } from '@finos/legend-art';
|
|
|
68
79
|
import { QueryBuilderEmbeddedFromExecutionContextState } from '../../QueryBuilderExecutionContextState.js';
|
|
69
80
|
import { buildLambdaFunction } from '../../QueryBuilderValueSpecificationBuilder.js';
|
|
70
81
|
|
|
82
|
+
export const buildDataProductAccessor = (
|
|
83
|
+
relationMetadata: RelationTypeMetadata,
|
|
84
|
+
dataProduct: DataProduct,
|
|
85
|
+
accessPoint: LakehouseAccessPoint,
|
|
86
|
+
graph: PureModel,
|
|
87
|
+
): DataProductAccessor => {
|
|
88
|
+
const relationType = new RelationType(accessPoint.title ?? accessPoint.id);
|
|
89
|
+
relationType.columns = relationMetadata.columns.map(
|
|
90
|
+
(col) =>
|
|
91
|
+
new RelationColumn(
|
|
92
|
+
col.name,
|
|
93
|
+
GenericTypeExplicitReference.create(
|
|
94
|
+
new GenericType(graph.getType(col.type)),
|
|
95
|
+
),
|
|
96
|
+
),
|
|
97
|
+
);
|
|
98
|
+
const groupResult = findLakehouseAccessPointGroup(
|
|
99
|
+
dataProduct,
|
|
100
|
+
accessPoint.id,
|
|
101
|
+
);
|
|
102
|
+
return new DataProductAccessor(
|
|
103
|
+
dataProduct.path,
|
|
104
|
+
groupResult?.group.id,
|
|
105
|
+
accessPoint.id,
|
|
106
|
+
relationType,
|
|
107
|
+
dataProduct,
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
|
|
71
111
|
export type DataProductOption = {
|
|
72
112
|
label: string;
|
|
73
113
|
value: DepotEntityWithOrigin;
|
|
@@ -104,6 +144,15 @@ export const buildModelAccessPointGroupOption = (
|
|
|
104
144
|
value,
|
|
105
145
|
});
|
|
106
146
|
|
|
147
|
+
export type ExecutionIdOption = {
|
|
148
|
+
label: string;
|
|
149
|
+
tag: string;
|
|
150
|
+
value:
|
|
151
|
+
| NativeModelExecutionContext
|
|
152
|
+
| ModelAccessPointGroup
|
|
153
|
+
| LakehouseAccessPoint;
|
|
154
|
+
};
|
|
155
|
+
|
|
107
156
|
export abstract class DataProductExecutionState<T> {
|
|
108
157
|
readonly queryBuilderState: DataProductQueryBuilderState;
|
|
109
158
|
exectionValue: T;
|
|
@@ -118,10 +167,14 @@ export abstract class DataProductExecutionState<T> {
|
|
|
118
167
|
|
|
119
168
|
abstract get label(): string;
|
|
120
169
|
|
|
121
|
-
abstract get mapping(): Mapping;
|
|
170
|
+
abstract get mapping(): Mapping | undefined;
|
|
122
171
|
|
|
123
172
|
abstract get featuredElements(): DataProductElementScope[] | undefined;
|
|
124
173
|
|
|
174
|
+
get showRuntimeOptions(): boolean {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
|
|
125
178
|
get selectedOption(): { label: string; value: T } {
|
|
126
179
|
return {
|
|
127
180
|
label: this.label,
|
|
@@ -196,7 +249,7 @@ export class ModelAccessPointDataProductExecutionState extends DataProductExecut
|
|
|
196
249
|
return this.exectionValue.featuredElements;
|
|
197
250
|
}
|
|
198
251
|
|
|
199
|
-
get showRuntimeOptions(): boolean {
|
|
252
|
+
override get showRuntimeOptions(): boolean {
|
|
200
253
|
return this.compatibleRuntimes.length > 1;
|
|
201
254
|
}
|
|
202
255
|
|
|
@@ -207,6 +260,46 @@ export class ModelAccessPointDataProductExecutionState extends DataProductExecut
|
|
|
207
260
|
}
|
|
208
261
|
}
|
|
209
262
|
|
|
263
|
+
export class LakehouseDataProductExecutionState extends DataProductExecutionState<LakehouseAccessPoint> {
|
|
264
|
+
selectedRuntime: PackageableRuntime | undefined;
|
|
265
|
+
adhocRuntime = false;
|
|
266
|
+
constructor(
|
|
267
|
+
executionState: LakehouseAccessPoint,
|
|
268
|
+
queryBuilderState: DataProductQueryBuilderState,
|
|
269
|
+
) {
|
|
270
|
+
super(executionState, queryBuilderState);
|
|
271
|
+
makeObservable(this, {});
|
|
272
|
+
this.selectedRuntime = this.compatibleRuntimes[0];
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
changeSelectedRuntime(val: PackageableRuntime): void {
|
|
276
|
+
this.selectedRuntime = val;
|
|
277
|
+
this.queryBuilderState.changeRuntime(val);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
override get label(): string {
|
|
281
|
+
return this.exectionValue.title ?? this.exectionValue.id;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
get mapping(): Mapping | undefined {
|
|
285
|
+
return undefined;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
get featuredElements(): DataProductElementScope[] | undefined {
|
|
289
|
+
return undefined;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
get compatibleRuntimes(): PackageableRuntime[] {
|
|
293
|
+
return this.queryBuilderState.graphManagerState.usableRuntimes.filter(
|
|
294
|
+
(runtime) => runtime.runtimeValue instanceof LakehouseRuntime,
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
override get showRuntimeOptions(): boolean {
|
|
299
|
+
return this.compatibleRuntimes.length > 1;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
210
303
|
export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
211
304
|
readonly onClassChange?: ((val: Class) => void) | undefined;
|
|
212
305
|
readonly onDataProductChange?: (val: DepotEntityWithOrigin) => Promise<void>;
|
|
@@ -218,7 +311,7 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
218
311
|
dataProduct: DataProduct;
|
|
219
312
|
dataProductArtifact: V1_DataProductArtifact | undefined;
|
|
220
313
|
executionState: DataProductExecutionState<
|
|
221
|
-
NativeModelExecutionContext | ModelAccessPointGroup
|
|
314
|
+
NativeModelExecutionContext | ModelAccessPointGroup | LakehouseAccessPoint
|
|
222
315
|
>;
|
|
223
316
|
entities: DepotEntityWithOrigin[] | undefined;
|
|
224
317
|
|
|
@@ -234,7 +327,10 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
234
327
|
dataProduct: DataProduct,
|
|
235
328
|
artifact: V1_DataProductArtifact | undefined,
|
|
236
329
|
actionConfig: QueryBuilderActionConfig,
|
|
237
|
-
executionState:
|
|
330
|
+
executionState:
|
|
331
|
+
| NativeModelExecutionContext
|
|
332
|
+
| ModelAccessPointGroup
|
|
333
|
+
| LakehouseAccessPoint,
|
|
238
334
|
prioritizeEntityFunc: ((val: DepotEntityWithOrigin) => boolean) | undefined,
|
|
239
335
|
onDataProductChange: (val: DepotEntityWithOrigin) => Promise<void>,
|
|
240
336
|
onExecutionContextChange?:
|
|
@@ -255,8 +351,12 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
255
351
|
isProductLinkable: computed,
|
|
256
352
|
isNativeMode: computed,
|
|
257
353
|
isModelAccessPointGroupMode: computed,
|
|
354
|
+
isLakehouseMode: computed,
|
|
258
355
|
showExecutionContextOptions: computed,
|
|
259
356
|
showModelAccessPointGroupSelector: computed,
|
|
357
|
+
showExecutionIdSelector: computed,
|
|
358
|
+
executionIdOptions: computed,
|
|
359
|
+
selectedExecutionIdOption: computed,
|
|
260
360
|
selectedExecOption: computed,
|
|
261
361
|
selectedModelAccessPointGroupOption: computed,
|
|
262
362
|
usableClasses: computed,
|
|
@@ -277,11 +377,16 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
277
377
|
this.executionState =
|
|
278
378
|
executionState instanceof NativeModelExecutionContext
|
|
279
379
|
? new NativeModelDataProductExecutionState(executionState, this)
|
|
280
|
-
:
|
|
380
|
+
: executionState instanceof LakehouseAccessPoint
|
|
381
|
+
? new LakehouseDataProductExecutionState(executionState, this)
|
|
382
|
+
: new ModelAccessPointDataProductExecutionState(executionState, this);
|
|
281
383
|
this.prioritizeEntityFunc = prioritizeEntityFunc;
|
|
282
384
|
this.onDataProductChange = onDataProductChange;
|
|
283
385
|
this.onExecutionContextChange = onExecutionContextChange;
|
|
284
386
|
this.onClassChange = onClassChange;
|
|
387
|
+
// force from.
|
|
388
|
+
this.executionContextState =
|
|
389
|
+
new QueryBuilderEmbeddedFromExecutionContextState(this);
|
|
285
390
|
}
|
|
286
391
|
|
|
287
392
|
get isProductLinkable(): boolean {
|
|
@@ -298,6 +403,10 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
298
403
|
);
|
|
299
404
|
}
|
|
300
405
|
|
|
406
|
+
get isLakehouseMode(): boolean {
|
|
407
|
+
return this.executionState instanceof LakehouseDataProductExecutionState;
|
|
408
|
+
}
|
|
409
|
+
|
|
301
410
|
get showExecutionContextOptions(): boolean {
|
|
302
411
|
return this.isNativeMode && this.execOptions.length > 1;
|
|
303
412
|
}
|
|
@@ -309,6 +418,75 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
309
418
|
);
|
|
310
419
|
}
|
|
311
420
|
|
|
421
|
+
get executionIdOptions(): ExecutionIdOption[] {
|
|
422
|
+
const nativeOptions: ExecutionIdOption[] = (
|
|
423
|
+
this.dataProduct.nativeModelAccess?.nativeModelExecutionContexts ?? []
|
|
424
|
+
).map((ctx) => ({
|
|
425
|
+
label: ctx.key,
|
|
426
|
+
tag: 'Native',
|
|
427
|
+
value: ctx,
|
|
428
|
+
}));
|
|
429
|
+
const modelOptions: ExecutionIdOption[] = this.modelAccessPointGroups.map(
|
|
430
|
+
(group) => ({
|
|
431
|
+
label: group.title ?? group.id,
|
|
432
|
+
tag: 'Model',
|
|
433
|
+
value: group,
|
|
434
|
+
}),
|
|
435
|
+
);
|
|
436
|
+
const lakehouseOptions: ExecutionIdOption[] =
|
|
437
|
+
this.dataProduct.accessPointGroups
|
|
438
|
+
.flatMap((group) => group.accessPoints)
|
|
439
|
+
.filter(filterByType(LakehouseAccessPoint))
|
|
440
|
+
.map((ap) => ({
|
|
441
|
+
label: ap.title ?? ap.id,
|
|
442
|
+
tag: 'Lakehouse',
|
|
443
|
+
value: ap,
|
|
444
|
+
}));
|
|
445
|
+
return [...modelOptions, ...lakehouseOptions, ...nativeOptions].sort(
|
|
446
|
+
compareLabelFn,
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
get selectedExecutionIdOption(): ExecutionIdOption | undefined {
|
|
451
|
+
const state = this.executionState;
|
|
452
|
+
if (state instanceof NativeModelDataProductExecutionState) {
|
|
453
|
+
return {
|
|
454
|
+
label: state.exectionValue.key,
|
|
455
|
+
tag: 'Native',
|
|
456
|
+
value: state.exectionValue,
|
|
457
|
+
};
|
|
458
|
+
} else if (state instanceof ModelAccessPointDataProductExecutionState) {
|
|
459
|
+
return {
|
|
460
|
+
label: state.exectionValue.title ?? state.exectionValue.id,
|
|
461
|
+
tag: 'Model',
|
|
462
|
+
value: state.exectionValue,
|
|
463
|
+
};
|
|
464
|
+
} else if (state instanceof LakehouseDataProductExecutionState) {
|
|
465
|
+
return {
|
|
466
|
+
label: state.exectionValue.title ?? state.exectionValue.id,
|
|
467
|
+
tag: 'Lakehouse',
|
|
468
|
+
value: state.exectionValue,
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
return undefined;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
get showExecutionIdSelector(): boolean {
|
|
475
|
+
return this.executionIdOptions.length > 1;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
async changeExecutionId(option: ExecutionIdOption): Promise<void> {
|
|
479
|
+
const val = option.value;
|
|
480
|
+
if (val === this.executionState.exectionValue) {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
await this.changeExecutionState(val);
|
|
484
|
+
await this.propagateExecutionContextChange();
|
|
485
|
+
if (val instanceof NativeModelExecutionContext) {
|
|
486
|
+
this.onExecutionContextChange?.(val);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
312
490
|
get selectedExecOption():
|
|
313
491
|
| { label: string; value: NativeModelExecutionContext }
|
|
314
492
|
| undefined {
|
|
@@ -317,6 +495,13 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
317
495
|
: undefined;
|
|
318
496
|
}
|
|
319
497
|
|
|
498
|
+
override get requiresMappingForExecution(): boolean {
|
|
499
|
+
if (this.executionState instanceof LakehouseDataProductExecutionState) {
|
|
500
|
+
return false;
|
|
501
|
+
}
|
|
502
|
+
return true;
|
|
503
|
+
}
|
|
504
|
+
|
|
320
505
|
get selectedModelAccessPointGroupOption():
|
|
321
506
|
| ModelAccessPointGroupOption
|
|
322
507
|
| undefined {
|
|
@@ -390,6 +575,13 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
390
575
|
execContext.dataProductPath = this.dataProduct.path;
|
|
391
576
|
execContext.accessPointGroupId = this.executionState.exectionValue.id;
|
|
392
577
|
return execContext;
|
|
578
|
+
} else if (
|
|
579
|
+
this.executionState instanceof LakehouseDataProductExecutionState
|
|
580
|
+
) {
|
|
581
|
+
const execContext = new QueryDataProductLakehouseExecutionContext();
|
|
582
|
+
execContext.dataProductPath = this.dataProduct.path;
|
|
583
|
+
execContext.accessPointId = this.executionState.exectionValue.id;
|
|
584
|
+
return execContext;
|
|
393
585
|
}
|
|
394
586
|
return super.getQueryExecutionContext();
|
|
395
587
|
}
|
|
@@ -403,7 +595,7 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
403
595
|
val.path,
|
|
404
596
|
);
|
|
405
597
|
if (dataProduct) {
|
|
406
|
-
this.initWithDataProduct(dataProduct);
|
|
598
|
+
this.initWithDataProduct(dataProduct, undefined, undefined);
|
|
407
599
|
this.loadDataProductModelState.pass();
|
|
408
600
|
} else if (this.onDataProductChange) {
|
|
409
601
|
// data product not in current graph — trigger full rebuild
|
|
@@ -430,7 +622,11 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
430
622
|
|
|
431
623
|
initWithDataProduct(
|
|
432
624
|
dataProduct: DataProduct,
|
|
433
|
-
|
|
625
|
+
accessor: Accessor | undefined,
|
|
626
|
+
preResolvedState?:
|
|
627
|
+
| NativeModelExecutionContext
|
|
628
|
+
| ModelAccessPointGroup
|
|
629
|
+
| LakehouseAccessPoint,
|
|
434
630
|
): void {
|
|
435
631
|
try {
|
|
436
632
|
const execValue =
|
|
@@ -439,8 +635,13 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
439
635
|
this.executionState =
|
|
440
636
|
execValue instanceof NativeModelExecutionContext
|
|
441
637
|
? new NativeModelDataProductExecutionState(execValue, this)
|
|
442
|
-
:
|
|
443
|
-
|
|
638
|
+
: execValue instanceof LakehouseAccessPoint
|
|
639
|
+
? new LakehouseDataProductExecutionState(execValue, this)
|
|
640
|
+
: new ModelAccessPointDataProductExecutionState(execValue, this);
|
|
641
|
+
const mapping = this.executionState.mapping;
|
|
642
|
+
if (mapping) {
|
|
643
|
+
this.changeMapping(mapping);
|
|
644
|
+
}
|
|
444
645
|
if (this.executionState instanceof NativeModelDataProductExecutionState) {
|
|
445
646
|
const runtime = guaranteeNonNullable(
|
|
446
647
|
this.executionState.exectionValue.runtime,
|
|
@@ -453,19 +654,37 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
453
654
|
this.executionState.selectedRuntime instanceof PackageableRuntime
|
|
454
655
|
) {
|
|
455
656
|
this.changeRuntime(this.executionState.selectedRuntime);
|
|
657
|
+
} else if (
|
|
658
|
+
this.executionState instanceof LakehouseDataProductExecutionState &&
|
|
659
|
+
accessor &&
|
|
660
|
+
this.executionState.selectedRuntime instanceof PackageableRuntime
|
|
661
|
+
) {
|
|
662
|
+
this.setSourceElement(accessor);
|
|
663
|
+
this.changeRuntime(
|
|
664
|
+
new RuntimePointer(
|
|
665
|
+
PackageableElementExplicitReference.create(
|
|
666
|
+
this.executionState.selectedRuntime,
|
|
667
|
+
),
|
|
668
|
+
),
|
|
669
|
+
);
|
|
456
670
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
this.
|
|
671
|
+
if (mapping) {
|
|
672
|
+
const compatibleClasses = resolveUsableDataProductClasses(
|
|
673
|
+
this.activeFeaturedElements,
|
|
674
|
+
mapping,
|
|
675
|
+
this.graphManagerState,
|
|
676
|
+
undefined,
|
|
677
|
+
);
|
|
678
|
+
// if there is no chosen class or the chosen one is not compatible
|
|
679
|
+
// with the mapping then pick a compatible class if possible
|
|
680
|
+
if (
|
|
681
|
+
!this.sourceClass ||
|
|
682
|
+
!compatibleClasses.includes(this.sourceClass)
|
|
683
|
+
) {
|
|
684
|
+
const possibleNewClass = compatibleClasses[0];
|
|
685
|
+
if (possibleNewClass) {
|
|
686
|
+
this.changeSourceElement(possibleNewClass);
|
|
687
|
+
}
|
|
469
688
|
}
|
|
470
689
|
}
|
|
471
690
|
} catch (error) {
|
|
@@ -489,12 +708,40 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
489
708
|
}
|
|
490
709
|
|
|
491
710
|
setExecutionState(
|
|
492
|
-
val:
|
|
711
|
+
val:
|
|
712
|
+
| NativeModelExecutionContext
|
|
713
|
+
| ModelAccessPointGroup
|
|
714
|
+
| LakehouseAccessPoint,
|
|
493
715
|
): void {
|
|
494
716
|
this.executionState =
|
|
495
717
|
val instanceof NativeModelExecutionContext
|
|
496
718
|
? new NativeModelDataProductExecutionState(val, this)
|
|
497
|
-
:
|
|
719
|
+
: val instanceof LakehouseAccessPoint
|
|
720
|
+
? new LakehouseDataProductExecutionState(val, this)
|
|
721
|
+
: new ModelAccessPointDataProductExecutionState(val, this);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
async changeExecutionState(
|
|
725
|
+
val:
|
|
726
|
+
| NativeModelExecutionContext
|
|
727
|
+
| ModelAccessPointGroup
|
|
728
|
+
| LakehouseAccessPoint,
|
|
729
|
+
): Promise<void> {
|
|
730
|
+
this.setExecutionState(val);
|
|
731
|
+
if (val instanceof LakehouseAccessPoint) {
|
|
732
|
+
const relationMetadata =
|
|
733
|
+
await this.graphManagerState.graphManager.getLambdaRelationType(
|
|
734
|
+
val.func,
|
|
735
|
+
this.graphManagerState.graph,
|
|
736
|
+
);
|
|
737
|
+
const accessor = buildDataProductAccessor(
|
|
738
|
+
relationMetadata,
|
|
739
|
+
this.dataProduct,
|
|
740
|
+
val,
|
|
741
|
+
this.graphManagerState.graph,
|
|
742
|
+
);
|
|
743
|
+
this.setSourceElement(accessor);
|
|
744
|
+
}
|
|
498
745
|
}
|
|
499
746
|
|
|
500
747
|
get modelAccessPointGroups(): ModelAccessPointGroup[] {
|
|
@@ -613,7 +860,11 @@ export class DataProductQueryBuilderState extends QueryBuilderState {
|
|
|
613
860
|
// contains model access point group
|
|
614
861
|
this.dataProduct.accessPointGroups.filter(
|
|
615
862
|
filterByType(ModelAccessPointGroup),
|
|
616
|
-
).length > 0
|
|
863
|
+
).length > 0 ||
|
|
864
|
+
// contains lakehouse access point
|
|
865
|
+
this.dataProduct.accessPointGroups.some((group) =>
|
|
866
|
+
group.accessPoints.some((ap) => ap instanceof LakehouseAccessPoint),
|
|
867
|
+
)
|
|
617
868
|
);
|
|
618
869
|
}
|
|
619
870
|
|
package/tsconfig.json
CHANGED
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
"./src/stores/QueryLoaderState.ts",
|
|
107
107
|
"./src/stores/ServiceInfo.ts",
|
|
108
108
|
"./src/stores/__test-utils__/QueryBuilderStateTestUtils.ts",
|
|
109
|
+
"./src/stores/__test-utils__/TEST_DATA__QueryBuilder_Accessors.ts",
|
|
109
110
|
"./src/stores/data-access/DataAccessState.ts",
|
|
110
111
|
"./src/stores/data-cube/QueryBuilderDataCubeEngine.ts",
|
|
111
112
|
"./src/stores/data-cube/QueryBuilderDataCubeHelper.ts",
|
|
@@ -181,6 +182,7 @@
|
|
|
181
182
|
"./src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.ts",
|
|
182
183
|
"./src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.ts",
|
|
183
184
|
"./src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.ts",
|
|
185
|
+
"./src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_PercentRank.ts",
|
|
184
186
|
"./src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.ts",
|
|
185
187
|
"./src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.ts",
|
|
186
188
|
"./src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.ts",
|