@malloydata/malloy 0.0.195-dev241003204905 → 0.0.195-dev241007154000

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.
Files changed (144) hide show
  1. package/dist/connection/base_connection.d.ts +21 -7
  2. package/dist/connection/base_connection.js +62 -0
  3. package/dist/connection/types.d.ts +5 -5
  4. package/dist/dialect/dialect.d.ts +5 -3
  5. package/dist/dialect/dialect.js +15 -0
  6. package/dist/dialect/duckdb/duckdb.d.ts +3 -3
  7. package/dist/dialect/duckdb/duckdb.js +8 -3
  8. package/dist/dialect/postgres/postgres.d.ts +3 -3
  9. package/dist/dialect/postgres/postgres.js +5 -2
  10. package/dist/dialect/snowflake/snowflake.d.ts +3 -3
  11. package/dist/dialect/snowflake/snowflake.js +4 -1
  12. package/dist/dialect/standardsql/standardsql.d.ts +3 -3
  13. package/dist/dialect/standardsql/standardsql.js +5 -2
  14. package/dist/dialect/trino/trino.d.ts +3 -3
  15. package/dist/dialect/trino/trino.js +35 -3
  16. package/dist/index.d.ts +4 -4
  17. package/dist/index.js +6 -2
  18. package/dist/lang/ast/error-factory.d.ts +4 -3
  19. package/dist/lang/ast/error-factory.js +27 -17
  20. package/dist/lang/ast/expressions/constant-expression.d.ts +1 -0
  21. package/dist/lang/ast/expressions/constant-expression.js +3 -0
  22. package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +3 -7
  23. package/dist/lang/ast/expressions/expr-aggregate-function.js +50 -54
  24. package/dist/lang/ast/expressions/expr-cast.js +2 -4
  25. package/dist/lang/ast/expressions/expr-func.js +1 -1
  26. package/dist/lang/ast/expressions/expr-granular-time.js +1 -1
  27. package/dist/lang/ast/expressions/expr-record-literal.d.ts +16 -0
  28. package/dist/lang/ast/expressions/expr-record-literal.js +57 -0
  29. package/dist/lang/ast/expressions/expr-time-extract.js +3 -3
  30. package/dist/lang/ast/expressions/expr-time.d.ts +3 -3
  31. package/dist/lang/ast/expressions/expr-time.js +1 -1
  32. package/dist/lang/ast/expressions/time-literal.d.ts +6 -6
  33. package/dist/lang/ast/expressions/time-literal.js +1 -1
  34. package/dist/lang/ast/field-space/column-space-field.d.ts +6 -5
  35. package/dist/lang/ast/field-space/column-space-field.js +7 -4
  36. package/dist/lang/ast/field-space/dynamic-space.d.ts +8 -6
  37. package/dist/lang/ast/field-space/dynamic-space.js +35 -11
  38. package/dist/lang/ast/field-space/index-field-space.js +6 -3
  39. package/dist/lang/ast/field-space/ir-view-field.d.ts +1 -0
  40. package/dist/lang/ast/field-space/ir-view-field.js +3 -1
  41. package/dist/lang/ast/field-space/join-space-field.d.ts +2 -2
  42. package/dist/lang/ast/field-space/join-space-field.js +2 -2
  43. package/dist/lang/ast/field-space/parameter-space.d.ts +1 -0
  44. package/dist/lang/ast/field-space/parameter-space.js +4 -1
  45. package/dist/lang/ast/field-space/query-input-space.d.ts +4 -4
  46. package/dist/lang/ast/field-space/query-input-space.js +3 -5
  47. package/dist/lang/ast/field-space/query-spaces.d.ts +4 -4
  48. package/dist/lang/ast/field-space/query-spaces.js +1 -1
  49. package/dist/lang/ast/field-space/reference-field.js +10 -8
  50. package/dist/lang/ast/field-space/refined-space.d.ts +2 -2
  51. package/dist/lang/ast/field-space/static-space.d.ts +14 -5
  52. package/dist/lang/ast/field-space/static-space.js +45 -20
  53. package/dist/lang/ast/field-space/struct-space-field-base.d.ts +6 -5
  54. package/dist/lang/ast/field-space/struct-space-field-base.js +12 -4
  55. package/dist/lang/ast/index.d.ts +2 -1
  56. package/dist/lang/ast/index.js +2 -1
  57. package/dist/lang/ast/query-builders/index-builder.d.ts +2 -2
  58. package/dist/lang/ast/query-builders/project-builder.d.ts +2 -2
  59. package/dist/lang/ast/query-builders/reduce-builder.d.ts +2 -2
  60. package/dist/lang/ast/query-elements/query-arrow.js +2 -2
  61. package/dist/lang/ast/query-elements/query-head-struct.d.ts +2 -2
  62. package/dist/lang/ast/query-elements/query-head-struct.js +2 -2
  63. package/dist/lang/ast/query-elements/query-raw.js +2 -2
  64. package/dist/lang/ast/query-elements/query-reference.js +1 -1
  65. package/dist/lang/ast/query-items/field-declaration.d.ts +8 -6
  66. package/dist/lang/ast/query-items/field-declaration.js +66 -24
  67. package/dist/lang/ast/query-properties/qop-desc.d.ts +2 -2
  68. package/dist/lang/ast/query-properties/qop-desc.js +1 -1
  69. package/dist/lang/ast/source-elements/named-source.d.ts +4 -4
  70. package/dist/lang/ast/source-elements/named-source.js +16 -8
  71. package/dist/lang/ast/source-elements/query-source.d.ts +3 -3
  72. package/dist/lang/ast/source-elements/query-source.js +5 -2
  73. package/dist/lang/ast/source-elements/refined-source.d.ts +3 -3
  74. package/dist/lang/ast/source-elements/refined-source.js +4 -4
  75. package/dist/lang/ast/source-elements/source.d.ts +2 -2
  76. package/dist/lang/ast/source-elements/source.js +2 -2
  77. package/dist/lang/ast/source-elements/sql-source.d.ts +4 -4
  78. package/dist/lang/ast/source-elements/sql-source.js +6 -6
  79. package/dist/lang/ast/source-elements/table-source.d.ts +2 -2
  80. package/dist/lang/ast/source-elements/table-source.js +1 -1
  81. package/dist/lang/ast/source-properties/{joins.d.ts → join.d.ts} +11 -14
  82. package/dist/lang/ast/source-properties/{joins.js → join.js} +35 -52
  83. package/dist/lang/ast/source-query-elements/sq-reference.js +6 -5
  84. package/dist/lang/ast/sql-elements/sql-string.d.ts +2 -2
  85. package/dist/lang/ast/statements/define-source.js +1 -1
  86. package/dist/lang/ast/struct-utils.d.ts +3 -3
  87. package/dist/lang/ast/struct-utils.js +12 -3
  88. package/dist/lang/ast/time-utils.d.ts +3 -3
  89. package/dist/lang/ast/types/document-compile-result.d.ts +2 -2
  90. package/dist/lang/ast/types/expression-def.js +4 -4
  91. package/dist/lang/ast/types/field-space.d.ts +8 -3
  92. package/dist/lang/ast/types/lookup-result.d.ts +8 -5
  93. package/dist/lang/ast/types/malloy-element.d.ts +3 -3
  94. package/dist/lang/ast/types/malloy-element.js +10 -21
  95. package/dist/lang/ast/types/op-desc.d.ts +2 -2
  96. package/dist/lang/ast/types/pipeline-comp.d.ts +2 -2
  97. package/dist/lang/ast/types/query-comp.d.ts +3 -3
  98. package/dist/lang/ast/types/query-extend-property.d.ts +1 -2
  99. package/dist/lang/ast/types/query-extend-property.js +4 -2
  100. package/dist/lang/ast/types/source-property.d.ts +2 -2
  101. package/dist/lang/ast/types/source-property.js +2 -2
  102. package/dist/lang/ast/types/space-field.d.ts +10 -3
  103. package/dist/lang/ast/types/space-field.js +11 -2
  104. package/dist/lang/ast/types/time-result.d.ts +2 -2
  105. package/dist/lang/ast/view-elements/qop-desc-view.d.ts +3 -3
  106. package/dist/lang/ast/view-elements/qop-desc-view.js +1 -1
  107. package/dist/lang/ast/view-elements/reference-view.d.ts +4 -4
  108. package/dist/lang/ast/view-elements/reference-view.js +2 -6
  109. package/dist/lang/ast/view-elements/view-refine.d.ts +2 -2
  110. package/dist/lang/index.d.ts +1 -1
  111. package/dist/lang/lib/Malloy/MalloyParser.d.ts +54 -21
  112. package/dist/lang/lib/Malloy/MalloyParser.js +1647 -1457
  113. package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +57 -9
  114. package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +35 -5
  115. package/dist/lang/malloy-to-ast.d.ts +4 -4
  116. package/dist/lang/malloy-to-ast.js +32 -4
  117. package/dist/lang/parse-log.d.ts +5 -9
  118. package/dist/lang/parse-malloy.d.ts +10 -10
  119. package/dist/lang/parse-malloy.js +2 -1
  120. package/dist/lang/test/annotation.spec.js +7 -1
  121. package/dist/lang/test/field-symbols.spec.js +21 -25
  122. package/dist/lang/test/imports.spec.js +12 -10
  123. package/dist/lang/test/lenses.spec.js +2 -2
  124. package/dist/lang/test/model_serialization.spec.d.ts +4 -4
  125. package/dist/lang/test/model_serialization.spec.js +19 -31
  126. package/dist/lang/test/parse.spec.js +3 -4
  127. package/dist/lang/test/query.spec.js +3 -2
  128. package/dist/lang/test/source.spec.js +7 -0
  129. package/dist/lang/test/sql-block.spec.js +8 -19
  130. package/dist/lang/test/test-translator.d.ts +4 -4
  131. package/dist/lang/test/test-translator.js +53 -61
  132. package/dist/lang/translate-response.d.ts +3 -3
  133. package/dist/malloy.d.ts +31 -149
  134. package/dist/malloy.js +109 -267
  135. package/dist/model/malloy_query.d.ts +25 -23
  136. package/dist/model/malloy_query.js +262 -323
  137. package/dist/model/malloy_types.d.ts +145 -155
  138. package/dist/model/malloy_types.js +81 -84
  139. package/dist/model/sql_block.d.ts +4 -4
  140. package/dist/model/sql_block.js +9 -12
  141. package/dist/tags.js +2 -2
  142. package/package.json +1 -1
  143. package/dist/lang/ast/space-seed.d.ts +0 -16
  144. package/dist/lang/ast/space-seed.js +0 -59
@@ -1,21 +1,35 @@
1
- import { MalloyQueryData, QueryRunStats, SQLBlock, StructDef } from '../model/malloy_types';
1
+ import { MalloyQueryData, QueryRunStats, SQLSourceDef, StructDef, TableSourceDef } from '../model/malloy_types';
2
2
  import { RunSQLOptions } from '../run_sql_options';
3
3
  import { Connection, FetchSchemaOptions, PersistSQLResults, PooledConnection, StreamingConnection } from './types';
4
+ export interface SchemaFound<T extends StructDef> {
5
+ schema: T;
6
+ error?: undefined;
7
+ timestamp: number;
8
+ }
9
+ export interface SchemaNotFound {
10
+ schema?: undefined;
11
+ error: string;
12
+ }
13
+ export type CachedSchema<T extends StructDef> = SchemaFound<T> | SchemaNotFound;
4
14
  export declare abstract class BaseConnection implements Connection {
5
15
  abstract runSQL(sql: string, options?: RunSQLOptions | undefined): Promise<MalloyQueryData>;
6
16
  abstract get name(): string;
7
17
  abstract get dialectName(): string;
8
- abstract fetchSchemaForSQLBlock(block: SQLBlock, options: FetchSchemaOptions): Promise<{
9
- structDef: StructDef;
18
+ abstract fetchTableSchema(tableName: string, tablePath: string): Promise<TableSourceDef | string>;
19
+ abstract fetchSelectSchema(sqlSource: SQLSourceDef): Promise<SQLSourceDef | string>;
20
+ protected schemaCache: Record<string, CachedSchema<StructDef>>;
21
+ protected checkSchemaCache<T extends StructDef>(schemaKey: string, schemaType: 'table' | 'sql_select', fillCache: () => Promise<T | string>, refreshTimestamp: number | undefined): Promise<CachedSchema<T>>;
22
+ fetchSchemaForTables(missing: Record<string, string>, { refreshTimestamp }: FetchSchemaOptions): Promise<{
23
+ schemas: Record<string, TableSourceDef>;
24
+ errors: Record<string, string>;
25
+ }>;
26
+ fetchSchemaForSQLStruct(sqlRef: SQLSourceDef, { refreshTimestamp }: FetchSchemaOptions): Promise<{
27
+ structDef: SQLSourceDef;
10
28
  error?: undefined;
11
29
  } | {
12
30
  error: string;
13
31
  structDef?: undefined;
14
32
  }>;
15
- abstract fetchSchemaForTables(tables: Record<string, string>, options: FetchSchemaOptions): Promise<{
16
- schemas: Record<string, StructDef>;
17
- errors: Record<string, string>;
18
- }>;
19
33
  isPool(): this is PooledConnection;
20
34
  canPersist(): this is PersistSQLResults;
21
35
  canStream(): this is StreamingConnection;
@@ -1,7 +1,69 @@
1
1
  "use strict";
2
+ /*
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.BaseConnection = void 0;
4
10
  class BaseConnection {
11
+ constructor() {
12
+ this.schemaCache = {};
13
+ }
14
+ async checkSchemaCache(schemaKey, schemaType, fillCache, refreshTimestamp) {
15
+ let cached = this.schemaCache[schemaKey];
16
+ if (!cached ||
17
+ (cached.schema && refreshTimestamp && refreshTimestamp > cached.timestamp)) {
18
+ try {
19
+ const cacheResponse = await fillCache();
20
+ if (typeof cacheResponse === 'string') {
21
+ cached = { error: cacheResponse };
22
+ }
23
+ else {
24
+ cached = {
25
+ schema: cacheResponse,
26
+ timestamp: refreshTimestamp !== null && refreshTimestamp !== void 0 ? refreshTimestamp : Date.now(),
27
+ };
28
+ }
29
+ }
30
+ catch (uncaught) {
31
+ cached = { error: uncaught.message };
32
+ }
33
+ this.schemaCache[schemaKey] = cached;
34
+ }
35
+ if (cached.error) {
36
+ return cached;
37
+ }
38
+ if (cached.schema && cached.schema.type === schemaType) {
39
+ return { ...cached, schema: cached.schema };
40
+ }
41
+ return { error: 'Wrong type found in schema cache' };
42
+ }
43
+ async fetchSchemaForTables(missing, { refreshTimestamp }) {
44
+ const schemas = {};
45
+ const errors = {};
46
+ for (const [tableName, tablePath] of Object.entries(missing)) {
47
+ const inCache = await this.checkSchemaCache(tablePath, 'table', async () => await this.fetchTableSchema(tableName, tablePath), refreshTimestamp);
48
+ if (inCache.schema) {
49
+ schemas[tableName] = inCache.schema;
50
+ }
51
+ if (inCache.error) {
52
+ errors[tableName] = inCache.error;
53
+ }
54
+ }
55
+ return { schemas, errors };
56
+ }
57
+ async fetchSchemaForSQLStruct(sqlRef, { refreshTimestamp }) {
58
+ const inCache = await this.checkSchemaCache(sqlRef.name, 'sql_select', async () => await this.fetchSelectSchema(sqlRef), refreshTimestamp);
59
+ if (inCache.schema) {
60
+ return { structDef: inCache.schema };
61
+ }
62
+ if (inCache.error) {
63
+ return { error: inCache.error };
64
+ }
65
+ return { error: 'Unknown schema fetch error' };
66
+ }
5
67
  isPool() {
6
68
  return false;
7
69
  }
@@ -1,5 +1,5 @@
1
1
  import { RunSQLOptions } from '../run_sql_options';
2
- import { Annotation, MalloyQueryData, QueryDataRow, QueryRunStats, SQLBlock, StructDef } from '../model/malloy_types';
2
+ import { Annotation, MalloyQueryData, QueryDataRow, QueryRunStats, SQLSourceDef, TableSourceDef } from '../model/malloy_types';
3
3
  import { Dialect } from '../dialect';
4
4
  /**
5
5
  * Options passed to fetchSchema methods.
@@ -20,7 +20,7 @@ export interface InfoConnection {
20
20
  * @return A mapping of table keys to schemas.
21
21
  */
22
22
  fetchSchemaForTables(tables: Record<string, string>, options: FetchSchemaOptions): Promise<{
23
- schemas: Record<string, StructDef>;
23
+ schemas: Record<string, TableSourceDef>;
24
24
  errors: Record<string, string>;
25
25
  }>;
26
26
  /**
@@ -29,8 +29,8 @@ export interface InfoConnection {
29
29
  * @param block The SQL blocks to fetch schemas for.
30
30
  * @return A mapping of SQL block names to schemas.
31
31
  */
32
- fetchSchemaForSQLBlock(block: SQLBlock, options: FetchSchemaOptions): Promise<{
33
- structDef: StructDef;
32
+ fetchSchemaForSQLStruct(sentence: SQLSourceDef, options: FetchSchemaOptions): Promise<{
33
+ structDef: SQLSourceDef;
34
34
  error?: undefined;
35
35
  } | {
36
36
  error: string;
@@ -40,6 +40,7 @@ export interface InfoConnection {
40
40
  * The name of the connection.
41
41
  */
42
42
  get name(): string;
43
+ get dialectName(): string;
43
44
  }
44
45
  export type ConnectionParameterValue = string | number | boolean | Array<ConnectionParameterValue>;
45
46
  export interface ConnectionParameter {
@@ -84,7 +85,6 @@ export interface Connection extends InfoConnection {
84
85
  canStream(): this is StreamingConnection;
85
86
  close(): Promise<void>;
86
87
  estimateQueryCost(sqlCommand: string): Promise<QueryRunStats>;
87
- get dialectName(): string;
88
88
  fetchMetadata: () => Promise<ConnectionMetadata>;
89
89
  fetchTableMetadata: (tablePath: string) => Promise<TableMetadata>;
90
90
  }
@@ -1,4 +1,4 @@
1
- import { Expr, Sampling, FieldAtomicTypeDef, MeasureTimeExpr, TimeTruncExpr, TimeExtractExpr, TimeDeltaExpr, TypecastExpr, RegexMatchExpr, TimeLiteralNode } from '../model/malloy_types';
1
+ import { Expr, Sampling, AtomicTypeDef, MeasureTimeExpr, TimeTruncExpr, TimeExtractExpr, TimeDeltaExpr, TypecastExpr, RegexMatchExpr, TimeLiteralNode, RecordLiteralNode, ArrayLiteralNode, LeafAtomicDef } from '../model/malloy_types';
2
2
  import { DialectFunctionOverloadDef } from './functions';
3
3
  type DialectFieldTypes = string | 'struct';
4
4
  interface DialectField {
@@ -98,6 +98,8 @@ export declare abstract class Dialect {
98
98
  abstract sqlLiteralString(literal: string): string;
99
99
  abstract sqlLiteralRegexp(literal: string): string;
100
100
  abstract sqlRegexpMatch(df: RegexMatchExpr): string;
101
+ sqlLiteralArray(lit: ArrayLiteralNode): string;
102
+ sqlLiteralRecord(lit: RecordLiteralNode): string;
101
103
  /**
102
104
  * The dialect has a chance to over-ride how expressions are translated. If
103
105
  * "undefined" is returned then the translation is left to the query translator.
@@ -116,8 +118,8 @@ export declare abstract class Dialect {
116
118
  sqlTzStr(qi: QueryInfo): string;
117
119
  sqlMakeUnnestKey(key: string, rowKey: string): string;
118
120
  sqlStringAggDistinct(distinctKey: string, valueSQL: string, separatorSQL: string): string;
119
- abstract sqlTypeToMalloyType(sqlType: string): FieldAtomicTypeDef | undefined;
120
- abstract malloyTypeToSQLType(malloyType: FieldAtomicTypeDef): string;
121
+ abstract sqlTypeToMalloyType(sqlType: string): LeafAtomicDef;
122
+ abstract malloyTypeToSQLType(malloyType: AtomicTypeDef): string;
121
123
  abstract validateTypeName(sqlType: string): boolean;
122
124
  }
123
125
  export {};
@@ -97,6 +97,17 @@ class Dialect {
97
97
  ignoreInProject(_fieldName) {
98
98
  return false;
99
99
  }
100
+ // abstract sqlLiteralRecord(lit: RecordLiteralNode): string;
101
+ // abstract sqlLiteralArray(lit: ArrayLiteralNode): string;
102
+ // SHOULD BE ABSTRACT BUT A PLACEHOLDER FOR NOW
103
+ sqlLiteralArray(lit) {
104
+ const array = lit.kids.values.map(val => val.sql);
105
+ return '[' + array.join(',') + ']';
106
+ }
107
+ sqlLiteralRecord(lit) {
108
+ const pairs = Object.entries(lit.kids).map(([propName, propVal]) => `${this.sqlMaybeQuoteIdentifier(propName)}:${propVal.sql}`);
109
+ return '{' + pairs.join(',') + '}';
110
+ }
100
111
  /**
101
112
  * The dialect has a chance to over-ride how expressions are translated. If
102
113
  * "undefined" is returned then the translation is left to the query translator.
@@ -143,6 +154,10 @@ class Dialect {
143
154
  return this.sqlLiteralNumber(df.literal);
144
155
  case 'regexpLiteral':
145
156
  return this.sqlLiteralRegexp(df.literal);
157
+ case 'recordLiteral':
158
+ return this.sqlLiteralRecord(df);
159
+ case 'arrayLiteral':
160
+ return this.sqlLiteralArray(df);
146
161
  }
147
162
  }
148
163
  sqlSumDistinct(_key, _value, _funcName) {
@@ -1,4 +1,4 @@
1
- import { Sampling, FieldAtomicTypeDef, TimeDeltaExpr, RegexMatchExpr, MeasureTimeExpr } from '../../model/malloy_types';
1
+ import { Sampling, AtomicTypeDef, TimeDeltaExpr, RegexMatchExpr, MeasureTimeExpr, LeafAtomicDef } from '../../model/malloy_types';
2
2
  import { DialectFunctionOverloadDef } from '../functions';
3
3
  import { DialectFieldList } from '../dialect';
4
4
  import { PostgresBase } from '../pg_impl';
@@ -55,8 +55,8 @@ export declare class DuckDBDialect extends PostgresBase {
55
55
  getDialectFunctions(): {
56
56
  [name: string]: DialectFunctionOverloadDef[];
57
57
  };
58
- malloyTypeToSQLType(malloyType: FieldAtomicTypeDef): string;
59
- sqlTypeToMalloyType(sqlType: string): FieldAtomicTypeDef | undefined;
58
+ malloyTypeToSQLType(malloyType: AtomicTypeDef): string;
59
+ sqlTypeToMalloyType(sqlType: string): LeafAtomicDef;
60
60
  castToString(expression: string): string;
61
61
  concat(...values: string[]): string;
62
62
  validateTypeName(sqlType: string): boolean;
@@ -283,10 +283,15 @@ class DuckDBDialect extends pg_impl_1.PostgresBase {
283
283
  return malloyType.type;
284
284
  }
285
285
  sqlTypeToMalloyType(sqlType) {
286
- var _a, _b;
286
+ var _a, _b, _c;
287
+ // Remove decimal precision
288
+ const ddbType = sqlType.replace(/^DECIMAL\(\d+,\d+\)/g, 'DECIMAL');
287
289
  // Remove trailing params
288
- const baseSqlType = (_b = (_a = sqlType.match(/^(\w+)/)) === null || _a === void 0 ? void 0 : _a.at(0)) !== null && _b !== void 0 ? _b : sqlType;
289
- return duckDBToMalloyTypes[baseSqlType.toUpperCase()];
290
+ const baseSqlType = (_b = (_a = ddbType.match(/^(\w+)/)) === null || _a === void 0 ? void 0 : _a.at(0)) !== null && _b !== void 0 ? _b : ddbType;
291
+ return ((_c = duckDBToMalloyTypes[baseSqlType.toUpperCase()]) !== null && _c !== void 0 ? _c : {
292
+ type: 'sql native',
293
+ rawType: sqlType.toLowerCase(),
294
+ });
290
295
  }
291
296
  castToString(expression) {
292
297
  return `CAST(${expression} as VARCHAR)`;
@@ -1,4 +1,4 @@
1
- import { Sampling, FieldAtomicTypeDef, TimeDeltaExpr, TypecastExpr, MeasureTimeExpr } from '../../model/malloy_types';
1
+ import { Sampling, AtomicTypeDef, TimeDeltaExpr, TypecastExpr, MeasureTimeExpr, LeafAtomicDef } from '../../model/malloy_types';
2
2
  import { DialectFunctionOverloadDef } from '../functions';
3
3
  import { DialectFieldList, QueryInfo } from '../dialect';
4
4
  import { PostgresBase } from '../pg_impl';
@@ -58,8 +58,8 @@ export declare class PostgresDialect extends PostgresBase {
58
58
  getDialectFunctions(): {
59
59
  [name: string]: DialectFunctionOverloadDef[];
60
60
  };
61
- malloyTypeToSQLType(malloyType: FieldAtomicTypeDef): string;
62
- sqlTypeToMalloyType(sqlType: string): FieldAtomicTypeDef | undefined;
61
+ malloyTypeToSQLType(malloyType: AtomicTypeDef): string;
62
+ sqlTypeToMalloyType(sqlType: string): LeafAtomicDef;
63
63
  castToString(expression: string): string;
64
64
  concat(...values: string[]): string;
65
65
  validateTypeName(sqlType: string): boolean;
@@ -340,10 +340,13 @@ class PostgresDialect extends pg_impl_1.PostgresBase {
340
340
  return malloyType.type;
341
341
  }
342
342
  sqlTypeToMalloyType(sqlType) {
343
- var _a, _b;
343
+ var _a, _b, _c;
344
344
  // Remove trailing params
345
345
  const baseSqlType = (_b = (_a = sqlType.match(/^([\w\s]+)/)) === null || _a === void 0 ? void 0 : _a.at(0)) !== null && _b !== void 0 ? _b : sqlType;
346
- return postgresToMalloyTypes[baseSqlType.trim().toLowerCase()];
346
+ return ((_c = postgresToMalloyTypes[baseSqlType.trim().toLowerCase()]) !== null && _c !== void 0 ? _c : {
347
+ type: 'sql native',
348
+ rawType: sqlType,
349
+ });
347
350
  }
348
351
  castToString(expression) {
349
352
  return `CAST(${expression} as VARCHAR)`;
@@ -1,4 +1,4 @@
1
- import { Sampling, FieldAtomicTypeDef, TimeTruncExpr, TimeExtractExpr, TimeDeltaExpr, TypecastExpr, TimeLiteralNode, MeasureTimeExpr, RegexMatchExpr } from '../../model/malloy_types';
1
+ import { Sampling, AtomicTypeDef, TimeTruncExpr, TimeExtractExpr, TimeDeltaExpr, TypecastExpr, TimeLiteralNode, MeasureTimeExpr, RegexMatchExpr, LeafAtomicDef } from '../../model/malloy_types';
2
2
  import { DialectFunctionOverloadDef } from '../functions';
3
3
  import { Dialect, DialectFieldList, QueryInfo } from '../dialect';
4
4
  export declare class SnowflakeDialect extends Dialect {
@@ -62,8 +62,8 @@ export declare class SnowflakeDialect extends Dialect {
62
62
  getDialectFunctions(): {
63
63
  [name: string]: DialectFunctionOverloadDef[];
64
64
  };
65
- malloyTypeToSQLType(malloyType: FieldAtomicTypeDef): string;
66
- sqlTypeToMalloyType(sqlType: string): FieldAtomicTypeDef | undefined;
65
+ malloyTypeToSQLType(malloyType: AtomicTypeDef): string;
66
+ sqlTypeToMalloyType(sqlType: string): LeafAtomicDef;
67
67
  castToString(expression: string): string;
68
68
  concat(...values: string[]): string;
69
69
  validateTypeName(sqlType: string): boolean;
@@ -387,7 +387,10 @@ ${(0, utils_1.indent)(sql)}
387
387
  var _a, _b;
388
388
  // Remove trailing params
389
389
  const baseSqlType = (_b = (_a = sqlType.match(/^([\w\s]+)/)) === null || _a === void 0 ? void 0 : _a.at(0)) !== null && _b !== void 0 ? _b : sqlType;
390
- return snowflakeToMalloyTypes[baseSqlType.trim().toLowerCase()];
390
+ return (snowflakeToMalloyTypes[baseSqlType.trim().toLowerCase()] || {
391
+ type: 'sql native',
392
+ rawType: sqlType,
393
+ });
391
394
  }
392
395
  castToString(expression) {
393
396
  return `TO_VARCHAR(${expression})`;
@@ -1,4 +1,4 @@
1
- import { Sampling, FieldAtomicTypeDef, TimeTruncExpr, TimeExtractExpr, TimeDeltaExpr, TypecastExpr, RegexMatchExpr, TimeLiteralNode, MeasureTimeExpr } from '../../model/malloy_types';
1
+ import { Sampling, AtomicTypeDef, TimeTruncExpr, TimeExtractExpr, TimeDeltaExpr, TypecastExpr, RegexMatchExpr, TimeLiteralNode, MeasureTimeExpr, LeafAtomicDef } from '../../model/malloy_types';
2
2
  import { DialectFunctionOverloadDef } from '../functions';
3
3
  import { Dialect, DialectFieldList, QueryInfo } from '../dialect';
4
4
  export declare class StandardSQLDialect extends Dialect {
@@ -59,8 +59,8 @@ export declare class StandardSQLDialect extends Dialect {
59
59
  getDialectFunctions(): {
60
60
  [name: string]: DialectFunctionOverloadDef[];
61
61
  };
62
- malloyTypeToSQLType(malloyType: FieldAtomicTypeDef): string;
63
- sqlTypeToMalloyType(sqlType: string): FieldAtomicTypeDef | undefined;
62
+ malloyTypeToSQLType(malloyType: AtomicTypeDef): string;
63
+ sqlTypeToMalloyType(sqlType: string): LeafAtomicDef;
64
64
  castToString(expression: string): string;
65
65
  concat(...values: string[]): string;
66
66
  validateTypeName(sqlType: string): boolean;
@@ -460,10 +460,13 @@ ${(0, utils_1.indent)(sql)}
460
460
  return malloyType.type;
461
461
  }
462
462
  sqlTypeToMalloyType(sqlType) {
463
- var _a, _b;
463
+ var _a, _b, _c;
464
464
  // Remove trailing params
465
465
  const baseSqlType = (_b = (_a = sqlType.match(/^(\w+)/)) === null || _a === void 0 ? void 0 : _a.at(0)) !== null && _b !== void 0 ? _b : sqlType;
466
- return bqToMalloyTypes[baseSqlType.toUpperCase()];
466
+ return ((_c = bqToMalloyTypes[baseSqlType.toUpperCase()]) !== null && _c !== void 0 ? _c : {
467
+ type: 'sql native',
468
+ rawType: sqlType.toLowerCase(),
469
+ });
467
470
  }
468
471
  castToString(expression) {
469
472
  return `CAST(${expression} as STRING)`;
@@ -1,4 +1,4 @@
1
- import { Expr, Sampling, FieldAtomicTypeDef, TimeDeltaExpr, TypecastExpr, RegexMatchExpr, MeasureTimeExpr, TimeLiteralNode, TimeExtractExpr } from '../../model/malloy_types';
1
+ import { Expr, Sampling, AtomicTypeDef, TimeDeltaExpr, TypecastExpr, RegexMatchExpr, MeasureTimeExpr, TimeLiteralNode, TimeExtractExpr, LeafAtomicDef } from '../../model/malloy_types';
2
2
  import { DialectFunctionOverloadDef } from '../functions';
3
3
  import { DialectFieldList, OrderByClauseType, QueryInfo } from '../dialect';
4
4
  import { PostgresBase } from '../pg_impl';
@@ -64,8 +64,8 @@ export declare class TrinoDialect extends PostgresBase {
64
64
  getDialectFunctions(): {
65
65
  [name: string]: DialectFunctionOverloadDef[];
66
66
  };
67
- malloyTypeToSQLType(malloyType: FieldAtomicTypeDef): string;
68
- sqlTypeToMalloyType(_sqlType: string): FieldAtomicTypeDef | undefined;
67
+ malloyTypeToSQLType(malloyType: AtomicTypeDef): string;
68
+ sqlTypeToMalloyType(sqlType: string): LeafAtomicDef;
69
69
  castToString(expression: string): string;
70
70
  concat(...values: string[]): string;
71
71
  sqlMakeUnnestKey(key: string, rowKey: string): string;
@@ -54,6 +54,34 @@ const trinoTypeMap = {
54
54
  'string': 'VARCHAR',
55
55
  'number': 'DOUBLE',
56
56
  };
57
+ const trinoToMalloyTypes = {
58
+ 'varchar': { type: 'string' },
59
+ 'integer': { type: 'number', numberType: 'integer' },
60
+ 'bigint': { type: 'number', numberType: 'integer' },
61
+ 'smallint': { type: 'number', numberType: 'integer' },
62
+ 'tinyint': { type: 'number', numberType: 'integer' },
63
+ 'double': { type: 'number', numberType: 'float' },
64
+ 'decimal': { type: 'number', numberType: 'float' },
65
+ 'string': { type: 'string' },
66
+ 'date': { type: 'date' },
67
+ 'timestamp': { type: 'timestamp' },
68
+ 'boolean': { type: 'boolean' },
69
+ // TODO(figutierrez0): cleanup.
70
+ /* 'INT64': {type: 'number', numberType: 'integer'},
71
+ 'FLOAT': {type: 'number', numberType: 'float'},
72
+ 'FLOAT64': {type: 'number', numberType: 'float'},
73
+ 'NUMERIC': {type: 'number', numberType: 'float'},
74
+ 'BIGNUMERIC': {type: 'number', numberType: 'float'},
75
+ 'TIMESTAMP': {type: 'timestamp'},
76
+ 'BOOLEAN': {type: 'boolean'},
77
+ 'BOOL': {type: 'boolean'},
78
+ 'JSON': {type: 'json'},*/
79
+ // TODO (https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#tablefieldschema):
80
+ // BYTES
81
+ // DATETIME
82
+ // TIME
83
+ // GEOGRAPHY
84
+ };
57
85
  class TrinoDialect extends pg_impl_1.PostgresBase {
58
86
  constructor() {
59
87
  super(...arguments);
@@ -438,9 +466,13 @@ ${(0, utils_1.indent)(sql)}
438
466
  }
439
467
  return malloyType.type;
440
468
  }
441
- sqlTypeToMalloyType(_sqlType) {
442
- // TODO(figutierrez): unimplemented.
443
- return undefined;
469
+ sqlTypeToMalloyType(sqlType) {
470
+ var _a, _b, _c;
471
+ const baseSqlType = (_b = (_a = sqlType.match(/^(\w+)/)) === null || _a === void 0 ? void 0 : _a.at(0)) !== null && _b !== void 0 ? _b : sqlType;
472
+ return ((_c = trinoToMalloyTypes[baseSqlType]) !== null && _c !== void 0 ? _c : {
473
+ type: 'sql native',
474
+ rawType: sqlType,
475
+ });
444
476
  }
445
477
  castToString(expression) {
446
478
  return `CAST(${expression} as VARCHAR)`;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { DuckDBDialect, StandardSQLDialect, PostgresDialect, SnowflakeDialect, registerDialect, arg, qtz, overload, minScalar, anyExprType, minAggregate, maxScalar, sql, makeParam, param, variadicParam, literal, spread, Dialect, } from './dialect';
1
+ export { DuckDBDialect, StandardSQLDialect, TrinoDialect, PostgresDialect, SnowflakeDialect, registerDialect, arg, qtz, overload, minScalar, anyExprType, minAggregate, maxScalar, sql, makeParam, param, variadicParam, literal, spread, Dialect, } from './dialect';
2
2
  export type { DialectFieldList, DialectFunctionOverloadDef, QueryInfo, MalloyStandardFunctionImplementations, DefinitionBlueprint, DefinitionBlueprintMap, OverloadedDefinitionBlueprint, } from './dialect';
3
- export type { QueryDataRow, StructDef, StructRelationship, NamedStructDefs, MalloyQueryData, AtomicFieldType as AtomicFieldTypeInner, DateUnit, ExtractUnit, TimestampUnit, TimeFieldType, QueryData, QueryValue, FieldTypeDef, Expr, FilterCondition, SQLBlock, FieldAtomicDef, FieldDef, PipeSegment, QueryFieldDef, IndexFieldDef, TurtleDef, SearchValueMapResult, SearchIndexResult, ModelDef, Query, QueryResult, QueryRunStats, NamedQuery, NamedModelObject, ExpressionType, FunctionDef, FunctionOverloadDef, FunctionParameterDef, ExpressionValueType, TypeDesc, FieldValueType, ExpressionTypeDesc, FunctionParamTypeDesc, DocumentLocation, DocumentRange, DocumentPosition, Sampling, Annotation, FieldAtomicTypeDef, SQLBlockStructDef, } from './model';
4
- export { Segment, isSamplingEnable, isSamplingPercent, isSamplingRows, expressionIsCalculation, indent, composeSQLExpr, } from './model';
3
+ export type { QueryDataRow, StructDef, TableSourceDef, SQLSourceDef, SourceDef, JoinFieldDef, NamedSourceDefs as NamedStructDefs, MalloyQueryData, DateUnit, ExtractUnit, TimestampUnit, TemporalFieldType as TimeFieldType, QueryData, QueryValue, Expr, FilterCondition, SQLSentence, FieldDef, PipeSegment, QueryFieldDef, IndexFieldDef, TurtleDef, SearchValueMapResult, SearchIndexResult, ModelDef, Query, QueryResult, QueryRunStats, NamedQuery, NamedModelObject, ExpressionType, FunctionDef, FunctionOverloadDef, FunctionParameterDef, ExpressionValueType, TypeDesc, FieldValueType, ExpressionTypeDesc, FunctionParamTypeDesc, DocumentLocation, DocumentRange, DocumentPosition, Sampling, Annotation, LeafAtomicDef, AtomicTypeDef, AtomicFieldDef, JoinedArrayDef, JoinedArrayTypeDef, RecordTypeDef, RepeatedRecordTypeDef, } from './model';
4
+ export { arrayEachFields, isRepeatedRecord, isSourceDef, Segment, isSamplingEnable, isSamplingPercent, isSamplingRows, expressionIsCalculation, indent, composeSQLExpr, } from './model';
5
5
  export { 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, } from './malloy';
8
- export type { PreparedQuery, Field, AtomicField, ExploreField, QueryField, SortableField, DataArray, DataRecord, DataColumn, DataArrayOrRecord, Loggable, ModelMaterializer, DocumentTablePath, DocumentSymbol, ResultJSON, PreparedResultMaterializer, SQLBlockMaterializer, ExploreMaterializer, WriteStream, SerializedExplore, DateField, TimestampField, } from './malloy';
8
+ export type { PreparedQuery, Field, AtomicField, ExploreField, QueryField, SortableField, DataArray, DataRecord, DataColumn, DataArrayOrRecord, Loggable, ModelMaterializer, DocumentTablePath, DocumentSymbol, ResultJSON, PreparedResultMaterializer, ExploreMaterializer, WriteStream, SerializedExplore, DateField, TimestampField, } from './malloy';
9
9
  export type { QueryOptionsReader, RunSQLOptions } from './run_sql_options';
10
10
  export type { EventStream, ModelString, ModelURL, QueryString, QueryURL, URLReader, } from './runtime_types';
11
11
  export type { Connection, ConnectionConfig, ConnectionFactory, ConnectionParameter, ConnectionParameterValue, ConnectionConfigSchema, FetchSchemaOptions, InfoConnection, LookupConnection, PersistSQLResults, PooledConnection, TestableConnection, StreamingConnection, } from './connection/types';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toAsyncGenerator = 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 = exports.ConnectionRuntime = exports.AtomicFieldType = exports.Runtime = exports.Malloy = exports.Model = exports.MalloyTranslator = exports.composeSQLExpr = exports.indent = exports.expressionIsCalculation = exports.isSamplingRows = exports.isSamplingPercent = exports.isSamplingEnable = exports.Segment = 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.SnowflakeDialect = exports.PostgresDialect = exports.StandardSQLDialect = exports.DuckDBDialect = void 0;
4
- exports.Tag = void 0;
3
+ 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 = exports.ConnectionRuntime = exports.AtomicFieldType = exports.Runtime = exports.Malloy = exports.Model = exports.MalloyTranslator = exports.composeSQLExpr = exports.indent = exports.expressionIsCalculation = exports.isSamplingRows = exports.isSamplingPercent = exports.isSamplingEnable = exports.Segment = exports.isSourceDef = exports.isRepeatedRecord = exports.arrayEachFields = 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.SnowflakeDialect = exports.PostgresDialect = exports.TrinoDialect = exports.StandardSQLDialect = exports.DuckDBDialect = void 0;
4
+ exports.Tag = exports.toAsyncGenerator = exports.Explore = exports.DataWriter = exports.Parse = void 0;
5
5
  /*
6
6
  * Copyright 2023 Google LLC
7
7
  *
@@ -27,6 +27,7 @@ exports.Tag = void 0;
27
27
  var dialect_1 = require("./dialect");
28
28
  Object.defineProperty(exports, "DuckDBDialect", { enumerable: true, get: function () { return dialect_1.DuckDBDialect; } });
29
29
  Object.defineProperty(exports, "StandardSQLDialect", { enumerable: true, get: function () { return dialect_1.StandardSQLDialect; } });
30
+ Object.defineProperty(exports, "TrinoDialect", { enumerable: true, get: function () { return dialect_1.TrinoDialect; } });
30
31
  Object.defineProperty(exports, "PostgresDialect", { enumerable: true, get: function () { return dialect_1.PostgresDialect; } });
31
32
  Object.defineProperty(exports, "SnowflakeDialect", { enumerable: true, get: function () { return dialect_1.SnowflakeDialect; } });
32
33
  Object.defineProperty(exports, "registerDialect", { enumerable: true, get: function () { return dialect_1.registerDialect; } });
@@ -45,6 +46,9 @@ Object.defineProperty(exports, "literal", { enumerable: true, get: function () {
45
46
  Object.defineProperty(exports, "spread", { enumerable: true, get: function () { return dialect_1.spread; } });
46
47
  Object.defineProperty(exports, "Dialect", { enumerable: true, get: function () { return dialect_1.Dialect; } });
47
48
  var model_1 = require("./model");
49
+ Object.defineProperty(exports, "arrayEachFields", { enumerable: true, get: function () { return model_1.arrayEachFields; } });
50
+ Object.defineProperty(exports, "isRepeatedRecord", { enumerable: true, get: function () { return model_1.isRepeatedRecord; } });
51
+ Object.defineProperty(exports, "isSourceDef", { enumerable: true, get: function () { return model_1.isSourceDef; } });
48
52
  // Used in Composer Demo
49
53
  Object.defineProperty(exports, "Segment", { enumerable: true, get: function () { return model_1.Segment; } });
50
54
  Object.defineProperty(exports, "isSamplingEnable", { enumerable: true, get: function () { return model_1.isSamplingEnable; } });
@@ -1,7 +1,8 @@
1
- import { IndexSegment, ProjectSegment, Query, ReduceSegment, StructDef } from '../../model/malloy_types';
1
+ import { TableSourceDef, IndexSegment, ProjectSegment, Query, ReduceSegment, StructDef, JoinFieldDef } from '../../model/malloy_types';
2
2
  export declare class ErrorFactory {
3
- static get structDef(): StructDef;
4
- static isErrorStructDef(s: StructDef): boolean;
3
+ static get structDef(): TableSourceDef;
4
+ static get joinDef(): JoinFieldDef;
5
+ static didCreate(s: StructDef | JoinFieldDef): boolean;
5
6
  static get query(): Query;
6
7
  static get reduceSegment(): ReduceSegment;
7
8
  static get projectSegment(): ProjectSegment;
@@ -23,26 +23,36 @@
23
23
  */
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.ErrorFactory = void 0;
26
- const theErrorStruct = {
27
- type: 'struct',
28
- name: '~malformed~',
29
- dialect: '~malformed~',
30
- structSource: {
31
- type: 'table',
32
- tablePath: '//undefined_error_table_path',
33
- },
34
- structRelationship: {
35
- type: 'basetable',
36
- connectionName: '//undefined_error_connection',
37
- },
38
- fields: [],
39
- };
26
+ const ERR_NAME = '~malformed~';
40
27
  class ErrorFactory {
41
28
  static get structDef() {
42
- return { ...theErrorStruct };
29
+ const factoryStruct = {
30
+ type: 'table',
31
+ name: ERR_NAME,
32
+ dialect: '~malformed~',
33
+ connection: '~unknown~',
34
+ tablePath: '//undefined_error_table_path',
35
+ fields: [],
36
+ errorFactory: true,
37
+ };
38
+ return factoryStruct;
39
+ }
40
+ static get joinDef() {
41
+ const factoryJoin = {
42
+ type: 'table',
43
+ name: ERR_NAME,
44
+ dialect: '~malformed~',
45
+ connection: '~unknown~',
46
+ tablePath: '//undefined_error_table_path',
47
+ fields: [],
48
+ join: 'one',
49
+ matrixOperation: 'left',
50
+ errorFactory: true,
51
+ };
52
+ return factoryJoin;
43
53
  }
44
- static isErrorStructDef(s) {
45
- return s.name.includes(theErrorStruct.name);
54
+ static didCreate(s) {
55
+ return s.type === 'table' && 'errorFactory' in s;
46
56
  }
47
57
  static get query() {
48
58
  return {
@@ -12,6 +12,7 @@ export declare class ConstantFieldSpace implements FieldSpace {
12
12
  lookup(_name: unknown): LookupResult;
13
13
  entries(): [string, SpaceEntry][];
14
14
  entry(): undefined;
15
+ dialectName(): string;
15
16
  dialectObj(): undefined;
16
17
  isQueryFieldSpace(): this is QueryFieldSpace;
17
18
  }
@@ -49,6 +49,9 @@ class ConstantFieldSpace {
49
49
  entry() {
50
50
  return undefined;
51
51
  }
52
+ dialectName() {
53
+ return '~constant-space-unknown-dialect~';
54
+ }
52
55
  dialectObj() {
53
56
  return undefined;
54
57
  }
@@ -1,12 +1,9 @@
1
- import { AggregateFunctionType, FieldValueType, StructRelationship } from '../../../model/malloy_types';
1
+ import { AggregateFunctionType, FieldValueType } from '../../../model/malloy_types';
2
2
  import { FieldReference } from '../query-items/field-references';
3
3
  import { ExprValue } from '../types/expr-value';
4
4
  import { ExpressionDef } from '../types/expression-def';
5
5
  import { FieldSpace } from '../types/field-space';
6
- interface JoinPathElement {
7
- name: string;
8
- structRelationship: StructRelationship;
9
- }
6
+ import { JoinPath } from '../types/lookup-result';
10
7
  export declare abstract class ExprAggregateFunction extends ExpressionDef {
11
8
  readonly func: AggregateFunctionType;
12
9
  elementType: string;
@@ -18,6 +15,5 @@ export declare abstract class ExprAggregateFunction extends ExpressionDef {
18
15
  returns(_forExpression: ExprValue): FieldValueType;
19
16
  getExpression(fs: FieldSpace): ExprValue;
20
17
  isSymmetricFunction(): boolean;
21
- getJoinUsage(fs: FieldSpace): JoinPathElement[][];
18
+ getJoinUsage(fs: FieldSpace): JoinPath[];
22
19
  }
23
- export {};