@malloydata/malloy 0.0.94-dev231006134059 → 0.0.94-dev231007180531

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.
@@ -37,6 +37,7 @@ export declare abstract class Dialect {
37
37
  abstract supportsQualify: boolean;
38
38
  abstract supportsSafeCast: boolean;
39
39
  abstract supportsNesting: boolean;
40
+ cantPartitionWindowFunctionsOnExpressions: boolean;
40
41
  abstract getGlobalFunctionDef(name: string): DialectFunctionOverloadDef[] | undefined;
41
42
  abstract quoteTablePath(tablePath: string): string;
42
43
  abstract sqlGroupSetTable(groupSetCount: number): string;
@@ -52,6 +52,13 @@ function qtz(qi) {
52
52
  }
53
53
  exports.qtz = qtz;
54
54
  class Dialect {
55
+ constructor() {
56
+ // -- we should add flags with default values from now on so as to not break
57
+ // dialects outside our repository
58
+ //
59
+ // StandardSQL dialects can't partition on expression in window functions
60
+ this.cantPartitionWindowFunctionsOnExpressions = false;
61
+ }
55
62
  sqlFinalStage(_lastStageName, _fields) {
56
63
  throw new Error('Dialect has no final Stage but called Anyway');
57
64
  }
@@ -20,6 +20,7 @@ export declare class StandardSQLDialect extends Dialect {
20
20
  supportsQualify: boolean;
21
21
  supportsSafeCast: boolean;
22
22
  supportsNesting: boolean;
23
+ cantPartitionWindowFunctionsOnExpressions: boolean;
23
24
  quoteTablePath(tablePath: string): string;
24
25
  sqlGroupSetTable(groupSetCount: number): string;
25
26
  sqlAnyValue(groupSet: number, fieldName: string): string;
@@ -92,6 +92,7 @@ class StandardSQLDialect extends dialect_1.Dialect {
92
92
  this.supportsQualify = true;
93
93
  this.supportsSafeCast = true;
94
94
  this.supportsNesting = true;
95
+ this.cantPartitionWindowFunctionsOnExpressions = true;
95
96
  this.keywords = `
96
97
  ALL
97
98
  AND
@@ -1476,7 +1476,7 @@ class QueryQuery extends QueryField {
1476
1476
  for (const expr of e) {
1477
1477
  if ((0, malloy_types_1.isFunctionCallFragment)(expr) &&
1478
1478
  (0, malloy_types_1.expressionIsAnalytic)(expr.overload.returnType.expressionType) &&
1479
- this.parent.dialect.name === 'standardsql') {
1479
+ this.parent.dialect.cantPartitionWindowFunctionsOnExpressions) {
1480
1480
  // force the use of a lateral_join_bag
1481
1481
  resultStruct.root().isComplexQuery = true;
1482
1482
  resultStruct.root().queryUsesPartitioning = true;
@@ -2060,7 +2060,7 @@ class QueryQuery extends QueryField {
2060
2060
  if (fi.fieldUsage.type === 'result') {
2061
2061
  const exp = fi.getSQL();
2062
2062
  if (isScalarField(fi.f)) {
2063
- if (this.parent.dialect.name === 'standardsql' &&
2063
+ if (this.parent.dialect.cantPartitionWindowFunctionsOnExpressions &&
2064
2064
  this.rootResult.queryUsesPartitioning) {
2065
2065
  // BigQuery can't partition aggregate function except when the field has no
2066
2066
  // expression. Additionally it can't partition by floats. We stuff expressions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.94-dev231006134059",
3
+ "version": "0.0.94-dev231007180531",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",