Skip to content

Commit

Permalink
unnesting json object looks like a table
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydtabb committed Nov 29, 2024
1 parent 47c427f commit 0b0b392
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/malloy/src/dialect/mysql/mysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export class MySQLDialect extends Dialect {
const parent = parentAlias;
const child = childName;

if (parentType !== 'table') {
if (parentType !== 'table' && parentType !== 'array[record]') {
let ret = `JSON_UNQUOTE(JSON_EXTRACT(${parent},'$.${child}'))`;
if (parentType === 'array[scalar]') {
ret = `${parent}.\`value\``;
Expand Down
2 changes: 1 addition & 1 deletion test/src/databases/all/compound-atomic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ describe.each(runtimes.runtimeList)(
11 as ${quote('b')}
UNION ALL SELECT 20 , 21
""") -> { nest: ab is { select: a, b } }
-> { select: ab.a, ab.b }
-> { select: ab.a, ab.b ; order_by: a}
`).malloyResultMatches(runtime, ab_eq);
});
test('select repeated record from literal dialect functions', async () => {
Expand Down

0 comments on commit 0b0b392

Please sign in to comment.