@malloydata/render 0.0.123-dev240205203120 → 0.0.123-dev240207164302

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.
@@ -1355,6 +1355,9 @@
1355
1355
  case "function_parameter":
1356
1356
  case "parameter":
1357
1357
  case "outputField":
1358
+ case "source-reference":
1359
+ case "aggregate_limit":
1360
+ case "aggregate_order_by":
1358
1361
  return fragment2;
1359
1362
  case "sql-string":
1360
1363
  return {
@@ -1461,6 +1464,9 @@
1461
1464
  case "function_parameter":
1462
1465
  case "parameter":
1463
1466
  case "outputField":
1467
+ case "source-reference":
1468
+ case "aggregate_limit":
1469
+ case "aggregate_order_by":
1464
1470
  return fragment;
1465
1471
  case "function_call":
1466
1472
  return {
@@ -1534,7 +1540,7 @@
1534
1540
  }
1535
1541
  }
1536
1542
  default:
1537
- throw new Error("unexpected");
1543
+ throw new Error(`unexpected fragment type ${fragment.type}`);
1538
1544
  }
1539
1545
  });
1540
1546
  }
@@ -4386,7 +4392,7 @@ $$ LANGUAGE SQL;
4386
4392
  return `__udf${Math.floor(Math.random() * 1e5)}`;
4387
4393
  }
4388
4394
  quoteTablePath(tableName) {
4389
- return tableName.match(/\//) ? `'${tableName}'` : tableName;
4395
+ return tableName.match(/[/*:]/) ? `'${tableName}'` : tableName;
4390
4396
  }
4391
4397
  sqlGroupSetTable(groupSetCount) {
4392
4398
  return `CROSS JOIN (SELECT UNNEST(GENERATE_SERIES(0,${groupSetCount},1)) as group_set ) as group_set`;
@@ -53832,6 +53838,18 @@ QUERY: ${(0, util_1.inspect)(opDesc, { breakLength: 72, depth: Infinity })}`);
53832
53838
  static eq(good, checkThis) {
53833
53839
  return checkThis !== void 0 && good.dataType === checkThis.dataType && good.expressionType === checkThis.expressionType;
53834
53840
  }
53841
+ /**
53842
+ * Checks if a given type is in a list, ignoring aggregate
53843
+ * @param check The type to check (can be undefined)
53844
+ * @param from List of types which are OK
53845
+ */
53846
+ static typeIn(check, from) {
53847
+ if (check) {
53848
+ const found = from.find((okType) => _FT.typeEq(okType, check));
53849
+ return found !== void 0;
53850
+ }
53851
+ return false;
53852
+ }
53835
53853
  /**
53836
53854
  * Checks if the base types, ignoring aggregate, are equal
53837
53855
  * @param left Left type
@@ -55314,7 +55332,7 @@ QUERY: ${(0, util_1.inspect)(opDesc, { breakLength: 72, depth: Infinity })}`);
55314
55332
  };
55315
55333
  structPath = this.source.path;
55316
55334
  const joinUsage = this.getJoinUsage(inputFS);
55317
- const allUsagesSame = joinUsage.length === 1 || joinUsage.slice(1).every((p3) => joinPathEq(p3, joinUsage[0]));
55335
+ const allUsagesSame = joinUsage.length === 1 || joinUsage.length > 1 && joinUsage.slice(1).every((p3) => joinPathEq(p3, joinUsage[0]));
55318
55336
  if (allUsagesSame) {
55319
55337
  structPath = joinUsage[0].map((p3) => p3.name);
55320
55338
  sourceRelationship = joinUsage[0];
@@ -55456,6 +55474,13 @@ QUERY: ${(0, util_1.inspect)(opDesc, { breakLength: 72, depth: Infinity })}`);
55456
55474
  result.push(def2.relationship);
55457
55475
  }
55458
55476
  }
55477
+ } else if (frag.type === "source-reference") {
55478
+ if (frag.path) {
55479
+ const def2 = lookup6(fs, frag.path);
55480
+ result.push(def2.relationship);
55481
+ } else {
55482
+ result.push([]);
55483
+ }
55459
55484
  }
55460
55485
  }
55461
55486
  });
@@ -56313,7 +56338,7 @@ QUERY: ${(0, util_1.inspect)(opDesc, { breakLength: 72, depth: Infinity })}`);
56313
56338
  }
56314
56339
  getExpression(fs) {
56315
56340
  const expr2 = this.expr.getExpression(fs);
56316
- if (this.typeCheck(this.expr, expr2)) {
56341
+ if (fragtype_utils_1.FT.typeIn(expr2, this.legalChildTypes)) {
56317
56342
  if (expr2.value.length > 1) {
56318
56343
  return { ...expr2, dataType: "number", value: ["-(", ...expr2.value, ")"] };
56319
56344
  }