Skip to content

Commit 47f700f

Browse files
committed
fix: Cannot read 'map' property of undefined for rollupLambda in BigQuery
1 parent bacc643 commit 47f700f

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

packages/cubejs-query-orchestrator/src/orchestrator/QueryCache.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -273,25 +273,20 @@ export class QueryCache {
273273
}
274274

275275
private async csvQuery(client, q) {
276-
const tableData = await client.stream(q.query, q.values, q);
276+
const tableData = await client.downloadQueryResults(q.query, q.values, q);
277277
const headers = tableData.types.map(c => c.name);
278278
const writer = csvWriter({
279279
headers,
280280
sendHeaders: false,
281281
});
282-
const errors = [];
283-
const csvPipeline = await pipeline(tableData.rowStream, writer, (err) => {
284-
if (err) {
285-
errors.push(err);
286-
}
287-
});
288-
const lines = await streamToArray(csvPipeline);
282+
tableData.rows.forEach(
283+
row => writer.write(row)
284+
);
285+
writer.end();
286+
const lines = await streamToArray(writer);
289287
if (tableData.release) {
290288
await tableData.release();
291289
}
292-
if (errors.length > 0) {
293-
throw new Error(`Lambda query errors ${errors.join(', ')}`);
294-
}
295290
const rowCount = lines.length;
296291
const csvRows = lines.join('');
297292
return {

0 commit comments

Comments
 (0)