@malloydata/malloy 0.0.271 → 0.0.272

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/api/core.js CHANGED
@@ -437,6 +437,21 @@ function statedCompileQuery(state) {
437
437
  const modelAnnotations = (0, annotation_1.annotationToTaglines)(result.modelDef.annotation).map(l => ({
438
438
  value: l,
439
439
  }));
440
+ let source;
441
+ if (query.compositeResolvedSourceDef) {
442
+ source = query.compositeResolvedSourceDef;
443
+ }
444
+ else {
445
+ if ((0, model_1.refIsStructDef)(query.structRef)) {
446
+ source = query.structRef;
447
+ }
448
+ else {
449
+ source = result.modelDef.contents[query.structRef];
450
+ }
451
+ }
452
+ const sourceAnnotations = (0, annotation_1.annotationToTaglines)(source.annotation).map(l => ({
453
+ value: l,
454
+ }));
440
455
  annotations.push({
441
456
  value: malloy_tag_1.Tag.withPrefix('#(malloy) ')
442
457
  .set(['source_name'], translatedQuery.sourceExplore)
@@ -454,9 +469,10 @@ function statedCompileQuery(state) {
454
469
  sql: translatedQuery.sql,
455
470
  schema,
456
471
  connection_name: translatedQuery.connectionName,
457
- annotations: annotations.length > 0 ? annotations : undefined,
458
- model_annotations: modelAnnotations.length > 0 ? modelAnnotations : undefined,
472
+ annotations: annotationsOrUndefined(annotations),
473
+ model_annotations: annotationsOrUndefined(modelAnnotations),
459
474
  query_timezone: translatedQuery.queryTimezone,
475
+ source_annotations: annotationsOrUndefined(sourceAnnotations),
460
476
  },
461
477
  default_row_limit_added: translatedQuery.defaultRowLimitAdded,
462
478
  };
@@ -480,4 +496,7 @@ function statedCompileQuery(state) {
480
496
  }
481
497
  }
482
498
  exports.statedCompileQuery = statedCompileQuery;
499
+ function annotationsOrUndefined(annotations) {
500
+ return annotations.length > 0 ? annotations : undefined;
501
+ }
483
502
  //# sourceMappingURL=core.js.map
@@ -363,5 +363,26 @@ exports.PRESTO_DIALECT_FUNCTIONS = {
363
363
  ...(0, util_1.def)('array_sort_desc', { 'x': { array: T } }, { array: T }),
364
364
  ...(0, util_1.def)('remove_nulls', { 'x': { array: T } }, { array: T }),
365
365
  ...(0, util_1.def)('array_top_n', { 'x': { array: T }, 'n': 'number' }, { array: T }),
366
+ // presto with more parameters
367
+ hll_accumulate: {
368
+ default: {
369
+ takes: { 'value': { dimension: T } },
370
+ returns: { measure: { sql_native: 'hyperloglog' } },
371
+ generic: {
372
+ 'T': ['string', 'number', 'date', 'timestamp', 'boolean', 'json'],
373
+ },
374
+ isSymmetric: true,
375
+ impl: { sql: 'APPROX_SET(${value}, 0.0040625)' },
376
+ },
377
+ with_percent: {
378
+ takes: { 'value': { dimension: T }, 'accuracy': 'number' },
379
+ returns: { measure: { sql_native: 'hyperloglog' } },
380
+ generic: {
381
+ 'T': ['string', 'number', 'date', 'timestamp', 'boolean', 'json'],
382
+ },
383
+ isSymmetric: true,
384
+ impl: { sql: 'APPROX_SET(${value}, 0.0040625)' },
385
+ },
386
+ },
366
387
  };
367
388
  //# sourceMappingURL=dialect_functions.js.map
@@ -81,10 +81,16 @@ sources) {
81
81
  abort();
82
82
  continue overSources;
83
83
  }
84
- base = { ...resolveInner.success };
84
+ base = {
85
+ ...resolveInner.success,
86
+ annotation: composeAnnotations(base.annotation, resolveInner.success.annotation),
87
+ };
85
88
  }
86
89
  else {
87
- base = { ...inputSource };
90
+ base = {
91
+ ...inputSource,
92
+ annotation: composeAnnotations(base.annotation, inputSource.annotation),
93
+ };
88
94
  }
89
95
  const fields = [...nonCompositeFields, ...base.fields];
90
96
  base = {
@@ -219,6 +225,20 @@ function categorizeFieldUsage(fieldUsage) {
219
225
  }
220
226
  return categorized;
221
227
  }
228
+ function composeAnnotations(base, slice) {
229
+ var _a, _b, _c, _d;
230
+ if (base === undefined)
231
+ return slice;
232
+ if (slice === undefined)
233
+ return base;
234
+ const notes = [...((_a = base.notes) !== null && _a !== void 0 ? _a : []), ...((_b = slice.notes) !== null && _b !== void 0 ? _b : [])];
235
+ const blockNotes = [...((_c = base.blockNotes) !== null && _c !== void 0 ? _c : []), ...((_d = slice.blockNotes) !== null && _d !== void 0 ? _d : [])];
236
+ return {
237
+ inherits: composeAnnotations(base.inherits, slice.inherits),
238
+ notes: notes.length === 0 ? undefined : notes,
239
+ blockNotes: blockNotes.length === 0 ? undefined : blockNotes,
240
+ };
241
+ }
222
242
  function mergeFields(...fields) {
223
243
  var _a;
224
244
  const fieldsByName = {};
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const MALLOY_VERSION = "0.0.271";
1
+ export declare const MALLOY_VERSION = "0.0.272";
package/dist/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MALLOY_VERSION = void 0;
4
4
  // generated with 'generate-version-file' script; do not edit manually
5
- exports.MALLOY_VERSION = '0.0.271';
5
+ exports.MALLOY_VERSION = '0.0.272';
6
6
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.271",
3
+ "version": "0.0.272",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -41,9 +41,9 @@
41
41
  "generate-version-file": "VERSION=$(npm pkg get version --workspaces=false | tr -d \\\")\necho \"// generated with 'generate-version-file' script; do not edit manually\\nexport const MALLOY_VERSION = '$VERSION';\" > src/version.ts"
42
42
  },
43
43
  "dependencies": {
44
- "@malloydata/malloy-filter": "^0.0.271",
45
- "@malloydata/malloy-interfaces": "^0.0.271",
46
- "@malloydata/malloy-tag": "^0.0.271",
44
+ "@malloydata/malloy-filter": "0.0.272",
45
+ "@malloydata/malloy-interfaces": "0.0.272",
46
+ "@malloydata/malloy-tag": "0.0.272",
47
47
  "antlr4ts": "^0.5.0-alpha.4",
48
48
  "assert": "^2.0.0",
49
49
  "jaro-winkler": "^0.2.8",