@malloydata/malloy 0.0.123-dev240205203117 → 0.0.123-dev240205203120

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.
@@ -87,8 +87,7 @@ class ExprAggregateFunction extends expression_def_1.ExpressionDef {
87
87
  // locality to be that join path
88
88
  const joinUsage = this.getJoinUsage(inputFS);
89
89
  const allUsagesSame = joinUsage.length === 1 ||
90
- (joinUsage.length > 1 &&
91
- joinUsage.slice(1).every(p => joinPathEq(p, joinUsage[0])));
90
+ joinUsage.slice(1).every(p => joinPathEq(p, joinUsage[0]));
92
91
  if (allUsagesSame) {
93
92
  structPath = joinUsage[0].map(p => p.name);
94
93
  sourceRelationship = joinUsage[0];
@@ -228,6 +227,7 @@ function getJoinUsage(fs, expr) {
228
227
  };
229
228
  (0, utils_1.exprWalk)(expr, frag => {
230
229
  if (typeof frag !== 'string') {
230
+ // TODO make this work for field references inside sql_* functions
231
231
  if (frag.type === 'field') {
232
232
  const def = lookup(fs, frag.path);
233
233
  if (def.def.type !== 'struct' && def.def.type !== 'turtle') {
@@ -240,15 +240,6 @@ function getJoinUsage(fs, expr) {
240
240
  }
241
241
  }
242
242
  }
243
- else if (frag.type === 'source-reference') {
244
- if (frag.path) {
245
- const def = lookup(fs, frag.path);
246
- result.push(def.relationship);
247
- }
248
- else {
249
- result.push([]);
250
- }
251
- }
252
243
  }
253
244
  });
254
245
  return result;
@@ -475,18 +475,6 @@ describe('expressions', () => {
475
475
  test('source.sum(nested.column)', () => {
476
476
  expect(modelX `source.sum(nested.column)`).translationToFailWith('Cannot compute `sum` across repeated relationship `nested`; use `nested.column.sum()`');
477
477
  });
478
- test('can aggregate field defined with no join usage', () => {
479
- expect((0, test_translator_1.markSource) `
480
- ##! experimental { sql_functions }
481
- source: s is a extend {
482
- measure: c is count()
483
- dimension: f is 1
484
- }
485
- run: s -> {
486
- aggregate: v is f.sum()
487
- }
488
- `).toTranslate();
489
- });
490
478
  test('sum(inline.column)', () => {
491
479
  expect(modelX `sum(inline.column)`).toTranslateWithWarnings('Join path is required for this calculation; use `inline.column.sum()` or `source.sum(inline.column)` to get a result weighted with respect to `source`');
492
480
  });
@@ -811,11 +799,6 @@ describe('unspported fields in schema', () => {
811
799
  test('negative numbers are not tokens', () => {
812
800
  expect((0, test_translator_1.expr) `ai-1`).toTranslate();
813
801
  });
814
- describe('sql functions', () => {
815
- test('can aggregate a sql_ function', () => {
816
- expect((0, test_translator_1.expr) `sum(sql_number("\${a} * 2"))`).toTranslate();
817
- });
818
- });
819
802
  describe('cast', () => {
820
803
  // The "+ 1"s are there to make sure the result is of type 'number'
821
804
  test('sql cast', () => {
@@ -875,19 +875,5 @@ describe('m3/m4 source query sentences', () => {
875
875
  `).toTranslate();
876
876
  });
877
877
  });
878
- describe('sql_functions', () => {
879
- test('can aggregate sql function', () => {
880
- expect((0, test_translator_1.markSource) `
881
- ##! experimental { sql_functions }
882
- source: s is a extend {
883
- measure: c is count()
884
- dimension: sql_expr is sql_number("LENGTH(\${TABLE}.astr)")
885
- }
886
- run: s -> {
887
- aggregate: v is sql_expr.sum()
888
- }
889
- `).toTranslate();
890
- });
891
- });
892
878
  test('non breaking space in source', () => expect('source:\u00a0z\u00a0is\u00a0a').toParse());
893
879
  //# sourceMappingURL=parse.spec.js.map
@@ -125,9 +125,6 @@ function exprMap(expr, func) {
125
125
  case 'function_parameter':
126
126
  case 'parameter':
127
127
  case 'outputField':
128
- case 'source-reference':
129
- case 'aggregate_limit':
130
- case 'aggregate_order_by':
131
128
  return fragment;
132
129
  case 'sql-string':
133
130
  return {
@@ -234,9 +231,6 @@ function exprWalk(expr, func) {
234
231
  case 'function_parameter':
235
232
  case 'parameter':
236
233
  case 'outputField':
237
- case 'source-reference':
238
- case 'aggregate_limit':
239
- case 'aggregate_order_by':
240
234
  return fragment;
241
235
  case 'function_call':
242
236
  return {
@@ -310,7 +304,7 @@ function exprWalk(expr, func) {
310
304
  }
311
305
  }
312
306
  default:
313
- throw new Error(`unexpected fragment type ${fragment.type}`);
307
+ throw new Error('unexpected');
314
308
  }
315
309
  });
316
310
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.123-dev240205203117",
3
+ "version": "0.0.123-dev240205203120",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",