@malloydata/malloy 0.0.180 → 0.0.181-dev240907212110

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.
@@ -24,6 +24,7 @@ export declare class PostgresDialect extends PostgresBase {
24
24
  supportsNesting: boolean;
25
25
  experimental: boolean;
26
26
  readsNestedData: boolean;
27
+ supportsComplexFilteredSources: boolean;
27
28
  quoteTablePath(tablePath: string): string;
28
29
  sqlGroupSetTable(groupSetCount: number): string;
29
30
  sqlAnyValue(groupSet: number, fieldName: string): string;
@@ -92,6 +92,7 @@ class PostgresDialect extends pg_impl_1.PostgresBase {
92
92
  this.supportsNesting = true;
93
93
  this.experimental = false;
94
94
  this.readsNestedData = false;
95
+ this.supportsComplexFilteredSources = false;
95
96
  }
96
97
  quoteTablePath(tablePath) {
97
98
  return tablePath
@@ -23,6 +23,7 @@ export declare class SnowflakeDialect extends Dialect {
23
23
  dontUnionIndex: boolean;
24
24
  supportsQualify: boolean;
25
25
  supportsPipelinesInViews: boolean;
26
+ supportsComplexFilteredSources: boolean;
26
27
  quoteTablePath(tablePath: string): string;
27
28
  sqlGroupSetTable(groupSetCount: number): string;
28
29
  sqlAnyValue(groupSet: number, fieldName: string): string;
@@ -96,6 +96,7 @@ class SnowflakeDialect extends dialect_1.Dialect {
96
96
  this.dontUnionIndex = false;
97
97
  this.supportsQualify = false;
98
98
  this.supportsPipelinesInViews = false;
99
+ this.supportsComplexFilteredSources = false;
99
100
  }
100
101
  // don't mess with the table pathing.
101
102
  quoteTablePath(tablePath) {
@@ -2006,16 +2006,28 @@ class QueryQuery extends QueryField {
2006
2006
  if (ji.joinFilterConditions) {
2007
2007
  conditions = ji.joinFilterConditions.map(qf => qf.generateExpression(this.rootResult));
2008
2008
  }
2009
- if (ji.children.length === 0 || conditions === undefined) {
2009
+ if (ji.children.length === 0 ||
2010
+ conditions === undefined ||
2011
+ !this.parent.dialect.supportsComplexFilteredSources) {
2012
+ // LTNOTE: need a check here to see the children's where: conditions are local
2013
+ // to the source and not to any of it's joined children.
2014
+ // In Presto, we're going to get a SQL error if in this case
2015
+ // for now. We need to inspect the 'condition' of each of the children
2016
+ // to see if they reference subchildren and blow up if they do
2017
+ // or move them to the where clause with a (x.distnct_key is NULL or (condition))
2018
+ //
2019
+ // const childrenFiltersAreComplex = somethign(conditions)
2020
+ // if (conditions && childrenFiltersAreComplex !this.parent.dialect.supportsComplexFilteredSources) {
2021
+ // throw new Error(
2022
+ // 'Cannot join a source with a complex filter on a joined source'
2023
+ // );
2024
+ // }
2010
2025
  if (conditions !== undefined && conditions.length >= 1) {
2011
2026
  filters = ` AND (${conditions.join(' AND ')})`;
2012
2027
  }
2013
2028
  s += ` ${matrixOperation} JOIN ${structSQL} AS ${ji.alias}\n ON ${onCondition}${filters}\n`;
2014
2029
  }
2015
2030
  else {
2016
- if (!this.parent.dialect.supportsComplexFilteredSources) {
2017
- throw new Error('Cannot join a source with a filter on a joined source');
2018
- }
2019
2031
  let select = `SELECT ${ji.alias}.*`;
2020
2032
  let joins = '';
2021
2033
  for (const childJoin of ji.children) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.180",
3
+ "version": "0.0.181-dev240907212110",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",