@malloydata/malloy-interfaces 0.0.298 → 0.0.300
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/to_malloy.js +43 -16
- package/dist/types.d.ts +39 -8
- package/dist/types.js +103 -2
- package/package.json +1 -1
- package/thrift/malloy.thrift +50 -2
package/dist/to_malloy.js
CHANGED
|
@@ -55,6 +55,17 @@ function wrap(open, block, close, options) {
|
|
|
55
55
|
function escapeString(str) {
|
|
56
56
|
return { contents: str, quoteCharacter: '"' }; // TODO
|
|
57
57
|
}
|
|
58
|
+
function join(fragments, separator) {
|
|
59
|
+
const result = [];
|
|
60
|
+
for (let i = 0; i < fragments.length; i++) {
|
|
61
|
+
const fragment = fragments[i];
|
|
62
|
+
result.push(fragment);
|
|
63
|
+
if (i < fragments.length - 1) {
|
|
64
|
+
result.push(separator);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
58
69
|
function literalToFragments(literal) {
|
|
59
70
|
var _a, _b;
|
|
60
71
|
switch (literal.kind) {
|
|
@@ -268,9 +279,9 @@ function segmentToFragments(segment) {
|
|
|
268
279
|
function groupedOperationsToFragments(operations) {
|
|
269
280
|
switch (operations[0].kind) {
|
|
270
281
|
case 'aggregate':
|
|
271
|
-
return
|
|
282
|
+
return fieldOperationToFragments(operations, 'aggregate');
|
|
272
283
|
case 'group_by':
|
|
273
|
-
return
|
|
284
|
+
return fieldOperationToFragments(operations, 'group_by');
|
|
274
285
|
case 'order_by':
|
|
275
286
|
return orderByToFragments(operations);
|
|
276
287
|
case 'nest':
|
|
@@ -283,6 +294,8 @@ function groupedOperationsToFragments(operations) {
|
|
|
283
294
|
return havingToFragments(operations);
|
|
284
295
|
case 'drill':
|
|
285
296
|
return drillToFragments(operations);
|
|
297
|
+
case 'calculate':
|
|
298
|
+
return fieldOperationToFragments(operations, 'calculate');
|
|
286
299
|
}
|
|
287
300
|
}
|
|
288
301
|
function formatBlock(label, items, separator = '') {
|
|
@@ -320,6 +333,7 @@ function timeUnitToFragment(timeUnit) {
|
|
|
320
333
|
return timeUnit;
|
|
321
334
|
}
|
|
322
335
|
function expressionToFragments(expression) {
|
|
336
|
+
var _a;
|
|
323
337
|
switch (expression.kind) {
|
|
324
338
|
case 'field_reference':
|
|
325
339
|
return referenceToFragments(expression);
|
|
@@ -336,9 +350,31 @@ function expressionToFragments(expression) {
|
|
|
336
350
|
];
|
|
337
351
|
case 'literal_value':
|
|
338
352
|
return literalToFragments(expression.literal_value);
|
|
353
|
+
case 'moving_average': {
|
|
354
|
+
const fragments = [
|
|
355
|
+
'avg_moving',
|
|
356
|
+
...wrap('(', [
|
|
357
|
+
...referenceToFragments(expression.field_reference),
|
|
358
|
+
expression.rows_preceding !== undefined
|
|
359
|
+
? `, ${expression.rows_preceding}`
|
|
360
|
+
: ', 0',
|
|
361
|
+
expression.rows_following !== undefined
|
|
362
|
+
? `, ${expression.rows_following}`
|
|
363
|
+
: '',
|
|
364
|
+
], ')', { spaces: false }),
|
|
365
|
+
];
|
|
366
|
+
if ((_a = expression.partition_fields) === null || _a === void 0 ? void 0 : _a.length) {
|
|
367
|
+
fragments.push(...wrap(' {', [
|
|
368
|
+
'partition_by',
|
|
369
|
+
': ',
|
|
370
|
+
...join(expression.partition_fields.flatMap(partitionField => referenceToFragments(partitionField)), ', '),
|
|
371
|
+
], '}'));
|
|
372
|
+
}
|
|
373
|
+
return fragments;
|
|
374
|
+
}
|
|
339
375
|
}
|
|
340
376
|
}
|
|
341
|
-
function
|
|
377
|
+
function fieldItemToFragments(item, hideAnnotations = false) {
|
|
342
378
|
const fragments = [];
|
|
343
379
|
if (!hideAnnotations) {
|
|
344
380
|
fragments.push(...annotationsToFragments(item.field.annotations));
|
|
@@ -350,22 +386,13 @@ function groupByOrAggregateItemToFragments(item, hideAnnotations = false) {
|
|
|
350
386
|
fragments.push(...fieldToFragments(item.field));
|
|
351
387
|
return fragments;
|
|
352
388
|
}
|
|
353
|
-
function
|
|
354
|
-
const fragments = [];
|
|
355
|
-
const hoistAnnotations = groupBy.length === 1;
|
|
356
|
-
if (hoistAnnotations) {
|
|
357
|
-
fragments.push(...annotationsToFragments(groupBy[0].field.annotations));
|
|
358
|
-
}
|
|
359
|
-
fragments.push(...formatBlock('group_by', groupBy.map(i => groupByOrAggregateItemToFragments(i, hoistAnnotations))));
|
|
360
|
-
return fragments;
|
|
361
|
-
}
|
|
362
|
-
function aggregateToFragments(groupBy) {
|
|
389
|
+
function fieldOperationToFragments(operation, label) {
|
|
363
390
|
const fragments = [];
|
|
364
|
-
const hoistAnnotations =
|
|
391
|
+
const hoistAnnotations = operation.length === 1;
|
|
365
392
|
if (hoistAnnotations) {
|
|
366
|
-
fragments.push(...annotationsToFragments(
|
|
393
|
+
fragments.push(...annotationsToFragments(operation[0].field.annotations));
|
|
367
394
|
}
|
|
368
|
-
fragments.push(...formatBlock(
|
|
395
|
+
fragments.push(...formatBlock(label, operation.map(i => fieldItemToFragments(i, hoistAnnotations))));
|
|
369
396
|
return fragments;
|
|
370
397
|
}
|
|
371
398
|
function orderByToFragments(orderBy) {
|
package/dist/types.d.ts
CHANGED
|
@@ -73,6 +73,15 @@ export type BooleanLiteral = {
|
|
|
73
73
|
boolean_value: boolean;
|
|
74
74
|
};
|
|
75
75
|
export type BooleanType = {};
|
|
76
|
+
export type CalculateInfo = {
|
|
77
|
+
name: string;
|
|
78
|
+
type: AtomicType;
|
|
79
|
+
annotations?: Array<Annotation>;
|
|
80
|
+
};
|
|
81
|
+
export type CalculateOperation = {
|
|
82
|
+
name: string;
|
|
83
|
+
field: Field;
|
|
84
|
+
};
|
|
76
85
|
export type CellType = 'string_cell' | 'boolean_cell' | 'date_cell' | 'timestamp_cell' | 'number_cell' | 'json_cell' | 'record_cell' | 'array_cell' | 'null_cell' | 'sql_native_cell';
|
|
77
86
|
export type Cell = CellWithStringCell | CellWithBooleanCell | CellWithDateCell | CellWithTimestampCell | CellWithNumberCell | CellWithJSONCell | CellWithRecordCell | CellWithArrayCell | CellWithNullCell | CellWithSQLNativeCell;
|
|
78
87
|
export type CellWithStringCell = {
|
|
@@ -108,6 +117,7 @@ export type CellWithSQLNativeCell = {
|
|
|
108
117
|
export type CompileModelRequest = {
|
|
109
118
|
model_url: string;
|
|
110
119
|
extend_model_url?: string;
|
|
120
|
+
exclude_references?: boolean;
|
|
111
121
|
compiler_needs?: CompilerNeeds;
|
|
112
122
|
};
|
|
113
123
|
export type CompileModelResponse = {
|
|
@@ -119,8 +129,10 @@ export type CompileModelResponse = {
|
|
|
119
129
|
};
|
|
120
130
|
export type CompileQueryRequest = {
|
|
121
131
|
model_url: string;
|
|
122
|
-
query
|
|
132
|
+
query?: Query;
|
|
133
|
+
query_malloy?: string;
|
|
123
134
|
default_row_limit?: number;
|
|
135
|
+
exclude_references?: boolean;
|
|
124
136
|
compiler_needs?: CompilerNeeds;
|
|
125
137
|
};
|
|
126
138
|
export type CompileQueryResponse = {
|
|
@@ -135,6 +147,7 @@ export type CompileSourceRequest = {
|
|
|
135
147
|
model_url: string;
|
|
136
148
|
name: string;
|
|
137
149
|
extend_model_url?: string;
|
|
150
|
+
exclude_references?: boolean;
|
|
138
151
|
compiler_needs?: CompilerNeeds;
|
|
139
152
|
};
|
|
140
153
|
export type CompileSourceResponse = {
|
|
@@ -190,8 +203,8 @@ export type DocumentRange = {
|
|
|
190
203
|
export type DrillOperation = {
|
|
191
204
|
filter: Filter;
|
|
192
205
|
};
|
|
193
|
-
export type ExpressionType = 'field_reference' | 'time_truncation' | 'filtered_field' | 'literal_value';
|
|
194
|
-
export type Expression = ExpressionWithFieldReference | ExpressionWithTimeTruncation | ExpressionWithFilteredField | ExpressionWithLiteralValue;
|
|
206
|
+
export type ExpressionType = 'field_reference' | 'time_truncation' | 'filtered_field' | 'literal_value' | 'moving_average';
|
|
207
|
+
export type Expression = ExpressionWithFieldReference | ExpressionWithTimeTruncation | ExpressionWithFilteredField | ExpressionWithLiteralValue | ExpressionWithMovingAverage;
|
|
195
208
|
export type ExpressionWithFieldReference = {
|
|
196
209
|
kind: 'field_reference';
|
|
197
210
|
} & Reference;
|
|
@@ -204,12 +217,15 @@ export type ExpressionWithFilteredField = {
|
|
|
204
217
|
export type ExpressionWithLiteralValue = {
|
|
205
218
|
kind: 'literal_value';
|
|
206
219
|
} & LiteralValueExpression;
|
|
220
|
+
export type ExpressionWithMovingAverage = {
|
|
221
|
+
kind: 'moving_average';
|
|
222
|
+
} & MovingAverage;
|
|
207
223
|
export type Field = {
|
|
208
224
|
expression: Expression;
|
|
209
225
|
annotations?: Array<Annotation>;
|
|
210
226
|
};
|
|
211
|
-
export type FieldInfoType = 'dimension' | 'measure' | 'join' | 'view';
|
|
212
|
-
export type FieldInfo = FieldInfoWithDimension | FieldInfoWithMeasure | FieldInfoWithJoin | FieldInfoWithView;
|
|
227
|
+
export type FieldInfoType = 'dimension' | 'measure' | 'join' | 'view' | 'calculate';
|
|
228
|
+
export type FieldInfo = FieldInfoWithDimension | FieldInfoWithMeasure | FieldInfoWithJoin | FieldInfoWithView | FieldInfoWithCalculate;
|
|
213
229
|
export type FieldInfoWithDimension = {
|
|
214
230
|
kind: 'dimension';
|
|
215
231
|
} & DimensionInfo;
|
|
@@ -222,6 +238,9 @@ export type FieldInfoWithJoin = {
|
|
|
222
238
|
export type FieldInfoWithView = {
|
|
223
239
|
kind: 'view';
|
|
224
240
|
} & ViewInfo;
|
|
241
|
+
export type FieldInfoWithCalculate = {
|
|
242
|
+
kind: 'calculate';
|
|
243
|
+
} & CalculateInfo;
|
|
225
244
|
export type File = {
|
|
226
245
|
url: string;
|
|
227
246
|
contents?: string;
|
|
@@ -345,6 +364,12 @@ export type ModelInfo = {
|
|
|
345
364
|
annotations?: Array<Annotation>;
|
|
346
365
|
anonymous_queries: Array<AnonymousQueryInfo>;
|
|
347
366
|
};
|
|
367
|
+
export type MovingAverage = {
|
|
368
|
+
field_reference: Reference;
|
|
369
|
+
rows_preceding?: number;
|
|
370
|
+
rows_following?: number;
|
|
371
|
+
partition_fields?: Array<Reference>;
|
|
372
|
+
};
|
|
348
373
|
export type Nest = {
|
|
349
374
|
name?: string;
|
|
350
375
|
view: View;
|
|
@@ -479,6 +504,7 @@ export type Result = {
|
|
|
479
504
|
export type RunIndexQueryRequest = {
|
|
480
505
|
model_url: string;
|
|
481
506
|
source_name: string;
|
|
507
|
+
exclude_references?: boolean;
|
|
482
508
|
compiler_needs?: CompilerNeeds;
|
|
483
509
|
};
|
|
484
510
|
export type RunIndexQueryResponse = {
|
|
@@ -488,8 +514,10 @@ export type RunIndexQueryResponse = {
|
|
|
488
514
|
};
|
|
489
515
|
export type RunQueryRequest = {
|
|
490
516
|
model_url: string;
|
|
491
|
-
query
|
|
517
|
+
query?: Query;
|
|
518
|
+
query_malloy?: string;
|
|
492
519
|
default_row_limit?: number;
|
|
520
|
+
exclude_references?: boolean;
|
|
493
521
|
compiler_needs?: CompilerNeeds;
|
|
494
522
|
};
|
|
495
523
|
export type RunQueryResponse = {
|
|
@@ -584,8 +612,8 @@ export type ViewInfo = {
|
|
|
584
612
|
annotations?: Array<Annotation>;
|
|
585
613
|
definition?: View;
|
|
586
614
|
};
|
|
587
|
-
export type ViewOperationType = 'group_by' | 'aggregate' | 'order_by' | 'limit' | 'where' | 'nest' | 'having' | 'drill';
|
|
588
|
-
export type ViewOperation = ViewOperationWithGroupBy | ViewOperationWithAggregate | ViewOperationWithOrderBy | ViewOperationWithLimit | ViewOperationWithWhere | ViewOperationWithNest | ViewOperationWithHaving | ViewOperationWithDrill;
|
|
615
|
+
export type ViewOperationType = 'group_by' | 'aggregate' | 'order_by' | 'limit' | 'where' | 'nest' | 'having' | 'drill' | 'calculate';
|
|
616
|
+
export type ViewOperation = ViewOperationWithGroupBy | ViewOperationWithAggregate | ViewOperationWithOrderBy | ViewOperationWithLimit | ViewOperationWithWhere | ViewOperationWithNest | ViewOperationWithHaving | ViewOperationWithDrill | ViewOperationWithCalculate;
|
|
589
617
|
export type ViewOperationWithGroupBy = {
|
|
590
618
|
kind: 'group_by';
|
|
591
619
|
} & GroupBy;
|
|
@@ -610,6 +638,9 @@ export type ViewOperationWithHaving = {
|
|
|
610
638
|
export type ViewOperationWithDrill = {
|
|
611
639
|
kind: 'drill';
|
|
612
640
|
} & DrillOperation;
|
|
641
|
+
export type ViewOperationWithCalculate = {
|
|
642
|
+
kind: 'calculate';
|
|
643
|
+
} & CalculateOperation;
|
|
613
644
|
export type ViewRefinement = {
|
|
614
645
|
base: ViewDefinition;
|
|
615
646
|
refinement: ViewDefinition;
|
package/dist/types.js
CHANGED
|
@@ -134,6 +134,43 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
134
134
|
'name': 'BooleanType',
|
|
135
135
|
'fields': {},
|
|
136
136
|
},
|
|
137
|
+
'CalculateInfo': {
|
|
138
|
+
'type': 'struct',
|
|
139
|
+
'name': 'CalculateInfo',
|
|
140
|
+
'fields': {
|
|
141
|
+
'name': {
|
|
142
|
+
'type': 'string',
|
|
143
|
+
'optional': false,
|
|
144
|
+
'array': false,
|
|
145
|
+
},
|
|
146
|
+
'type': {
|
|
147
|
+
'type': 'AtomicType',
|
|
148
|
+
'optional': false,
|
|
149
|
+
'array': false,
|
|
150
|
+
},
|
|
151
|
+
'annotations': {
|
|
152
|
+
'type': 'Annotation',
|
|
153
|
+
'array': true,
|
|
154
|
+
'optional': true,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
'CalculateOperation': {
|
|
159
|
+
'type': 'struct',
|
|
160
|
+
'name': 'CalculateOperation',
|
|
161
|
+
'fields': {
|
|
162
|
+
'name': {
|
|
163
|
+
'type': 'string',
|
|
164
|
+
'optional': false,
|
|
165
|
+
'array': false,
|
|
166
|
+
},
|
|
167
|
+
'field': {
|
|
168
|
+
'type': 'Field',
|
|
169
|
+
'optional': false,
|
|
170
|
+
'array': false,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
137
174
|
'Cell': {
|
|
138
175
|
'type': 'union',
|
|
139
176
|
'name': 'Cell',
|
|
@@ -164,6 +201,11 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
164
201
|
'optional': true,
|
|
165
202
|
'array': false,
|
|
166
203
|
},
|
|
204
|
+
'exclude_references': {
|
|
205
|
+
'type': 'boolean',
|
|
206
|
+
'optional': true,
|
|
207
|
+
'array': false,
|
|
208
|
+
},
|
|
167
209
|
'compiler_needs': {
|
|
168
210
|
'type': 'CompilerNeeds',
|
|
169
211
|
'optional': true,
|
|
@@ -213,7 +255,12 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
213
255
|
},
|
|
214
256
|
'query': {
|
|
215
257
|
'type': 'Query',
|
|
216
|
-
'optional':
|
|
258
|
+
'optional': true,
|
|
259
|
+
'array': false,
|
|
260
|
+
},
|
|
261
|
+
'query_malloy': {
|
|
262
|
+
'type': 'string',
|
|
263
|
+
'optional': true,
|
|
217
264
|
'array': false,
|
|
218
265
|
},
|
|
219
266
|
'default_row_limit': {
|
|
@@ -221,6 +268,11 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
221
268
|
'optional': true,
|
|
222
269
|
'array': false,
|
|
223
270
|
},
|
|
271
|
+
'exclude_references': {
|
|
272
|
+
'type': 'boolean',
|
|
273
|
+
'optional': true,
|
|
274
|
+
'array': false,
|
|
275
|
+
},
|
|
224
276
|
'compiler_needs': {
|
|
225
277
|
'type': 'CompilerNeeds',
|
|
226
278
|
'optional': true,
|
|
@@ -283,6 +335,11 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
283
335
|
'optional': true,
|
|
284
336
|
'array': false,
|
|
285
337
|
},
|
|
338
|
+
'exclude_references': {
|
|
339
|
+
'type': 'boolean',
|
|
340
|
+
'optional': true,
|
|
341
|
+
'array': false,
|
|
342
|
+
},
|
|
286
343
|
'compiler_needs': {
|
|
287
344
|
'type': 'CompilerNeeds',
|
|
288
345
|
'optional': true,
|
|
@@ -497,6 +554,7 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
497
554
|
'time_truncation': 'TimeTruncationFieldReference',
|
|
498
555
|
'filtered_field': 'FilteredField',
|
|
499
556
|
'literal_value': 'LiteralValueExpression',
|
|
557
|
+
'moving_average': 'MovingAverage',
|
|
500
558
|
},
|
|
501
559
|
},
|
|
502
560
|
'Field': {
|
|
@@ -523,6 +581,7 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
523
581
|
'measure': 'MeasureInfo',
|
|
524
582
|
'join': 'JoinInfo',
|
|
525
583
|
'view': 'ViewInfo',
|
|
584
|
+
'calculate': 'CalculateInfo',
|
|
526
585
|
},
|
|
527
586
|
},
|
|
528
587
|
'File': {
|
|
@@ -841,6 +900,32 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
841
900
|
},
|
|
842
901
|
},
|
|
843
902
|
},
|
|
903
|
+
'MovingAverage': {
|
|
904
|
+
'type': 'struct',
|
|
905
|
+
'name': 'MovingAverage',
|
|
906
|
+
'fields': {
|
|
907
|
+
'field_reference': {
|
|
908
|
+
'type': 'Reference',
|
|
909
|
+
'optional': false,
|
|
910
|
+
'array': false,
|
|
911
|
+
},
|
|
912
|
+
'rows_preceding': {
|
|
913
|
+
'type': 'number',
|
|
914
|
+
'optional': true,
|
|
915
|
+
'array': false,
|
|
916
|
+
},
|
|
917
|
+
'rows_following': {
|
|
918
|
+
'type': 'number',
|
|
919
|
+
'optional': true,
|
|
920
|
+
'array': false,
|
|
921
|
+
},
|
|
922
|
+
'partition_fields': {
|
|
923
|
+
'type': 'Reference',
|
|
924
|
+
'array': true,
|
|
925
|
+
'optional': true,
|
|
926
|
+
},
|
|
927
|
+
},
|
|
928
|
+
},
|
|
844
929
|
'Nest': {
|
|
845
930
|
'type': 'struct',
|
|
846
931
|
'name': 'Nest',
|
|
@@ -1230,6 +1315,11 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
1230
1315
|
'optional': false,
|
|
1231
1316
|
'array': false,
|
|
1232
1317
|
},
|
|
1318
|
+
'exclude_references': {
|
|
1319
|
+
'type': 'boolean',
|
|
1320
|
+
'optional': true,
|
|
1321
|
+
'array': false,
|
|
1322
|
+
},
|
|
1233
1323
|
'compiler_needs': {
|
|
1234
1324
|
'type': 'CompilerNeeds',
|
|
1235
1325
|
'optional': true,
|
|
@@ -1269,7 +1359,12 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
1269
1359
|
},
|
|
1270
1360
|
'query': {
|
|
1271
1361
|
'type': 'Query',
|
|
1272
|
-
'optional':
|
|
1362
|
+
'optional': true,
|
|
1363
|
+
'array': false,
|
|
1364
|
+
},
|
|
1365
|
+
'query_malloy': {
|
|
1366
|
+
'type': 'string',
|
|
1367
|
+
'optional': true,
|
|
1273
1368
|
'array': false,
|
|
1274
1369
|
},
|
|
1275
1370
|
'default_row_limit': {
|
|
@@ -1277,6 +1372,11 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
1277
1372
|
'optional': true,
|
|
1278
1373
|
'array': false,
|
|
1279
1374
|
},
|
|
1375
|
+
'exclude_references': {
|
|
1376
|
+
'type': 'boolean',
|
|
1377
|
+
'optional': true,
|
|
1378
|
+
'array': false,
|
|
1379
|
+
},
|
|
1280
1380
|
'compiler_needs': {
|
|
1281
1381
|
'type': 'CompilerNeeds',
|
|
1282
1382
|
'optional': true,
|
|
@@ -1633,6 +1733,7 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
1633
1733
|
'nest': 'Nest',
|
|
1634
1734
|
'having': 'FilterOperation',
|
|
1635
1735
|
'drill': 'DrillOperation',
|
|
1736
|
+
'calculate': 'CalculateOperation',
|
|
1636
1737
|
},
|
|
1637
1738
|
},
|
|
1638
1739
|
'ViewRefinement': {
|
package/package.json
CHANGED
package/thrift/malloy.thrift
CHANGED
|
@@ -95,6 +95,7 @@ union FieldInfo {
|
|
|
95
95
|
2: required MeasureInfo measure,
|
|
96
96
|
3: required JoinInfo join,
|
|
97
97
|
4: required ViewInfo view,
|
|
98
|
+
5: required CalculateInfo calculate,
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
// TODO should these just be "AtomicField" with a "fieldtype"
|
|
@@ -140,6 +141,12 @@ struct ViewInfo {
|
|
|
140
141
|
// Possibly need `filterList` depending on how we do drills
|
|
141
142
|
}
|
|
142
143
|
|
|
144
|
+
struct CalculateInfo {
|
|
145
|
+
1: required string name,
|
|
146
|
+
2: required AtomicType type,
|
|
147
|
+
3: optional list<Annotation> annotations,
|
|
148
|
+
}
|
|
149
|
+
|
|
143
150
|
struct View {
|
|
144
151
|
2: required ViewDefinition definition,
|
|
145
152
|
3: optional list<Annotation> annotations,
|
|
@@ -265,6 +272,7 @@ union ViewOperation {
|
|
|
265
272
|
6: required Nest nest,
|
|
266
273
|
7: required FilterOperation having,
|
|
267
274
|
8: required DrillOperation drill,
|
|
275
|
+
9: required CalculateOperation calculate,
|
|
268
276
|
}
|
|
269
277
|
|
|
270
278
|
struct GroupBy {
|
|
@@ -310,6 +318,11 @@ struct DrillOperation {
|
|
|
310
318
|
1: required Filter filter,
|
|
311
319
|
}
|
|
312
320
|
|
|
321
|
+
struct CalculateOperation {
|
|
322
|
+
1: required string name,
|
|
323
|
+
2: required Field field,
|
|
324
|
+
}
|
|
325
|
+
|
|
313
326
|
union Filter {
|
|
314
327
|
1: required FilterStringApplication filter_string,
|
|
315
328
|
2: required LiteralEqualityComparison literal_equality,
|
|
@@ -452,6 +465,7 @@ union Expression {
|
|
|
452
465
|
2: required TimeTruncationFieldReference time_truncation,
|
|
453
466
|
3: required FilteredField filtered_field,
|
|
454
467
|
4: required LiteralValueExpression literal_value,
|
|
468
|
+
5: required MovingAverage moving_average
|
|
455
469
|
}
|
|
456
470
|
|
|
457
471
|
struct TimeTruncationFieldReference {
|
|
@@ -464,6 +478,13 @@ struct FilteredField {
|
|
|
464
478
|
2: required list<FilterOperation> where,
|
|
465
479
|
}
|
|
466
480
|
|
|
481
|
+
struct MovingAverage {
|
|
482
|
+
1: required Reference field_reference,
|
|
483
|
+
2: optional i32 rows_preceding,
|
|
484
|
+
3: optional i32 rows_following,
|
|
485
|
+
4: optional list<Reference> partition_fields,
|
|
486
|
+
}
|
|
487
|
+
|
|
467
488
|
struct StringCell {
|
|
468
489
|
1: required string string_value,
|
|
469
490
|
}
|
|
@@ -645,9 +666,14 @@ struct TimingInfo {
|
|
|
645
666
|
// Given the URL to a model, return the StableModelDef for that model
|
|
646
667
|
|
|
647
668
|
struct CompileModelRequest {
|
|
669
|
+
// Main parameters
|
|
648
670
|
1: required string model_url,
|
|
649
671
|
2: optional string extend_model_url,
|
|
650
672
|
|
|
673
|
+
// Options
|
|
674
|
+
4: optional bool exclude_references,
|
|
675
|
+
|
|
676
|
+
// Response to compiler needs
|
|
651
677
|
9: optional CompilerNeeds compiler_needs,
|
|
652
678
|
}
|
|
653
679
|
|
|
@@ -663,10 +689,15 @@ struct CompileModelResponse {
|
|
|
663
689
|
// Given the URL to a model and a name of a queryable thing, get a StableSourceDef
|
|
664
690
|
|
|
665
691
|
struct CompileSourceRequest {
|
|
692
|
+
// Main parameters
|
|
666
693
|
1: required string model_url,
|
|
667
694
|
2: required string name,
|
|
668
695
|
3: optional string extend_model_url,
|
|
669
696
|
|
|
697
|
+
// Options
|
|
698
|
+
4: optional bool exclude_references,
|
|
699
|
+
|
|
700
|
+
// Response to compiler needs
|
|
670
701
|
9: optional CompilerNeeds compiler_needs,
|
|
671
702
|
}
|
|
672
703
|
|
|
@@ -681,10 +712,16 @@ struct CompileSourceResponse {
|
|
|
681
712
|
// Given a StableQueryDef and the URL to a model, run it and return a StableResult
|
|
682
713
|
|
|
683
714
|
struct RunQueryRequest {
|
|
715
|
+
// Main parameters
|
|
684
716
|
1: required string model_url,
|
|
685
|
-
2:
|
|
717
|
+
2: optional Query query,
|
|
718
|
+
5: optional string query_malloy,
|
|
719
|
+
|
|
720
|
+
// Options
|
|
686
721
|
3: optional i32 default_row_limit,
|
|
722
|
+
4: optional bool exclude_references,
|
|
687
723
|
|
|
724
|
+
// Response to compiler needs
|
|
688
725
|
9: optional CompilerNeeds compiler_needs,
|
|
689
726
|
}
|
|
690
727
|
|
|
@@ -700,10 +737,16 @@ struct RunQueryResponse {
|
|
|
700
737
|
// Given a StableQueryDef and the URL to a model, compile it and return a StableResultDef
|
|
701
738
|
|
|
702
739
|
struct CompileQueryRequest {
|
|
740
|
+
// Main parameters
|
|
703
741
|
1: required string model_url,
|
|
704
|
-
2:
|
|
742
|
+
2: optional Query query,
|
|
743
|
+
5: optional string query_malloy,
|
|
744
|
+
|
|
745
|
+
// Options
|
|
705
746
|
3: optional i32 default_row_limit,
|
|
747
|
+
4: optional bool exclude_references,
|
|
706
748
|
|
|
749
|
+
// Response to compiler needs
|
|
707
750
|
9: optional CompilerNeeds compiler_needs,
|
|
708
751
|
}
|
|
709
752
|
|
|
@@ -720,9 +763,14 @@ struct CompileQueryResponse {
|
|
|
720
763
|
// Given a URL to a model and the name of a source, run the indexing query
|
|
721
764
|
|
|
722
765
|
struct RunIndexQueryRequest {
|
|
766
|
+
// Main parameters
|
|
723
767
|
1: required string model_url,
|
|
724
768
|
2: required string source_name,
|
|
725
769
|
|
|
770
|
+
// Options
|
|
771
|
+
4: optional bool exclude_references,
|
|
772
|
+
|
|
773
|
+
// Response to compiler needs
|
|
726
774
|
9: optional CompilerNeeds compiler_needs,
|
|
727
775
|
}
|
|
728
776
|
|