Skip to content

Commit

Permalink
more code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mtoy-googly-moogly committed Oct 2, 2024
1 parent 2fabfb2 commit 75609e3
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions packages/malloy/src/lang/ast/query-elements/query-arrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class QueryArrow extends QueryBase implements QueryElement {
// the view as the head, or the scalar as the head (if scalar lenses is enabled)
const invoked = isRefOk
? this.source.structRef(undefined)
: {structRef: this.source.getStructDef(undefined)};
: {structRef: this.source.getSourceDef(undefined)};
queryBase = {
type: 'query',
...invoked,
Expand All @@ -63,7 +63,7 @@ export class QueryArrow extends QueryBase implements QueryElement {
};
inputStruct = refIsStructDef(invoked.structRef)
? invoked.structRef
: this.source.getStructDef(undefined);
: this.source.getSourceDef(undefined);
fieldSpace = new StaticSpace(inputStruct);
} else {
// We are adding a second stage to the given "source" query; we get the query and add a segment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ export class QueryHeadStruct extends Source {
return {structRef: this.fromRef};
}

getStructDef(parameterSpace: ParameterSpace | undefined): SourceDef {
getSourceDef(parameterSpace: ParameterSpace | undefined): SourceDef {
if (refIsStructDef(this.fromRef)) {
return this.fromRef;
}
const ns = new NamedSource(this.fromRef, this.sourceArguments, undefined);
this.has({exploreReference: ns});
return ns.getStructDef(parameterSpace);
return ns.getSourceDef(parameterSpace);
}
}
4 changes: 2 additions & 2 deletions packages/malloy/src/lang/ast/query-elements/query-raw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export class QueryRaw extends MalloyElement implements QueryElement {
queryComp(isRefOk: boolean): QueryComp {
const invoked = isRefOk
? this.source.structRef(undefined)
: {structRef: this.source.getStructDef(undefined)};
: {structRef: this.source.getSourceDef(undefined)};
const structDef = refIsStructDef(invoked.structRef)
? invoked.structRef
: this.source.getStructDef(undefined);
: this.source.getSourceDef(undefined);
return {
query: {
type: 'query',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class QueryReference extends MalloyElement implements QueryElement {
query.sourceArguments
);
this.has({queryHead: queryHead});
const inputStruct = queryHead.getStructDef(undefined);
const inputStruct = queryHead.getSourceDef(undefined);
const outputStruct = getFinalStruct(this, inputStruct, query.pipeline);
const unRefedQuery = isRefOk
? query
Expand Down
4 changes: 2 additions & 2 deletions packages/malloy/src/lang/ast/source-elements/named-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class NamedSource extends Source {
// If we are not exporting the referenced structdef, don't use the reference
if (modelEnt && !modelEnt.exported) {
return {
structRef: this.getStructDef(parameterSpace),
structRef: this.getSourceDef(parameterSpace),
};
}
return {
Expand Down Expand Up @@ -219,7 +219,7 @@ export class NamedSource extends Source {
return outArguments;
}

getStructDef(parameterSpace: ParameterSpace | undefined): SourceDef {
getSourceDef(parameterSpace: ParameterSpace | undefined): SourceDef {
return this.withParameters(parameterSpace, []);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class QuerySource extends Source {
super({query});
}

getStructDef(parameterSpace: ParameterSpace | undefined): SourceDef {
getSourceDef(parameterSpace: ParameterSpace | undefined): SourceDef {
return this.withParameters(parameterSpace, undefined);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class RefinedSource extends Source {
super({source, refinement});
}

getStructDef(parameterSpace: ParameterSpace | undefined): SourceDef {
getSourceDef(parameterSpace: ParameterSpace | undefined): SourceDef {
return this.withParameters(parameterSpace, []);
}

Expand Down Expand Up @@ -111,7 +111,7 @@ export class RefinedSource extends Source {
}

const paramSpace = pList ? new ParameterSpace(pList) : undefined;
const from = structuredClone(this.source.getStructDef(paramSpace));
const from = structuredClone(this.source.getSourceDef(paramSpace));
// Note that this is explicitly not:
// const from = structuredClone(this.source.withParameters(parameterSpace, pList));
// Because the parameters are added to the resulting struct, not the base struct
Expand Down
6 changes: 3 additions & 3 deletions packages/malloy/src/lang/ast/source-elements/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ import {ParameterSpace} from '../field-space/parameter-space';
* function of a source is to represent an eventual StructDef
*/
export abstract class Source extends MalloyElement {
abstract getStructDef(parameterSpace: ParameterSpace | undefined): SourceDef;
abstract getSourceDef(parameterSpace: ParameterSpace | undefined): SourceDef;

structRef(parameterSpace: ParameterSpace | undefined): InvokedStructRef {
return {
structRef: this.getStructDef(parameterSpace),
structRef: this.getSourceDef(parameterSpace),
};
}

Expand All @@ -60,7 +60,7 @@ export abstract class Source extends MalloyElement {
parameterSpace: ParameterSpace | undefined,
pList: HasParameter[] | undefined
): StructDef {
const before = this.getStructDef(parameterSpace);
const before = this.getSourceDef(parameterSpace);
return {
...before,
parameters: this.packParameters(pList),
Expand Down
4 changes: 2 additions & 2 deletions packages/malloy/src/lang/ast/source-elements/sql-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class SQLSource extends Source {

structRef(): InvokedStructRef {
return {
structRef: this.getStructDef(),
structRef: this.getSourceDef(),
};
}

Expand Down Expand Up @@ -109,7 +109,7 @@ export class SQLSource extends Source {
}
}

getStructDef(): SourceDef {
getSourceDef(): SourceDef {
if (!this.validateConnectionName()) {
return ErrorFactory.structDef;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type TableInfo = {tablePath: string; connectionName?: string | undefined};
export abstract class TableSource extends Source {
abstract getTableInfo(): TableInfo | undefined;

getStructDef(): SourceDef {
getSourceDef(): SourceDef {
const info = this.getTableInfo();
if (info === undefined) {
return ErrorFactory.structDef;
Expand Down
4 changes: 2 additions & 2 deletions packages/malloy/src/lang/ast/source-properties/join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export abstract class Join
);
return ErrorFactory.structDef;
}
return source.getStructDef(parameterSpace);
return source.getSourceDef(parameterSpace);
}
}

Expand Down Expand Up @@ -198,7 +198,7 @@ export class ExpressionJoin extends Join {
);
return ErrorFactory.joinDef;
}
const sourceDef = source.getStructDef(parameterSpace);
const sourceDef = source.getSourceDef(parameterSpace);
let matrixOperation: MatrixOperation = 'left';
if (this.inExperiment('join_types', true)) {
matrixOperation = this.matrixOperation;
Expand Down

0 comments on commit 75609e3

Please sign in to comment.