Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trino: more test fixes. #1705

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
empty structures should still have columns
  • Loading branch information
lloydtabb committed Apr 3, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit b50098c6a53ab207c436d178ebb06f9a4a1c0b97
8 changes: 5 additions & 3 deletions packages/malloy-db-trino/src/trino_connection.ts
Original file line number Diff line number Diff line change
@@ -256,20 +256,21 @@ export class TrinoConnection implements Connection, PersistSQLResults {
convertRow(structDef: StructDef, row: unknown[]) {
const col = {};
for (let i = 0; i < structDef.fields.length; i++) {
col[structDef.fields[i].name] = row[i];
col[structDef.fields[i].name] = row[i] === undefined ? null : row[i];
}
return col;
}

convertNest(structDef: StructDef, dataRows: unknown[][]) {
const rows = dataRows === null || dataRows === undefined ? [] : dataRows;
const ret: unknown[] = [];
if (
structDef.structRelationship.type === 'nested' &&
!structDef.structRelationship.isArray
) {
return this.convertRow(structDef, dataRows);
return this.convertRow(structDef, rows);
}
for (const row of dataRows) {
for (const row of rows) {
ret.push(this.convertRow(structDef, row));
}
return ret;
@@ -300,6 +301,7 @@ export class TrinoConnection implements Connection, PersistSQLResults {
// Debugging types
// const _x = queryResult.value.columns.map(c => console.log(c.type));
// console.log(JSON.stringify(malloyColumns, null, 2));
// console.log(JSON.stringify(queryResult.value.data, null, 2));

let maxRows = options.rowLimit ?? 50;
const malloyRows: QueryDataRow[] = [];
Loading