@malloydata/malloy 0.0.309 → 0.0.311

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Malloy
2
2
 
3
- Malloy is an experimental language for describing data relationships and transformations. It is both a semantic modeling language and a querying language that runs queries against a relational database. Malloy currently connects to BigQuery and Postgres, and natively supports DuckDB. We've built a Visual Studio Code extension to facilitate building Malloy data models, querying and transforming data, and creating simple visualizations and dashboards.
3
+ Malloy is a modern open source language for describing data relationships and transformations. It is both a semantic modeling language and a querying language that runs queries against a relational database. Malloy currently connects to BigQuery and Postgres, and natively supports DuckDB. We've built a Visual Studio Code extension to facilitate building Malloy data models, querying and transforming data, and creating simple visualizations and dashboards.
4
4
 
5
5
  ## Building applications or products in javascript with @malloydata/malloy
6
6
 
@@ -65,6 +65,23 @@ const mysqlToMalloyTypes = {
65
65
  // TODO: Check if we need special handling for boolean.
66
66
  'tinyint(1)': { type: 'boolean' },
67
67
  };
68
+ function malloyTypeToJSONTableType(malloyType) {
69
+ switch (malloyType.type) {
70
+ case 'number':
71
+ return malloyType.numberType === 'integer' ? 'INT' : 'DOUBLE';
72
+ case 'string':
73
+ return 'CHAR(255)'; // JSON_TABLE needs a length
74
+ case 'boolean':
75
+ return 'INT'; // or TINYINT(1) if you prefer
76
+ case 'record':
77
+ case 'array':
78
+ return 'JSON';
79
+ case 'timestamp':
80
+ return 'DATETIME';
81
+ default:
82
+ return malloyType.type.toUpperCase();
83
+ }
84
+ }
68
85
  class MySQLDialect extends dialect_1.Dialect {
69
86
  constructor() {
70
87
  super(...arguments);
@@ -99,14 +116,16 @@ class MySQLDialect extends dialect_1.Dialect {
99
116
  malloyTypeToSQLType(malloyType) {
100
117
  switch (malloyType.type) {
101
118
  case 'number':
102
- return malloyType.numberType === 'integer' ? 'BIGINT' : 'DOUBLE';
119
+ return malloyType.numberType === 'integer' ? 'SIGNED' : 'DOUBLE';
103
120
  case 'string':
104
- return 'TEXT';
121
+ return 'CHAR';
122
+ case 'boolean':
123
+ return 'SIGNED';
105
124
  case 'record':
106
125
  case 'array':
107
126
  return 'JSON';
108
- case 'date':
109
127
  case 'timestamp':
128
+ return 'DATETIME';
110
129
  default:
111
130
  return malloyType.type;
112
131
  }
@@ -177,7 +196,7 @@ class MySQLDialect extends dialect_1.Dialect {
177
196
  var _a;
178
197
  const fields = [];
179
198
  for (const f of fieldList) {
180
- let fType = this.malloyTypeToSQLType(f.typeDef);
199
+ let fType = malloyTypeToJSONTableType(f.typeDef);
181
200
  if (f.typeDef.type === 'sql native' &&
182
201
  f.typeDef.rawType &&
183
202
  ((_a = f.typeDef.rawType) === null || _a === void 0 ? void 0 : _a.match(/json/))) {
@@ -22,17 +22,21 @@ class PostgresBase extends dialect_1.Dialect {
22
22
  // adjusting for monday/sunday weeks
23
23
  const week = df.units === 'week';
24
24
  const truncThis = week ? `${df.e.sql} + INTERVAL '1' DAY` : df.e.sql;
25
+ // Only do timezone conversion for timestamps, not dates
25
26
  if (malloy_types_1.TD.isTimestamp(df.e.typeDef)) {
26
27
  const tz = (0, dialect_1.qtz)(qi);
27
28
  if (tz) {
28
29
  const civilSource = `(${truncThis}::TIMESTAMPTZ AT TIME ZONE '${tz}')`;
29
30
  let civilTrunc = `DATE_TRUNC('${df.units}', ${civilSource})`;
30
- // MTOY todo ... only need to do this if this is a date ...
31
- civilTrunc = `${civilTrunc}::TIMESTAMP`;
31
+ if (week) {
32
+ civilTrunc = `(${civilTrunc} - INTERVAL '1' DAY)`;
33
+ }
34
+ // Convert the truncated civil time back to UTC by treating it as being IN the query timezone
32
35
  const truncTsTz = `${civilTrunc} AT TIME ZONE '${tz}'`;
33
36
  return `(${truncTsTz})::TIMESTAMP`;
34
37
  }
35
38
  }
39
+ // For dates (civil time) or timestamps without query timezone
36
40
  let result = `DATE_TRUNC('${df.units}', ${truncThis})`;
37
41
  if (week) {
38
42
  result = `(${result} - INTERVAL '1' DAY)`;
@@ -193,8 +193,9 @@ class PostgresDialect extends pg_impl_1.PostgresBase {
193
193
  sqlCreateFunction(id, funcText) {
194
194
  return `CREATE FUNCTION ${id}(JSONB) RETURNS JSONB AS $$\n${(0, utils_1.indent)(funcText)}\n$$ LANGUAGE SQL;\n`;
195
195
  }
196
+ //
196
197
  sqlCreateFunctionCombineLastStage(lastStageName) {
197
- return `SELECT JSONB_AGG(__stage0) FROM ${lastStageName}\n`;
198
+ return `SELECT JSONB_AGG(${lastStageName}) FROM ${lastStageName}\n`;
198
199
  }
199
200
  sqlFinalStage(lastStageName, _fields) {
200
201
  return `SELECT row_to_json(finalStage) as row FROM ${lastStageName} AS finalStage`;
@@ -519,7 +519,7 @@ ${(0, utils_1.indent)(sql)}
519
519
  const name = (_a = f.as) !== null && _a !== void 0 ? _a : f.name;
520
520
  rowVals.push((_b = lit.kids[name].sql) !== null && _b !== void 0 ? _b : 'internal-error-record-literal');
521
521
  const elType = this.malloyTypeToSQLType(f);
522
- rowTypes.push(`${name} ${elType}`);
522
+ rowTypes.push(`${this.sqlMaybeQuoteIdentifier(name)} ${elType}`);
523
523
  }
524
524
  }
525
525
  return `CAST(ROW(${rowVals.join(',')}) AS ROW(${rowTypes.join(',')}))`;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { DuckDBDialect, StandardSQLDialect, TrinoDialect, PostgresDialect, SnowflakeDialect, MySQLDialect, registerDialect, arg, qtz, overload, minScalar, anyExprType, minAggregate, maxScalar, sql, makeParam, param, variadicParam, literal, spread, Dialect, TinyParser, } from './dialect';
2
2
  export type { DialectFieldList, DialectFunctionOverloadDef, QueryInfo, MalloyStandardFunctionImplementations, DefinitionBlueprint, DefinitionBlueprintMap, OverloadedDefinitionBlueprint, TinyToken, } from './dialect';
3
- export type { QueryDataRow, StructDef, TableSourceDef, SQLSourceDef, SourceDef, JoinFieldDef, NamedSourceDefs, MalloyQueryData, DateUnit, ExtractUnit, TimestampUnit, TemporalFieldType, QueryData, QueryValue, Expr, FilterCondition, Argument, Parameter, FieldDef, PipeSegment, QueryFieldDef, IndexFieldDef, TurtleDef, SearchValueMapResult, SearchIndexResult, ModelDef, Query, QueryResult, QueryResultDef, QueryRunStats, QueryScalar, NamedQuery, NamedModelObject, ExpressionType, FunctionDef, FunctionOverloadDef, FunctionParameterDef, ExpressionValueType, TypeDesc, FunctionParamTypeDesc, DocumentLocation, DocumentRange, DocumentPosition, Sampling, Annotation, BasicAtomicTypeDef, BasicAtomicDef, AtomicTypeDef, AtomicFieldDef, ArrayDef, ArrayTypeDef, RecordTypeDef, RepeatedRecordTypeDef, RecordDef, RepeatedRecordDef, RecordLiteralNode, StringLiteralNode, ArrayLiteralNode, SourceComponentInfo, } from './model';
4
- export { isSourceDef, isBasicAtomic, isJoined, isJoinedSource, isSamplingEnable, isSamplingPercent, isSamplingRows, isRepeatedRecord, isBasicArray, mkArrayDef, mkFieldDef, expressionIsAggregate, expressionIsAnalytic, expressionIsCalculation, expressionIsScalar, expressionIsUngroupedAggregate, indent, composeSQLExpr, isTimestampUnit, isDateUnit, } from './model';
3
+ export type { QueryDataRow, StructDef, TableSourceDef, SQLSourceDef, SourceDef, JoinFieldDef, NamedSourceDefs, MalloyQueryData, DateUnit, ExtractUnit, TimestampUnit, TemporalFieldType, QueryData, QueryValue, Expr, FilterCondition, Argument, Parameter, FieldDef, PipeSegment, QueryFieldDef, IndexFieldDef, TurtleDef, SearchValueMapResult, SearchIndexResult, ModelDef, Query, QueryResult, QueryResultDef, QueryRunStats, QueryScalar, NamedQuery, NamedModelObject, ExpressionType, FunctionDef, FunctionOverloadDef, FunctionParameterDef, ExpressionValueType, TypeDesc, FunctionParamTypeDesc, DocumentLocation, DocumentRange, DocumentPosition, Sampling, Annotation, BasicAtomicTypeDef, BasicAtomicDef, AtomicTypeDef, AtomicFieldDef, ArrayDef, ArrayTypeDef, RecordTypeDef, RepeatedRecordTypeDef, RecordDef, RepeatedRecordDef, RecordLiteralNode, StringLiteralNode, ArrayLiteralNode, SourceComponentInfo, TimeLiteralNode, TypecastExpr, } from './model';
4
+ export { isSourceDef, isBasicAtomic, isJoined, isJoinedSource, isSamplingEnable, isSamplingPercent, isSamplingRows, isRepeatedRecord, isBasicArray, mkArrayDef, mkFieldDef, expressionIsAggregate, expressionIsAnalytic, expressionIsCalculation, expressionIsScalar, expressionIsUngroupedAggregate, indent, composeSQLExpr, isTimestampUnit, isDateUnit, constantExprToSQL, } from './model';
5
5
  export { malloyToQuery, MalloyTranslator, } from './lang';
6
6
  export type { LogMessage, TranslateResponse } from './lang';
7
7
  export { Model, Malloy, Runtime, AtomicFieldType, ConnectionRuntime, SingleConnectionRuntime, EmptyURLReader, InMemoryURLReader, FixedConnectionMap, MalloyError, JoinRelationship, SourceRelationship, DateTimeframe, TimestampTimeframe, PreparedResult, Result, QueryMaterializer, CSVWriter, JSONWriter, Parse, DataWriter, Explore, InMemoryModelCache, CacheManager, } from './malloy';
package/dist/index.js CHANGED
@@ -33,8 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.SingleConnectionRuntime = exports.ConnectionRuntime = exports.AtomicFieldType = exports.Runtime = exports.Malloy = exports.Model = exports.MalloyTranslator = exports.malloyToQuery = exports.isDateUnit = exports.isTimestampUnit = exports.composeSQLExpr = exports.indent = exports.expressionIsUngroupedAggregate = exports.expressionIsScalar = exports.expressionIsCalculation = exports.expressionIsAnalytic = exports.expressionIsAggregate = exports.mkFieldDef = exports.mkArrayDef = exports.isBasicArray = exports.isRepeatedRecord = exports.isSamplingRows = exports.isSamplingPercent = exports.isSamplingEnable = exports.isJoinedSource = exports.isJoined = exports.isBasicAtomic = exports.isSourceDef = exports.TinyParser = exports.Dialect = exports.spread = exports.literal = exports.variadicParam = exports.param = exports.makeParam = exports.sql = exports.maxScalar = exports.minAggregate = exports.anyExprType = exports.minScalar = exports.overload = exports.qtz = exports.arg = exports.registerDialect = exports.MySQLDialect = exports.SnowflakeDialect = exports.PostgresDialect = exports.TrinoDialect = exports.StandardSQLDialect = exports.DuckDBDialect = void 0;
37
- exports.annotationToTaglines = exports.annotationToTag = exports.sqlKey = exports.API = exports.extractMalloyObjectFromTag = exports.writeMalloyObjectToTag = exports.sourceDefToSourceInfo = exports.modelDefToModelInfo = exports.toAsyncGenerator = exports.CacheManager = exports.InMemoryModelCache = exports.Explore = exports.DataWriter = exports.Parse = exports.JSONWriter = exports.CSVWriter = exports.QueryMaterializer = exports.Result = exports.PreparedResult = exports.TimestampTimeframe = exports.DateTimeframe = exports.SourceRelationship = exports.JoinRelationship = exports.MalloyError = exports.FixedConnectionMap = exports.InMemoryURLReader = exports.EmptyURLReader = void 0;
36
+ exports.ConnectionRuntime = exports.AtomicFieldType = exports.Runtime = exports.Malloy = exports.Model = exports.MalloyTranslator = exports.malloyToQuery = exports.constantExprToSQL = exports.isDateUnit = exports.isTimestampUnit = exports.composeSQLExpr = exports.indent = exports.expressionIsUngroupedAggregate = exports.expressionIsScalar = exports.expressionIsCalculation = exports.expressionIsAnalytic = exports.expressionIsAggregate = exports.mkFieldDef = exports.mkArrayDef = exports.isBasicArray = exports.isRepeatedRecord = exports.isSamplingRows = exports.isSamplingPercent = exports.isSamplingEnable = exports.isJoinedSource = exports.isJoined = exports.isBasicAtomic = exports.isSourceDef = exports.TinyParser = exports.Dialect = exports.spread = exports.literal = exports.variadicParam = exports.param = exports.makeParam = exports.sql = exports.maxScalar = exports.minAggregate = exports.anyExprType = exports.minScalar = exports.overload = exports.qtz = exports.arg = exports.registerDialect = exports.MySQLDialect = exports.SnowflakeDialect = exports.PostgresDialect = exports.TrinoDialect = exports.StandardSQLDialect = exports.DuckDBDialect = void 0;
37
+ exports.annotationToTaglines = exports.annotationToTag = exports.sqlKey = exports.API = exports.extractMalloyObjectFromTag = exports.writeMalloyObjectToTag = exports.sourceDefToSourceInfo = exports.modelDefToModelInfo = exports.toAsyncGenerator = exports.CacheManager = exports.InMemoryModelCache = exports.Explore = exports.DataWriter = exports.Parse = exports.JSONWriter = exports.CSVWriter = exports.QueryMaterializer = exports.Result = exports.PreparedResult = exports.TimestampTimeframe = exports.DateTimeframe = exports.SourceRelationship = exports.JoinRelationship = exports.MalloyError = exports.FixedConnectionMap = exports.InMemoryURLReader = exports.EmptyURLReader = exports.SingleConnectionRuntime = void 0;
38
38
  /*
39
39
  * Copyright 2023 Google LLC
40
40
  *
@@ -102,6 +102,8 @@ Object.defineProperty(exports, "indent", { enumerable: true, get: function () {
102
102
  Object.defineProperty(exports, "composeSQLExpr", { enumerable: true, get: function () { return model_1.composeSQLExpr; } });
103
103
  Object.defineProperty(exports, "isTimestampUnit", { enumerable: true, get: function () { return model_1.isTimestampUnit; } });
104
104
  Object.defineProperty(exports, "isDateUnit", { enumerable: true, get: function () { return model_1.isDateUnit; } });
105
+ // Used in testing, not really public API
106
+ Object.defineProperty(exports, "constantExprToSQL", { enumerable: true, get: function () { return model_1.constantExprToSQL; } });
105
107
  var lang_1 = require("./lang");
106
108
  Object.defineProperty(exports, "malloyToQuery", { enumerable: true, get: function () { return lang_1.malloyToQuery; } });
107
109
  // Needed for tests only
@@ -63,7 +63,7 @@ class RefinedSpace extends dynamic_space_1.DynamicSpace {
63
63
  const renamed = renameMap.get(symbol);
64
64
  if (renamed) {
65
65
  if (value instanceof space_field_1.SpaceField) {
66
- edited.setEntry(renamed.as, new rename_space_field_1.RenameSpaceField(value, renamed.as, renamed.location));
66
+ edited.setEntry(renamed.as, new rename_space_field_1.RenameSpaceField(value, renamed.as, renamed.location, undefined));
67
67
  }
68
68
  else {
69
69
  renamed.logTo.logError('cannot-rename-non-field', `Cannot rename \`${symbol}\` which is not a field`);
@@ -1,10 +1,11 @@
1
- import type { DocumentLocation, FieldDef } from '../../../model/malloy_types';
1
+ import type { Annotation, DocumentLocation, FieldDef } from '../../../model/malloy_types';
2
2
  import { SpaceField } from '../types/space-field';
3
3
  export declare class RenameSpaceField extends SpaceField {
4
4
  private readonly otherField;
5
5
  private readonly newName;
6
6
  private readonly location;
7
- constructor(otherField: SpaceField, newName: string, location: DocumentLocation);
7
+ private note;
8
+ constructor(otherField: SpaceField, newName: string, location: DocumentLocation, note: Annotation | undefined);
8
9
  fieldDef(): FieldDef | undefined;
9
10
  typeDesc(): import("../../../model/malloy_types").TypeDesc;
10
11
  }
@@ -25,19 +25,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.RenameSpaceField = void 0;
26
26
  const space_field_1 = require("../types/space-field");
27
27
  class RenameSpaceField extends space_field_1.SpaceField {
28
- constructor(otherField, newName, location) {
28
+ constructor(otherField, newName, location, note) {
29
29
  super();
30
30
  this.otherField = otherField;
31
31
  this.newName = newName;
32
32
  this.location = location;
33
+ this.note = note;
33
34
  }
34
35
  fieldDef() {
35
- const renamedFieldRaw = this.otherField.fieldDef();
36
- if (renamedFieldRaw === undefined) {
36
+ const returnFieldDef = this.otherField.fieldDef();
37
+ if (returnFieldDef === undefined) {
37
38
  return undefined;
38
39
  }
40
+ if (this.note) {
41
+ if (returnFieldDef.annotation) {
42
+ returnFieldDef.annotation = {
43
+ ...this.note,
44
+ inherits: returnFieldDef.annotation,
45
+ };
46
+ }
47
+ else {
48
+ returnFieldDef.annotation = this.note;
49
+ }
50
+ }
39
51
  return {
40
- ...renamedFieldRaw,
52
+ ...returnFieldDef,
41
53
  as: this.newName,
42
54
  location: this.location,
43
55
  };
@@ -1,17 +1,22 @@
1
- import type { AccessModifierLabel } from '../../../model';
1
+ import type { AccessModifierLabel, Annotation } from '../../../model';
2
2
  import type { DynamicSpace } from '../field-space/dynamic-space';
3
+ import { DefinitionList } from '../types/definition-list';
3
4
  import type { FieldName } from '../types/field-space';
4
- import { ListOf, MalloyElement } from '../types/malloy-element';
5
+ import { MalloyElement } from '../types/malloy-element';
6
+ import { extendNoteMethod, type Noteable } from '../types/noteable';
5
7
  import type { MakeEntry } from '../types/space-entry';
6
- export declare class RenameField extends MalloyElement implements MakeEntry {
8
+ export declare class RenameField extends MalloyElement implements Noteable, MakeEntry {
7
9
  readonly newName: string;
8
10
  readonly oldName: FieldName;
9
11
  elementType: string;
12
+ note?: Annotation;
13
+ extendNote: typeof extendNoteMethod;
14
+ readonly isNoteableObj = true;
10
15
  constructor(newName: string, oldName: FieldName);
11
16
  makeEntry(fs: DynamicSpace): void;
12
17
  getName(): string;
13
18
  }
14
- export declare class Renames extends ListOf<RenameField> {
19
+ export declare class Renames extends DefinitionList<RenameField> {
15
20
  readonly accessModifier: AccessModifierLabel | undefined;
16
21
  elementType: string;
17
22
  constructor(fields: RenameField[], accessModifier: AccessModifierLabel | undefined);
@@ -24,7 +24,9 @@
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.Renames = exports.RenameField = void 0;
26
26
  const rename_space_field_1 = require("../field-space/rename-space-field");
27
+ const definition_list_1 = require("../types/definition-list");
27
28
  const malloy_element_1 = require("../types/malloy-element");
29
+ const noteable_1 = require("../types/noteable");
28
30
  const space_field_1 = require("../types/space-field");
29
31
  class RenameField extends malloy_element_1.MalloyElement {
30
32
  constructor(newName, oldName) {
@@ -32,6 +34,8 @@ class RenameField extends malloy_element_1.MalloyElement {
32
34
  this.newName = newName;
33
35
  this.oldName = oldName;
34
36
  this.elementType = 'renameField';
37
+ this.extendNote = noteable_1.extendNoteMethod;
38
+ this.isNoteableObj = true;
35
39
  this.has({ oldName: oldName });
36
40
  }
37
41
  makeEntry(fs) {
@@ -40,9 +44,19 @@ class RenameField extends malloy_element_1.MalloyElement {
40
44
  return;
41
45
  }
42
46
  const oldValue = this.oldName.getField(fs);
47
+ /*
48
+
49
+ ok need to get the annotation from the old field into the inherits and the annotaiton
50
+ of the curuent field and then
51
+
52
+
53
+
54
+
55
+
56
+ */
43
57
  if (oldValue.found) {
44
58
  if (oldValue.found instanceof space_field_1.SpaceField) {
45
- fs.renameEntry(this.oldName.refString, this.newName, new rename_space_field_1.RenameSpaceField(oldValue.found, this.newName, this.location));
59
+ fs.renameEntry(this.oldName.refString, this.newName, new rename_space_field_1.RenameSpaceField(oldValue.found, this.newName, this.location, this.note));
46
60
  }
47
61
  else {
48
62
  this.logError('failed-rename', `'${this.oldName}' cannot be renamed`);
@@ -57,7 +71,7 @@ class RenameField extends malloy_element_1.MalloyElement {
57
71
  }
58
72
  }
59
73
  exports.RenameField = RenameField;
60
- class Renames extends malloy_element_1.ListOf {
74
+ class Renames extends definition_list_1.DefinitionList {
61
75
  constructor(fields, accessModifier) {
62
76
  super(fields);
63
77
  this.accessModifier = accessModifier;
@@ -39,7 +39,7 @@ sources) {
39
39
  let anyComposites = false;
40
40
  let joinsProcessed = false;
41
41
  const nonCompositeFields = getNonCompositeFields(source);
42
- const expandedForError = onlyCompositeUsage(_expandFieldUsage(fieldUsage, rootFields).result, source.fields);
42
+ const expandedForError = onlyCompositeUsage(expandFieldUsage(fieldUsage, rootFields).result, source.fields);
43
43
  if (source.type === 'composite') {
44
44
  let found = false;
45
45
  anyComposites = true;
@@ -66,7 +66,7 @@ sources) {
66
66
  }
67
67
  const fieldUsageWithWheres = (_b = mergeFieldUsage(getFieldUsageFromFilterList(inputSource), fieldUsage)) !== null && _b !== void 0 ? _b : [];
68
68
  const fieldsForLookup = [...nonCompositeFields, ...inputSource.fields];
69
- const expanded = _expandFieldUsage(fieldUsageWithWheres, fieldsForLookup);
69
+ const expanded = expandFieldUsage(fieldUsageWithWheres, fieldsForLookup);
70
70
  if (expanded.missingFields.length > 0) {
71
71
  // A lookup failed while expanding, which means this source certainly won't work
72
72
  for (const missingField of expanded.missingFields) {
@@ -177,7 +177,7 @@ sources) {
177
177
  }
178
178
  else if (source.partitionComposite !== undefined) {
179
179
  anyComposites = true;
180
- const expanded = _expandFieldUsage(fieldUsage, rootFields).result;
180
+ const expanded = expandFieldUsage(fieldUsage, rootFields).result;
181
181
  // TODO possibly abort if expanded has missing fields...
182
182
  const expandedCategorized = categorizeFieldUsage(expanded);
183
183
  const { partitionFilter, issues } = getPartitionCompositeFilter(source.partitionComposite, expandedCategorized.sourceUsage);
@@ -199,7 +199,7 @@ sources) {
199
199
  };
200
200
  }
201
201
  if (!joinsProcessed) {
202
- const expanded = _expandFieldUsage(fieldUsage, getJoinFields(rootFields, path));
202
+ const expanded = expandFieldUsage(fieldUsage, getJoinFields(rootFields, path));
203
203
  if (expanded.missingFields.length > 0) {
204
204
  return {
205
205
  error: {
@@ -278,7 +278,7 @@ function getExpandedSegment(segment, inputSource) {
278
278
  updatedSegment = { ...segment, queryFields: updatedQueryFields };
279
279
  }
280
280
  const allFieldUsage = mergeFieldUsage(getFieldUsageFromFilterList(inputSource), segment.fieldUsage);
281
- const expanded = _expandFieldUsage(allFieldUsage || [], fields);
281
+ const expanded = expandFieldUsage(allFieldUsage || [], fields);
282
282
  // Merge ungroupings from direct collection and field expansion
283
283
  const allUngroupings = [...collectedUngroupings, ...expanded.ungroupings];
284
284
  return {
@@ -334,7 +334,7 @@ function findActiveJoins(dependencies) {
334
334
  * - `missingFields`: References to fields which could not be resolved
335
335
  * - `activeJoins`: Topologically sorted list of joins needed to resolve these uses
336
336
  */
337
- function _expandFieldUsage(fieldUsage, fields) {
337
+ function expandFieldUsage(fieldUsage, fields) {
338
338
  var _a, _b, _c;
339
339
  const seen = {};
340
340
  const missingFields = [];
@@ -222,7 +222,7 @@ export declare class MalloyParser extends Parser {
222
222
  static readonly RULE_defMeasures = 38;
223
223
  static readonly RULE_defDimensions = 39;
224
224
  static readonly RULE_renameList = 40;
225
- static readonly RULE_exploreRenameDef = 41;
225
+ static readonly RULE_renameEntry = 41;
226
226
  static readonly RULE_defList = 42;
227
227
  static readonly RULE_fieldDef = 43;
228
228
  static readonly RULE_fieldNameDef = 44;
@@ -391,7 +391,7 @@ export declare class MalloyParser extends Parser {
391
391
  defMeasures(): DefMeasuresContext;
392
392
  defDimensions(): DefDimensionsContext;
393
393
  renameList(): RenameListContext;
394
- exploreRenameDef(): ExploreRenameDefContext;
394
+ renameEntry(): RenameEntryContext;
395
395
  defList(): DefListContext;
396
396
  fieldDef(): FieldDefContext;
397
397
  fieldNameDef(): FieldNameDefContext;
@@ -936,6 +936,7 @@ export declare class DefExplorePrimaryKeyContext extends ExploreStatementContext
936
936
  accept<Result>(visitor: MalloyParserVisitor<Result>): Result;
937
937
  }
938
938
  export declare class DefExploreRenameContext extends ExploreStatementContext {
939
+ tags(): TagsContext;
939
940
  RENAME(): TerminalNode;
940
941
  renameList(): RenameListContext;
941
942
  accessLabel(): AccessLabelContext | undefined;
@@ -1028,8 +1029,8 @@ export declare class DefDimensionsContext extends ParserRuleContext {
1028
1029
  accept<Result>(visitor: MalloyParserVisitor<Result>): Result;
1029
1030
  }
1030
1031
  export declare class RenameListContext extends ParserRuleContext {
1031
- exploreRenameDef(): ExploreRenameDefContext[];
1032
- exploreRenameDef(i: number): ExploreRenameDefContext;
1032
+ renameEntry(): RenameEntryContext[];
1033
+ renameEntry(i: number): RenameEntryContext;
1033
1034
  COMMA(): TerminalNode[];
1034
1035
  COMMA(i: number): TerminalNode;
1035
1036
  constructor(parent: ParserRuleContext | undefined, invokingState: number);
@@ -1038,7 +1039,8 @@ export declare class RenameListContext extends ParserRuleContext {
1038
1039
  exitRule(listener: MalloyParserListener): void;
1039
1040
  accept<Result>(visitor: MalloyParserVisitor<Result>): Result;
1040
1041
  }
1041
- export declare class ExploreRenameDefContext extends ParserRuleContext {
1042
+ export declare class RenameEntryContext extends ParserRuleContext {
1043
+ tags(): TagsContext;
1042
1044
  fieldName(): FieldNameContext[];
1043
1045
  fieldName(i: number): FieldNameContext;
1044
1046
  isDefine(): IsDefineContext;