Skip to content

Commit 5ce9ba6

Browse files
edits
1 parent 3e0e552 commit 5ce9ba6

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packages/malloy/src/model/malloy_query.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2898,13 +2898,15 @@ class QueryQuery extends QueryField {
28982898
if (qs.parent === undefined || ji.parent === undefined) {
28992899
throw new Error('Internal Error, nested structure with no parent.');
29002900
}
2901-
const fieldExpression = this.parent.dialect.sqlFieldReference(
2902-
qs.parent.getSQLIdentifier(),
2903-
qsDef.name,
2904-
'struct',
2905-
qs.parent.structDef.type === 'array',
2906-
isScalarArray(this.parent.structDef)
2907-
);
2901+
const fieldExpression = hasExpression(qsDef)
2902+
? this.exprToSQL(this.rootResult, this.parent, qsDef.e)
2903+
: this.parent.dialect.sqlFieldReference(
2904+
qs.parent.getSQLIdentifier(),
2905+
qsDef.name,
2906+
'struct',
2907+
qs.parent.structDef.type === 'array',
2908+
isScalarArray(this.parent.structDef)
2909+
);
29082910
// we need to generate primary key. If parent has a primary key combine
29092911
// console.log(ji.alias, fieldExpression, this.inNestedPipeline());
29102912
s += `${this.parent.dialect.sqlUnnestAlias(

0 commit comments

Comments
 (0)