@malloydata/malloy 0.0.123-dev240207191052 → 0.0.123-dev240208155844

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.
@@ -193,6 +193,11 @@ class ExprFunc extends expression_def_1.ExpressionDef {
193
193
  else {
194
194
  if ((props === null || props === void 0 ? void 0 : props.orderBys) && props.orderBys.length > 0) {
195
195
  const isAnalytic = (0, malloy_types_1.expressionIsAnalytic)(overload.returnType.expressionType);
196
+ if (!isAnalytic) {
197
+ if (!this.inExperiment('aggregate_order_by', true)) {
198
+ props.orderBys[0].log('Enable experiment `aggregate_order_by` to use `order_by` with an aggregate function');
199
+ }
200
+ }
196
201
  if (dialectOverload.supportsOrderBy || isAnalytic) {
197
202
  const allowExpression = dialectOverload.supportsOrderBy !== 'only_default';
198
203
  const allObs = props.orderBys.flatMap(orderBy => isAnalytic
@@ -201,7 +206,7 @@ class ExprFunc extends expression_def_1.ExpressionDef {
201
206
  frag.orderBy = allObs;
202
207
  }
203
208
  else {
204
- props.orderBys[0].log(`Function ${this.name} does not support order_by`);
209
+ props.orderBys[0].log(`Function \`${this.name}\` does not support \`order_by\``);
205
210
  }
206
211
  }
207
212
  if ((props === null || props === void 0 ? void 0 : props.limit) !== undefined) {
@@ -700,7 +700,6 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
700
700
  return this.astAt(new ast.FunctionOrderBy(f, dir), pcx);
701
701
  }
702
702
  visitAggregateOrderByStatement(pcx) {
703
- this.inExperiment('function_order_by', pcx);
704
703
  return this.visitAggregateOrdering(pcx.aggregateOrdering());
705
704
  }
706
705
  visitAggregateOrdering(pcx) {
@@ -1124,7 +1123,6 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
1124
1123
  return new ast.ExprProps(this.getFieldExpr(pcx.fieldExpr()), statements);
1125
1124
  }
1126
1125
  visitPartitionByStatement(pcx) {
1127
- this.inExperiment('partition_by', pcx);
1128
1126
  return this.astAt(new ast.PartitionBy(pcx
1129
1127
  .id()
1130
1128
  .map(idCx => this.astAt(new ast.PartitionByFieldReference([
@@ -163,30 +163,43 @@ describe('expressions', () => {
163
163
  `).translationToFailWith('Filtered expression requires an aggregate computation');
164
164
  });
165
165
  describe('expr props', () => {
166
- test('props not allowed without experiments enabled', () => {
166
+ test('aggregate order by not allowed without experiments enabled', () => {
167
167
  expect((0, test_translator_1.markSource) `
168
168
  run: a -> {
169
169
  group_by: ai
170
- group_by: x1 is string_agg(astr) { order_by: ai }
171
- group_by: x2 is lag(ai) { partition_by: ai }
172
- group_by: x3 is string_agg(astr) { limit: 10 }
170
+ aggregate: x1 is string_agg(astr) { order_by: ai }
171
+ }
172
+ `).translationToFailWith('Enable experiment `aggregate_order_by` to use `order_by` with an aggregate function');
173
+ });
174
+ test('aggregate limit not allowed without experiments enabled', () => {
175
+ expect((0, test_translator_1.markSource) `
176
+ run: a -> {
177
+ group_by: ai
178
+ aggregate: x3 is string_agg(astr) { limit: 10 }
179
+ }
180
+ `).translationToFailWith("Experimental flag 'aggregate_limit' required to enable this feature");
181
+ });
182
+ test('aggregate order_by not allowed with different experiment enabled', () => {
183
+ expect((0, test_translator_1.markSource) `
184
+ ##! experimental.something_else
185
+ run: a -> {
186
+ group_by: ai
187
+ aggregate: x1 is string_agg(astr) { order_by: ai }
173
188
  }
174
- `).translationToFailWith("Experimental flag 'function_order_by' required to enable this feature", "Experimental flag 'partition_by' required to enable this feature", "Experimental flag 'aggregate_limit' required to enable this feature");
189
+ `).translationToFailWith('Enable experiment `aggregate_order_by` to use `order_by` with an aggregate function');
175
190
  });
176
- test('props not allowed with different experiment enabled', () => {
191
+ test('aggregate limit not allowed with different experiment enabled', () => {
177
192
  expect((0, test_translator_1.markSource) `
178
193
  ##! experimental.something_else
179
194
  run: a -> {
180
195
  group_by: ai
181
- group_by: x1 is string_agg(astr) { order_by: ai }
182
- group_by: x2 is lag(ai) { partition_by: ai }
183
196
  group_by: x3 is string_agg(astr) { limit: 10 }
184
197
  }
185
- `).translationToFailWith("Experimental flag 'function_order_by' required to enable this feature", "Experimental flag 'partition_by' required to enable this feature", "Experimental flag 'aggregate_limit' required to enable this feature");
198
+ `).translationToFailWith("Experimental flag 'aggregate_limit' required to enable this feature");
186
199
  });
187
200
  test('props not allowed on most expressions', () => {
188
201
  expect((0, test_translator_1.markSource) `
189
- ##! experimental { function_order_by partition_by aggregate_limit }
202
+ ##! experimental { aggregate_order_by aggregate_limit }
190
203
  run: a -> {
191
204
  group_by: x1 is 1 { order_by: ai }
192
205
  group_by: x2 is 1 { partition_by: ai }
@@ -197,7 +210,6 @@ describe('expressions', () => {
197
210
  });
198
211
  test('analytics can take parititon_by and order_by', () => {
199
212
  expect((0, test_translator_1.markSource) `
200
- ##! experimental { function_order_by partition_by }
201
213
  run: a -> {
202
214
  group_by: ai
203
215
  calculate: x is lag(ai) { partition_by: ai; order_by: ai }
@@ -206,7 +218,7 @@ describe('expressions', () => {
206
218
  });
207
219
  test('analytics order_by requires expression', () => {
208
220
  expect((0, test_translator_1.markSource) `
209
- ##! experimental { function_order_by }
221
+ ##! experimental { aggregate_order_by }
210
222
  run: a -> {
211
223
  group_by: ai
212
224
  calculate: x is lag(ai) { order_by: asc }
@@ -215,7 +227,7 @@ describe('expressions', () => {
215
227
  });
216
228
  test('string_agg_distinct order by cannot specify expression', () => {
217
229
  expect((0, test_translator_1.markSource) `
218
- ##! experimental { function_order_by }
230
+ ##! experimental { aggregate_order_by }
219
231
  run: a -> {
220
232
  group_by: ai
221
233
  aggregate: x is string_agg_distinct(astr) { order_by: ai }
@@ -224,7 +236,7 @@ describe('expressions', () => {
224
236
  });
225
237
  test('string_agg_distinct order by can be just direction', () => {
226
238
  expect((0, test_translator_1.markSource) `
227
- ##! experimental { function_order_by }
239
+ ##! experimental { aggregate_order_by }
228
240
  run: a -> {
229
241
  group_by: ai
230
242
  aggregate: x is string_agg_distinct(astr) { order_by: asc }
@@ -233,7 +245,7 @@ describe('expressions', () => {
233
245
  });
234
246
  test('string_agg order by can be just direction', () => {
235
247
  expect((0, test_translator_1.markSource) `
236
- ##! experimental { function_order_by }
248
+ ##! experimental { aggregate_order_by }
237
249
  run: a -> {
238
250
  group_by: ai
239
251
  aggregate: x is string_agg(astr) { order_by: asc }
@@ -242,7 +254,6 @@ describe('expressions', () => {
242
254
  });
243
255
  test('can specify multiple partition_bys', () => {
244
256
  expect((0, test_translator_1.markSource) `
245
- ##! experimental { partition_by }
246
257
  run: a -> {
247
258
  group_by: ai, astr, abool
248
259
  calculate: x is lag(ai) {
@@ -254,7 +265,7 @@ describe('expressions', () => {
254
265
  });
255
266
  test('can specify multiple order_bys', () => {
256
267
  expect((0, test_translator_1.markSource) `
257
- ##! experimental { function_order_by }
268
+ ##! experimental { aggregate_order_by }
258
269
  run: a -> {
259
270
  group_by: ai, astr, abool
260
271
  calculate: x is lag(ai) {
@@ -266,7 +277,7 @@ describe('expressions', () => {
266
277
  });
267
278
  test('aggregate order by cannot be aggregate', () => {
268
279
  expect((0, test_translator_1.markSource) `
269
- ##! experimental { function_order_by }
280
+ ##! experimental { aggregate_order_by }
270
281
  run: a -> {
271
282
  aggregate: x is string_agg(astr) {
272
283
  order_by: sum(ai)
@@ -276,7 +287,7 @@ describe('expressions', () => {
276
287
  });
277
288
  test('aggregate order by cannot be analytic', () => {
278
289
  expect((0, test_translator_1.markSource) `
279
- ##! experimental { function_order_by }
290
+ ##! experimental { aggregate_order_by }
280
291
  run: a -> {
281
292
  aggregate: x is string_agg(astr) {
282
293
  order_by: rank()
@@ -286,7 +297,7 @@ describe('expressions', () => {
286
297
  });
287
298
  test('analytic order by can be an aggregate', () => {
288
299
  expect((0, test_translator_1.markSource) `
289
- ##! experimental { function_order_by }
300
+ ##! experimental { aggregate_order_by }
290
301
  run: a -> {
291
302
  group_by: abool
292
303
  calculate: x is lag(abool) {
@@ -297,7 +308,7 @@ describe('expressions', () => {
297
308
  });
298
309
  test('analytic order by can be an output field', () => {
299
310
  expect((0, test_translator_1.markSource) `
300
- ##! experimental { function_order_by }
311
+ ##! experimental { aggregate_order_by }
301
312
  run: a -> {
302
313
  group_by: ai
303
314
  calculate: x is lag(ai) {
@@ -308,7 +319,7 @@ describe('expressions', () => {
308
319
  });
309
320
  test('analytic order by must be an output field', () => {
310
321
  expect((0, test_translator_1.markSource) `
311
- ##! experimental { function_order_by }
322
+ ##! experimental { aggregate_order_by }
312
323
  run: a -> {
313
324
  group_by: abool
314
325
  calculate: x is lag(abool) {
@@ -319,7 +330,7 @@ describe('expressions', () => {
319
330
  });
320
331
  test('can specify multiple wheres', () => {
321
332
  expect((0, test_translator_1.markSource) `
322
- ##! experimental { function_order_by }
333
+ ##! experimental { aggregate_order_by }
323
334
  run: a -> {
324
335
  aggregate: x is count() {
325
336
  where: ai > 10
@@ -330,7 +341,7 @@ describe('expressions', () => {
330
341
  });
331
342
  test('string_agg can take order_by', () => {
332
343
  expect((0, test_translator_1.markSource) `
333
- ##! experimental { function_order_by }
344
+ ##! experimental { aggregate_order_by }
334
345
  run: a -> {
335
346
  aggregate: x1 is string_agg(astr) { order_by: ai }
336
347
  aggregate: x2 is string_agg(astr) { order_by: ai * 2 }
@@ -69,7 +69,7 @@ export interface InfoConnection {
69
69
  */
70
70
  get name(): string;
71
71
  }
72
- export type ConnectionParameterValue = string | number | boolean;
72
+ export type ConnectionParameterValue = string | number | boolean | Array<ConnectionParameterValue>;
73
73
  export interface ConnectionParameter {
74
74
  name: string;
75
75
  label: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.123-dev240207191052",
3
+ "version": "0.0.123-dev240208155844",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",