@malloydata/malloy 0.0.294 → 0.0.296

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.
@@ -211,6 +211,106 @@ const string_reverse = {
211
211
  returns: 'string',
212
212
  impl: { sql: 'REVERSE(CAST(${str} AS VARCHAR))' },
213
213
  };
214
+ const set_agg = {
215
+ generic: { 'T': ['any'] },
216
+ takes: { 'value': { dimension: T } },
217
+ returns: { measure: { array: T } },
218
+ impl: { function: 'SET_AGG' },
219
+ isSymmetric: true,
220
+ };
221
+ const set_union = {
222
+ generic: { 'T': ['any'] },
223
+ takes: { x: { array: T } },
224
+ returns: { measure: { array: T } },
225
+ impl: { function: 'SET_UNION' },
226
+ };
227
+ const hll_accumulate_moving = {
228
+ preceding: {
229
+ takes: {
230
+ 'value': { dimension: T },
231
+ 'preceding': { literal: 'number' },
232
+ },
233
+ returns: { calculation: { sql_native: 'hyperloglog' } },
234
+ generic: {
235
+ 'T': ['string', 'number', 'date', 'timestamp', 'boolean', 'json'],
236
+ },
237
+ impl: {
238
+ function: 'APPROX_SET',
239
+ needsWindowOrderBy: true,
240
+ between: { preceding: 'preceding', following: 0 },
241
+ },
242
+ },
243
+ following: {
244
+ takes: {
245
+ 'value': { dimension: T },
246
+ 'preceding': { literal: 'number' },
247
+ 'following': { literal: 'number' },
248
+ },
249
+ returns: { calculation: { sql_native: 'hyperloglog' } },
250
+ generic: {
251
+ 'T': ['string', 'number', 'date', 'timestamp', 'boolean', 'json'],
252
+ },
253
+ impl: {
254
+ function: 'APPROX_SET',
255
+ needsWindowOrderBy: true,
256
+ between: { preceding: 'preceding', following: 'following' },
257
+ },
258
+ },
259
+ };
260
+ const hll_combine_moving = {
261
+ preceding: {
262
+ takes: {
263
+ 'value': { sql_native: 'hyperloglog' },
264
+ 'preceding': { literal: 'number' },
265
+ },
266
+ returns: { calculation: { sql_native: 'hyperloglog' } },
267
+ impl: {
268
+ function: 'MERGE',
269
+ needsWindowOrderBy: true,
270
+ between: { preceding: 'preceding', following: 0 },
271
+ },
272
+ },
273
+ following: {
274
+ takes: {
275
+ 'value': { sql_native: 'hyperloglog' },
276
+ 'preceding': { literal: 'number' },
277
+ 'following': { literal: 'number' },
278
+ },
279
+ returns: { calculation: { sql_native: 'hyperloglog' } },
280
+ impl: {
281
+ function: 'MERGE',
282
+ needsWindowOrderBy: true,
283
+ between: { preceding: 'preceding', following: 'following' },
284
+ },
285
+ },
286
+ };
287
+ const hll_estimate_moving = {
288
+ preceding: {
289
+ takes: {
290
+ 'value': { sql_native: 'hyperloglog' },
291
+ 'preceding': { literal: 'number' },
292
+ },
293
+ returns: { calculation: 'number' },
294
+ impl: {
295
+ function: 'CARDINALITY',
296
+ needsWindowOrderBy: true,
297
+ between: { preceding: 'preceding', following: 0 },
298
+ },
299
+ },
300
+ following: {
301
+ takes: {
302
+ 'value': { sql_native: 'hyperloglog' },
303
+ 'preceding': { literal: 'number' },
304
+ 'following': { literal: 'number' },
305
+ },
306
+ returns: { calculation: 'number' },
307
+ impl: {
308
+ function: 'CARDINALITY',
309
+ needsWindowOrderBy: true,
310
+ between: { preceding: 'preceding', following: 'following' },
311
+ },
312
+ },
313
+ };
214
314
  /**
215
315
  * This map is for functions which exist in both Presto and Trino.
216
316
  * If you are adding functions which only exist in Presto, put them in
@@ -223,6 +323,10 @@ exports.TRINO_DIALECT_FUNCTIONS = {
223
323
  // string functions
224
324
  reverse: string_reverse,
225
325
  // aggregate functions
326
+ max_by,
327
+ min_by,
328
+ string_agg,
329
+ string_agg_distinct,
226
330
  // TODO: Approx percentile can be called with a third argument; we probably
227
331
  // want to implement that at some point
228
332
  // In Presto, this is an "error" parameter between 0 and 1
@@ -284,10 +388,9 @@ exports.TRINO_DIALECT_FUNCTIONS = {
284
388
  returns: { dimension: { sql_native: 'hyperloglog' } },
285
389
  impl: { sql: 'CAST(${value} AS HyperLogLog)' },
286
390
  },
287
- max_by,
288
- min_by,
289
- string_agg,
290
- string_agg_distinct,
391
+ hll_accumulate_moving,
392
+ hll_combine_moving,
393
+ hll_estimate_moving,
291
394
  ...(0, util_1.def)('variance', { 'n': 'number' }, { measure: 'number' }),
292
395
  // scalar functions
293
396
  ...(0, util_1.def)('bitwise_and', { 'val1': 'number', 'val2': 'number' }, 'number'),
@@ -315,6 +418,8 @@ exports.TRINO_DIALECT_FUNCTIONS = {
315
418
  array_agg_distinct,
316
419
  array_join,
317
420
  sequence,
421
+ set_agg,
422
+ set_union,
318
423
  ...(0, util_1.def)('array_distinct', { 'x': { array: T } }, { array: T }),
319
424
  ...(0, util_1.def)('array_except', { 'x': { array: T }, 'y': { array: T } }, { array: T }),
320
425
  ...(0, util_1.def)('array_intersect', { 'x': { array: T }, 'y': { array: T } }, { array: T }),
@@ -402,5 +507,38 @@ exports.PRESTO_DIALECT_FUNCTIONS = {
402
507
  impl: { sql: 'APPROX_SET(${value}, 0.0040625)' },
403
508
  },
404
509
  },
510
+ hll_accumulate_moving: {
511
+ preceding: {
512
+ takes: {
513
+ 'value': { dimension: T },
514
+ 'preceding': { literal: 'number' },
515
+ },
516
+ returns: { calculation: { sql_native: 'hyperloglog' } },
517
+ generic: {
518
+ 'T': ['string', 'number', 'date', 'timestamp', 'boolean', 'json'],
519
+ },
520
+ impl: {
521
+ sql: 'APPROX_SET(${value}, 0.0040625)',
522
+ needsWindowOrderBy: true,
523
+ between: { preceding: 'preceding', following: 0 },
524
+ },
525
+ },
526
+ following: {
527
+ takes: {
528
+ 'value': { dimension: T },
529
+ 'preceding': { literal: 'number' },
530
+ 'following': { literal: 'number' },
531
+ },
532
+ returns: { calculation: { sql_native: 'hyperloglog' } },
533
+ generic: {
534
+ 'T': ['string', 'number', 'date', 'timestamp', 'boolean', 'json'],
535
+ },
536
+ impl: {
537
+ sql: 'APPROX_SET(${value}, 0.0040625)',
538
+ needsWindowOrderBy: true,
539
+ between: { preceding: 'preceding', following: 'following' },
540
+ },
541
+ },
542
+ },
405
543
  };
406
544
  //# sourceMappingURL=dialect_functions.js.map
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ export type { QueryOptionsReader, RunSQLOptions } from './run_sql_options';
10
10
  export type { EventStream, ModelString, ModelURL, QueryString, QueryURL, URLReader, InvalidationKey, } from './runtime_types';
11
11
  export type { Connection, ConnectionConfig, ConnectionFactory, ConnectionParameter, ConnectionParameterValue, ConnectionConfigSchema, FetchSchemaOptions, InfoConnection, LookupConnection, PersistSQLResults, PooledConnection, TestableConnection, StreamingConnection, } from './connection/types';
12
12
  export { toAsyncGenerator } from './connection_utils';
13
- export { modelDefToModelInfo, sourceDefToSourceInfo } from './to_stable';
13
+ export { modelDefToModelInfo, sourceDefToSourceInfo, writeMalloyObjectToTag, extractMalloyObjectFromTag, } from './to_stable';
14
14
  export * as API from './api';
15
15
  export type { SQLSourceRequest } from './lang/translate-response';
16
16
  export { sqlKey } from './model/sql_block';
package/dist/index.js CHANGED
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  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.Segment = 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.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;
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
  *
@@ -137,6 +137,8 @@ Object.defineProperty(exports, "toAsyncGenerator", { enumerable: true, get: func
137
137
  var to_stable_1 = require("./to_stable");
138
138
  Object.defineProperty(exports, "modelDefToModelInfo", { enumerable: true, get: function () { return to_stable_1.modelDefToModelInfo; } });
139
139
  Object.defineProperty(exports, "sourceDefToSourceInfo", { enumerable: true, get: function () { return to_stable_1.sourceDefToSourceInfo; } });
140
+ Object.defineProperty(exports, "writeMalloyObjectToTag", { enumerable: true, get: function () { return to_stable_1.writeMalloyObjectToTag; } });
141
+ Object.defineProperty(exports, "extractMalloyObjectFromTag", { enumerable: true, get: function () { return to_stable_1.extractMalloyObjectFromTag; } });
140
142
  exports.API = __importStar(require("./api"));
141
143
  var sql_block_1 = require("./model/sql_block");
142
144
  Object.defineProperty(exports, "sqlKey", { enumerable: true, get: function () { return sql_block_1.sqlKey; } });
@@ -3,6 +3,7 @@ import type { ExprValue } from '../types/expr-value';
3
3
  import { ExpressionDef } from '../types/expression-def';
4
4
  import type { FieldSpace } from '../types/field-space';
5
5
  import { Range } from './range';
6
+ import type * as Malloy from '@malloydata/malloy-interfaces';
6
7
  /**
7
8
  * GranularTime is a moment in time which ALSO has a "granularity"
8
9
  * commonly this are created by applying ".datePart" to an expression
@@ -18,6 +19,7 @@ export declare class ExprGranularTime extends ExpressionDef {
18
19
  legalChildTypes: import("../../../model/malloy_types").TypeDesc[];
19
20
  constructor(expr: ExpressionDef, units: TimestampUnit, truncate: boolean);
20
21
  granular(): boolean;
22
+ drillExpression(): Malloy.Expression | undefined;
21
23
  getExpression(fs: FieldSpace): ExprValue;
22
24
  toRange(fs: FieldSpace): Range;
23
25
  }
@@ -82,6 +82,19 @@ class ExprGranularTime extends expression_def_1.ExpressionDef {
82
82
  granular() {
83
83
  return true;
84
84
  }
85
+ drillExpression() {
86
+ const lhs = this.expr.drillExpression();
87
+ if ((lhs === null || lhs === void 0 ? void 0 : lhs.kind) !== 'field_reference')
88
+ return undefined;
89
+ return {
90
+ kind: 'time_truncation',
91
+ field_reference: {
92
+ name: lhs.name,
93
+ path: lhs.path,
94
+ },
95
+ truncation: this.units,
96
+ };
97
+ }
85
98
  getExpression(fs) {
86
99
  const timeframe = this.units;
87
100
  const exprVal = this.expr.getExpression(fs);
@@ -2,10 +2,12 @@ import type { ExprValue } from '../types/expr-value';
2
2
  import type { FieldReference } from '../query-items/field-references';
3
3
  import type { FieldSpace } from '../types/field-space';
4
4
  import { ExpressionDef } from '../types/expression-def';
5
+ import type * as Malloy from '@malloydata/malloy-interfaces';
5
6
  export declare class ExprIdReference extends ExpressionDef {
6
7
  readonly fieldReference: FieldReference;
7
8
  elementType: string;
8
9
  constructor(fieldReference: FieldReference);
9
10
  get refString(): string;
11
+ drillExpression(): Malloy.Expression | undefined;
10
12
  getExpression(fs: FieldSpace): ExprValue;
11
13
  }
@@ -35,6 +35,13 @@ class ExprIdReference extends expression_def_1.ExpressionDef {
35
35
  get refString() {
36
36
  return this.fieldReference.refString;
37
37
  }
38
+ drillExpression() {
39
+ return {
40
+ kind: 'field_reference',
41
+ name: this.fieldReference.nameString,
42
+ path: this.fieldReference.path.slice(0, -1),
43
+ };
44
+ }
38
45
  getExpression(fs) {
39
46
  const def = this.fieldReference.getField(fs);
40
47
  if (def.found) {
@@ -101,6 +101,11 @@ class ReferenceField extends space_field_1.SpaceField {
101
101
  type: 'fieldref',
102
102
  path,
103
103
  at: this.fieldRef.location,
104
+ drillExpression: {
105
+ kind: 'field_reference',
106
+ name: path[path.length - 1],
107
+ path: path.slice(0, -1),
108
+ },
104
109
  };
105
110
  }
106
111
  const refTo = this.referenceTo;
@@ -128,17 +133,17 @@ class ReferenceField extends space_field_1.SpaceField {
128
133
  if (refTo) {
129
134
  const joinPath = this.fieldRef.list.slice(0, -1).map(x => x.refString);
130
135
  const typeDesc = refTo.typeDesc();
136
+ const usage = {
137
+ path: this.fieldRef.path,
138
+ at: this.fieldRef.location,
139
+ };
131
140
  this.memoTypeDesc = {
132
141
  ...typeDesc,
133
- fieldUsage: [
134
- {
135
- path: this.fieldRef.path,
136
- at: this.fieldRef.location,
137
- },
138
- ],
142
+ fieldUsage: [usage],
139
143
  requiresGroupBy: (_a = typeDesc.requiresGroupBy) === null || _a === void 0 ? void 0 : _a.map(gb => ({
140
144
  ...gb,
141
145
  path: [...joinPath, ...gb.path],
146
+ fieldUsage: usage,
142
147
  })),
143
148
  };
144
149
  return this.memoTypeDesc;
@@ -147,6 +147,7 @@ class AtomicFieldDeclaration extends malloy_element_1.MalloyElement {
147
147
  else {
148
148
  ret.e = exprValue.value;
149
149
  }
150
+ ret.drillExpression = this.expr.drillExpression();
150
151
  ret.fieldUsage = exprValue.fieldUsage;
151
152
  ret.ungroupings = exprValue.ungroupings;
152
153
  ret.requiresGroupBy = exprValue.requiresGroupBy;
@@ -1,4 +1,4 @@
1
- import type { Expr, FilterCondition, PipeSegment, TypeDesc } from '../../../model/malloy_types';
1
+ import type { Expr, FilterCondition, PipeSegment, TurtleDef, TypeDesc } from '../../../model/malloy_types';
2
2
  import type { FieldReference } from '../query-items/field-references';
3
3
  import type { ExprValue } from '../types/expr-value';
4
4
  import { ExpressionDef } from '../types/expression-def';
@@ -22,4 +22,5 @@ export declare class Drill extends Filter implements QueryPropertyInterface {
22
22
  protected checkedDrillCondition(fs: FieldSpace, filter: FilterElement, reference: FieldReference, value: Literal): FilterCondition | undefined;
23
23
  protected checkedFilterCondition(fs: FieldSpace, filter: FilterElement): FilterCondition | undefined;
24
24
  }
25
- export declare function attachDrillPaths(pipeline: PipeSegment[], name: string): PipeSegment[];
25
+ export declare function updateNestedDrillPaths(nest: TurtleDef, name: string): TurtleDef;
26
+ export declare function attachDrillPaths(pipeline: PipeSegment[], nestName: string): PipeSegment[];
@@ -7,6 +7,7 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.Drill = exports.DrillField = void 0;
10
+ exports.updateNestedDrillPaths = updateNestedDrillPaths;
10
11
  exports.attachDrillPaths = attachDrillPaths;
11
12
  const composite_source_utils_1 = require("../../../model/composite_source_utils");
12
13
  const malloy_types_1 = require("../../../model/malloy_types");
@@ -292,7 +293,8 @@ class Drill extends filters_1.Filter {
292
293
  fieldUsage: (0, composite_source_utils_1.mergeFieldUsage)(fExpr.fieldUsage, collectedWhereFieldUsage),
293
294
  stableFilter: {
294
295
  kind: 'literal_equality',
295
- field_reference: {
296
+ expression: {
297
+ kind: 'field_reference',
296
298
  name: fieldName.refString,
297
299
  path: reference.list.slice(0, -1).map(f => f.name),
298
300
  },
@@ -312,7 +314,39 @@ class Drill extends filters_1.Filter {
312
314
  }
313
315
  }
314
316
  exports.Drill = Drill;
315
- function attachDrillPaths(pipeline, name) {
317
+ function updateNestedDrillPaths(nest, name) {
318
+ if (nest.pipeline.length !== 1 || !(0, malloy_types_1.isQuerySegment)(nest.pipeline[0])) {
319
+ return nest;
320
+ }
321
+ return {
322
+ ...nest,
323
+ pipeline: [
324
+ {
325
+ ...nest.pipeline[0],
326
+ queryFields: nest.pipeline[0].queryFields.map(f => {
327
+ var _a;
328
+ if (f.type === 'turtle') {
329
+ return updateNestedDrillPaths(f, name);
330
+ }
331
+ const existing = f.drillExpression;
332
+ if (existing === undefined)
333
+ return f;
334
+ if (existing.kind !== 'field_reference') {
335
+ return { ...f, drillExpression: undefined };
336
+ }
337
+ return {
338
+ ...f,
339
+ drillExpression: {
340
+ ...existing,
341
+ path: [name, ...((_a = existing.path) !== null && _a !== void 0 ? _a : [])],
342
+ },
343
+ };
344
+ }),
345
+ },
346
+ ],
347
+ };
348
+ }
349
+ function attachDrillPaths(pipeline, nestName) {
316
350
  var _a;
317
351
  if (pipeline.length !== 1)
318
352
  return pipeline;
@@ -323,12 +357,23 @@ function attachDrillPaths(pipeline, name) {
323
357
  ...pipeline[0],
324
358
  filterList: (_a = pipeline[0].filterList) === null || _a === void 0 ? void 0 : _a.map(f => ({
325
359
  ...f,
326
- drillView: name,
327
- })),
328
- queryFields: pipeline[0].queryFields.map(f => ({
329
- ...f,
330
- drillView: name,
360
+ filterView: nestName,
331
361
  })),
362
+ queryFields: pipeline[0].queryFields.map(f => {
363
+ var _a;
364
+ if (f.type === 'turtle') {
365
+ return updateNestedDrillPaths(f, nestName);
366
+ }
367
+ const fieldName = f.type === 'fieldref' ? f.path[f.path.length - 1] : (_a = f.as) !== null && _a !== void 0 ? _a : f.name;
368
+ return {
369
+ ...f,
370
+ drillExpression: {
371
+ kind: 'field_reference',
372
+ name: fieldName,
373
+ path: [nestName],
374
+ },
375
+ };
376
+ }),
332
377
  },
333
378
  ];
334
379
  }
@@ -39,28 +39,28 @@ class FilterElement extends malloy_element_1.MalloyElement {
39
39
  this.elementType = 'filterElement';
40
40
  }
41
41
  getStableFilter() {
42
- const drillFilter = this.drillFilter();
43
- if (drillFilter !== undefined) {
42
+ if (this.expr instanceof expr_compare_1.ExprEquality &&
43
+ this.expr.op === '=' &&
44
+ (0, literal_1.isLiteral)(this.expr.right)) {
45
+ const lhs = this.expr.left.drillExpression();
46
+ if (lhs === undefined)
47
+ return undefined;
44
48
  return {
45
49
  kind: 'literal_equality',
46
- field_reference: {
47
- name: drillFilter.reference.nameString,
48
- path: drillFilter.reference.list.map(f => f.name).slice(0, -1),
49
- },
50
- value: drillFilter.value.getStableLiteral(),
50
+ expression: lhs,
51
+ value: this.expr.right.getStableLiteral(),
51
52
  };
52
53
  }
53
- const filterExpressionFilter = this.filterExpressionFilter();
54
- if (filterExpressionFilter !== undefined) {
54
+ else if (this.expr instanceof expr_compare_1.ExprCompare &&
55
+ this.expr.op === '~' &&
56
+ this.expr.right instanceof expr_filter_expr_1.ExprFilterExpression) {
57
+ const lhs = this.expr.left.drillExpression();
58
+ if (lhs === undefined)
59
+ return undefined;
55
60
  return {
56
61
  kind: 'filter_string',
57
- field_reference: {
58
- name: filterExpressionFilter.reference.nameString,
59
- path: filterExpressionFilter.reference.list
60
- .map(f => f.name)
61
- .slice(0, -1),
62
- },
63
- filter: filterExpressionFilter.filterExpression,
62
+ expression: lhs,
63
+ filter: this.expr.right.filterText,
64
64
  };
65
65
  }
66
66
  return undefined;
@@ -1,3 +1,4 @@
1
+ import type * as Malloy from '@malloydata/malloy-interfaces';
1
2
  import type { Expr, TimestampUnit } from '../../../model/malloy_types';
2
3
  import type { ExprValue } from './expr-value';
3
4
  import type { FieldSpace } from './field-space';
@@ -42,6 +43,7 @@ export declare abstract class ExpressionDef extends MalloyElement {
42
43
  * @param eVal ...list of expressions that must match legalChildTypes
43
44
  */
44
45
  typeCheck(eNode: ExpressionDef, eVal: ExprValue): boolean;
46
+ drillExpression(): Malloy.Expression | undefined;
45
47
  /**
46
48
  * This is the operation which makes partial comparison and value trees work
47
49
  * The default implementation merely constructs LEFT OP RIGHT, but specialized
@@ -124,6 +124,9 @@ class ExpressionDef extends malloy_element_1.MalloyElement {
124
124
  }
125
125
  return true;
126
126
  }
127
+ drillExpression() {
128
+ return undefined;
129
+ }
127
130
  /**
128
131
  * This is the operation which makes partial comparison and value trees work
129
132
  * The default implementation merely constructs LEFT OP RIGHT, but specialized
@@ -736,7 +736,8 @@ class MalloyToQuery extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor
736
736
  return {
737
737
  filter: {
738
738
  kind: 'filter_string',
739
- field_reference: {
739
+ expression: {
740
+ kind: 'field_reference',
740
741
  name,
741
742
  path,
742
743
  },
@@ -759,7 +760,8 @@ class MalloyToQuery extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor
759
760
  return {
760
761
  filter: {
761
762
  kind: 'literal_equality',
762
- field_reference: {
763
+ expression: {
764
+ kind: 'field_reference',
763
765
  name,
764
766
  path,
765
767
  },
@@ -1,4 +1,4 @@
1
- import type { FieldUsage, DocumentLocation, ExpressionValueType } from '../model/malloy_types';
1
+ import type { DocumentLocation, ExpressionValueType } from '../model/malloy_types';
2
2
  import type { EventStream } from '../runtime_types';
3
3
  export type LogSeverity = 'error' | 'warn' | 'debug';
4
4
  /**
@@ -159,11 +159,6 @@ type MessageParameterTypes = {
159
159
  'field-not-found': string;
160
160
  'composite-field-type-mismatch': string;
161
161
  'invalid-composite-source-input': string;
162
- 'invalid-composite-field-usage': {
163
- newUsage: FieldUsage[];
164
- allUsage: FieldUsage[];
165
- conflictingUsage: FieldUsage[];
166
- };
167
162
  'could-not-resolve-composite-source': string;
168
163
  'empty-composite-source': string;
169
164
  'unnecessary-composite-source': string;
@@ -24,7 +24,6 @@
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.MESSAGE_FORMATTERS = exports.BaseMessageLogger = void 0;
26
26
  exports.makeLogMessage = makeLogMessage;
27
- const composite_source_utils_1 = require("../model/composite_source_utils");
28
27
  class BaseMessageLogger {
29
28
  constructor(eventStream) {
30
29
  this.eventStream = eventStream;
@@ -96,13 +95,6 @@ exports.MESSAGE_FORMATTERS = {
96
95
  'case-else-type-does-not-match': e => `Case else type ${e.elseType} does not match return type ${e.returnType}`,
97
96
  'case-when-must-be-boolean': e => `Case when expression must be boolean, not ${e.whenType}`,
98
97
  'case-when-type-does-not-match': e => `Case when type ${e.whenType} does not match value type ${e.valueType}`,
99
- 'invalid-composite-field-usage': e => {
100
- const formattedNewCompositeUsage = (0, composite_source_utils_1.formatFieldUsages)(e.newUsage);
101
- const formattedConflictingCompositeUsage = (0, composite_source_utils_1.formatFieldUsages)(e.conflictingUsage);
102
- const formattedAllCompositeUsage = (0, composite_source_utils_1.formatFieldUsages)(e.allUsage);
103
- const pluralUse = (0, composite_source_utils_1.fieldUsageIsPlural)(e.newUsage) ? 's' : '';
104
- return `This operation uses field${pluralUse} ${formattedNewCompositeUsage}, resulting in invalid usage of the composite source, as there is no composite input source which defines all of ${formattedConflictingCompositeUsage}\nFields required in source: ${formattedAllCompositeUsage}`;
105
- },
106
98
  };
107
99
  function makeLogMessage(code, parameters, options) {
108
100
  var _a, _b, _c, _d, _e;
@@ -84,7 +84,6 @@ export declare function fieldUsageJoinPaths(fieldUsage: FieldUsage[]): string[][
84
84
  export declare function checkRequiredGroupBys(compositeResolvedSourceDef: SourceDef, segment: PipeSegment): RequiredGroupBy[];
85
85
  export declare function pathEq(a: string[], b: string[]): boolean;
86
86
  export declare function pathBegins(path: string[], prefix: string[]): boolean;
87
- export declare function sortFieldUsageByReferenceLocation(usage: FieldUsage[]): FieldUsage[];
88
87
  export declare function hasCompositesAnywhere(source: StructDef): boolean;
89
88
  export declare function logCompositeError(error: CompositeError, logTo: MalloyElement): void;
90
89
  export declare function compileFilterExpression(ft: string, fexpr: Expr): {