@malloydata/malloy 0.0.123-dev240205152128 → 0.0.123-dev240205203117

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,7 +87,8 @@ 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.slice(1).every(p => joinPathEq(p, joinUsage[0]));
90
+ (joinUsage.length > 1 &&
91
+ joinUsage.slice(1).every(p => joinPathEq(p, joinUsage[0])));
91
92
  if (allUsagesSame) {
92
93
  structPath = joinUsage[0].map(p => p.name);
93
94
  sourceRelationship = joinUsage[0];
@@ -227,7 +228,6 @@ function getJoinUsage(fs, expr) {
227
228
  };
228
229
  (0, utils_1.exprWalk)(expr, frag => {
229
230
  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,6 +240,15 @@ 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
+ }
243
252
  }
244
253
  });
245
254
  return result;
@@ -16,4 +16,5 @@ export declare class QOpDescView extends View {
16
16
  pipelineComp(fs: FieldSpace, isNestIn?: QueryOperationSpace): PipelineComp;
17
17
  private getOp;
18
18
  refine(inputFS: FieldSpace, _pipeline: PipeSegment[], isNestIn: QueryOperationSpace | undefined): PipeSegment[];
19
+ getImplicitName(): string | undefined;
19
20
  }
@@ -93,6 +93,9 @@ class QOpDescView extends view_1.View {
93
93
  }
94
94
  return pipeline;
95
95
  }
96
+ getImplicitName() {
97
+ return undefined;
98
+ }
96
99
  }
97
100
  exports.QOpDescView = QOpDescView;
98
101
  //# sourceMappingURL=qop-desc-view.js.map
@@ -24,4 +24,5 @@ export declare class ReferenceView extends View {
24
24
  };
25
25
  private getRefinementSegment;
26
26
  refine(inputFS: FieldSpace, pipeline: PipeSegment[], _isNestIn: QueryOperationSpace | undefined): PipeSegment[];
27
+ getImplicitName(): string | undefined;
27
28
  }
@@ -142,6 +142,9 @@ class ReferenceView extends view_1.View {
142
142
  // TODO better error pipeline
143
143
  return pipeline;
144
144
  }
145
+ getImplicitName() {
146
+ return this.reference.nameString;
147
+ }
145
148
  }
146
149
  exports.ReferenceView = ReferenceView;
147
150
  //# sourceMappingURL=reference-view.js.map
@@ -16,4 +16,5 @@ export declare class ViewArrow extends View {
16
16
  constructor(base: View, operation: View);
17
17
  pipelineComp(fs: FieldSpace): PipelineComp;
18
18
  refine(_inputFS: FieldSpace, _pipeline: PipeSegment[], _isNestIn: QueryOperationSpace | undefined): PipeSegment[];
19
+ getImplicitName(): string | undefined;
19
20
  }
@@ -51,6 +51,9 @@ class ViewArrow extends view_1.View {
51
51
  this.log('A multi-segment view cannot be used as a refinement');
52
52
  return [];
53
53
  }
54
+ getImplicitName() {
55
+ return this.operation.getImplicitName();
56
+ }
54
57
  }
55
58
  exports.ViewArrow = ViewArrow;
56
59
  //# sourceMappingURL=view-arrow.js.map
@@ -16,4 +16,5 @@ export declare class ViewRefine extends View {
16
16
  constructor(base: View, refinement: View);
17
17
  pipelineComp(fs: FieldSpace, isNestIn?: QueryOperationSpace): PipelineComp;
18
18
  refine(inputFS: FieldSpace, pipeline: PipeSegment[], isNestIn: QueryOperationSpace | undefined): PipeSegment[];
19
+ getImplicitName(): string | undefined;
19
20
  }
@@ -60,6 +60,9 @@ class ViewRefine extends view_1.View {
60
60
  }
61
61
  return (0, refine_utils_1.refine)(this, pipeline, refineFrom[0]);
62
62
  }
63
+ getImplicitName() {
64
+ return this.base.getImplicitName();
65
+ }
63
66
  }
64
67
  exports.ViewRefine = ViewRefine;
65
68
  //# sourceMappingURL=view-refine.js.map
@@ -22,4 +22,5 @@ export declare abstract class View extends MalloyElement {
22
22
  abstract pipelineComp(fs: FieldSpace, isNestIn?: QueryOperationSpace): PipelineComp;
23
23
  pipeline(fs: FieldSpace, isNestIn?: QueryOperationSpace): PipeSegment[];
24
24
  abstract refine(inputFS: FieldSpace, pipeline: PipeSegment[], isNestIn: QueryOperationSpace | undefined): PipeSegment[];
25
+ abstract getImplicitName(): string | undefined;
25
26
  }
@@ -1532,21 +1532,11 @@ export declare class NestEntryContext extends ParserRuleContext {
1532
1532
  get ruleIndex(): number;
1533
1533
  copyFrom(ctx: NestEntryContext): void;
1534
1534
  }
1535
- export declare class NestExistingContext extends NestEntryContext {
1536
- tags(): TagsContext;
1537
- fieldPath(): FieldPathContext;
1538
- PLUS(): TerminalNode | undefined;
1539
- vExpr(): VExprContext | undefined;
1540
- constructor(ctx: NestEntryContext);
1541
- enterRule(listener: MalloyParserListener): void;
1542
- exitRule(listener: MalloyParserListener): void;
1543
- accept<Result>(visitor: MalloyParserVisitor<Result>): Result;
1544
- }
1545
1535
  export declare class NestDefContext extends NestEntryContext {
1546
1536
  tags(): TagsContext;
1547
- queryName(): QueryNameContext;
1548
- isDefine(): IsDefineContext;
1549
1537
  vExpr(): VExprContext;
1538
+ queryName(): QueryNameContext | undefined;
1539
+ isDefine(): IsDefineContext | undefined;
1550
1540
  constructor(ctx: NestEntryContext);
1551
1541
  enterRule(listener: MalloyParserListener): void;
1552
1542
  exitRule(listener: MalloyParserListener): void;