Skip to content

Commit

Permalink
fix result processing when streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
KSDaemon committed Dec 18, 2024
1 parent 070c1c9 commit 1a39a49
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/cubejs-api-gateway/src/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1953,7 +1953,14 @@ class ApiGateway {
})
);

if (!request.streaming) {
if (request.streaming) {
const r = results[0];
res(await getFinalQueryResult(
r.transformDataParams,
r.rawData.isNative ? r.rawData.getNativeRef() : r.rawData,
cleanupResult(r),
));
} else {
// We prepare the final json result on native side
const [transformDataJson, rawData, resultDataJson] = (results as {
transformDataParams: any;
Expand All @@ -1969,8 +1976,6 @@ class ApiGateway {
);

res(await getFinalQueryResultArray(transformDataJson, rawData, resultDataJson));
} else {
res(results[0]);
}
}
} catch (e: any) {
Expand Down

0 comments on commit 1a39a49

Please sign in to comment.