@malloydata/malloy 0.0.33-dev230508155332 → 0.0.33

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/dist/malloy.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import { RunSQLOptions } from './run_sql_options';
3
3
  import { DocumentCompletion as DocumentCompletionDefinition, DocumentHighlight as DocumentHighlightDefinition, DocumentSymbol as DocumentSymbolDefinition, LogMessage, MalloyTranslator } from './lang';
4
4
  import { DocumentHelpContext } from './lang/parse-tree-walkers/document-help-context-walker';
5
- import { CompiledQuery, DocumentReference, FieldBooleanDef, FieldDateDef, FieldJSONDef, FieldNumberDef, FieldStringDef, FieldTimestampDef, FieldTypeDef, FilterExpression, Query as InternalQuery, ModelDef, DocumentPosition as ModelDocumentPosition, NamedQuery, QueryData, QueryDataRow, QueryResult, SQLBlock, SQLBlockStructDef, SearchIndexResult, SearchValueMapResult, StructDef, TurtleDef, FieldUnsupportedDef } from './model';
5
+ import { CompiledQuery, DocumentReference, FieldBooleanDef, FieldDateDef, FieldJSONDef, FieldNumberDef, FieldStringDef, FieldTimestampDef, FieldTypeDef, FilterExpression, Query as InternalQuery, ModelDef, DocumentPosition as ModelDocumentPosition, NamedQuery, QueryData, QueryDataRow, QueryResult, SQLBlock, SQLBlockStructDef, SearchIndexResult, SearchValueMapResult, StructDef, TurtleDef, FieldUnsupportedDef, QueryRunStats } from './model';
6
6
  import { Connection, InfoConnection, LookupConnection, ModelString, ModelURL, QueryString, QueryURL, URLReader } from './runtime_types';
7
7
  export interface Loggable {
8
8
  debug: (message?: any, ...optionalParams: any[]) => void;
@@ -1033,6 +1033,7 @@ export declare class Result extends PreparedResult {
1033
1033
  */
1034
1034
  get data(): DataArray;
1035
1035
  get totalRows(): number;
1036
+ get runStats(): QueryRunStats | undefined;
1036
1037
  toJSON(): ResultJSON;
1037
1038
  static fromJSON({ queryResult, modelDef }: ResultJSON): Result;
1038
1039
  }
package/dist/malloy.js CHANGED
@@ -215,6 +215,7 @@ class Malloy {
215
215
  sql: sqlBlock.selectStr,
216
216
  result: data.rows,
217
217
  totalRows: data.totalRows,
218
+ runStats: data.runStats,
218
219
  lastStageName: sqlBlock.name,
219
220
  // TODO feature-sql-block There is no malloy code...
220
221
  malloy: '',
@@ -234,6 +235,7 @@ class Malloy {
234
235
  ...preparedResult._rawQuery,
235
236
  result: result.rows,
236
237
  totalRows: result.totalRows,
238
+ runStats: result.runStats,
237
239
  }, preparedResult._modelDef);
238
240
  }
239
241
  else {
@@ -2025,6 +2027,9 @@ class Result extends PreparedResult {
2025
2027
  get totalRows() {
2026
2028
  return this.inner.totalRows;
2027
2029
  }
2030
+ get runStats() {
2031
+ return this.inner.runStats;
2032
+ }
2028
2033
  toJSON() {
2029
2034
  return { queryResult: this.inner, modelDef: this._modelDef };
2030
2035
  }
@@ -4,6 +4,14 @@ import { Connection } from '../runtime_types';
4
4
  import { AndChain } from './utils';
5
5
  interface TurtleDefPlus extends TurtleDef, Filtered {
6
6
  }
7
+ /** Parent from QueryStruct. */
8
+ export declare interface ParentQueryStruct {
9
+ struct: QueryStruct;
10
+ }
11
+ /** Parent from QueryModel. */
12
+ export declare interface ParentQueryModel {
13
+ model: QueryModel;
14
+ }
7
15
  interface OutputPipelinedSQL {
8
16
  sqlFieldName: string;
9
17
  pipelineSQL: string;
@@ -266,11 +274,7 @@ declare class QueryStruct extends QueryNode {
266
274
  pathAliasMap: Map<string, string>;
267
275
  dialect: Dialect;
268
276
  connectionName: string;
269
- constructor(fieldDef: StructDef, parent: {
270
- struct: QueryStruct;
271
- } | {
272
- model: QueryModel;
273
- });
277
+ constructor(fieldDef: StructDef, parent: ParentQueryStruct | ParentQueryModel);
274
278
  parameters(): Record<string, Parameter>;
275
279
  addFieldsFromFieldList(fields: FieldDef[]): void;
276
280
  getAliasIdentifier(): string;
@@ -291,11 +295,7 @@ declare class QueryStruct extends QueryNode {
291
295
  */
292
296
  resolveQueryFields(): void;
293
297
  getModel(): QueryModel;
294
- setParent(parent: {
295
- struct: QueryStruct;
296
- } | {
297
- model: QueryModel;
298
- }): void;
298
+ setParent(parent: ParentQueryStruct | ParentQueryModel): void;
299
299
  /** makes a new queryable field object from a fieldDef */
300
300
  makeQueryField(field: FieldDef): QueryField;
301
301
  /**
@@ -497,10 +497,15 @@ export declare type QueryDataRow = {
497
497
  };
498
498
  /** Returned query data. */
499
499
  export declare type QueryData = QueryDataRow[];
500
+ /** Query execution stats. */
501
+ export declare type QueryRunStats = {
502
+ queryCostBytes?: number;
503
+ };
500
504
  /** Returned Malloy query data */
501
505
  export declare type MalloyQueryData = {
502
506
  rows: QueryDataRow[];
503
507
  totalRows: number;
508
+ runStats?: QueryRunStats;
504
509
  };
505
510
  export interface DrillSource {
506
511
  sourceExplore: string;
@@ -519,6 +524,7 @@ export interface QueryResult extends CompiledQuery {
519
524
  result: QueryData;
520
525
  totalRows: number;
521
526
  error?: string;
527
+ runStats?: QueryRunStats;
522
528
  }
523
529
  export declare function isTurtleDef(def: FieldDef): def is TurtleDef;
524
530
  export interface SearchResultRow {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.33-dev230508155332",
3
+ "version": "0.0.33",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",