Skip to content

Commit 6de9541

Browse files
committed
Read raw result sets in compareResults
This moves reading of the result sets to the `compareResults` method since raw result sets don't need to be read for interpreted results and the `findResultSetsToCompare` method is shared between the two types of results.
1 parent 109766d commit 6de9541

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

extensions/ql-vscode/src/compare/compare-view.ts

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class CompareView extends AbstractWebview<
146146
panel.reveal(undefined, true);
147147

148148
await this.waitForPanelLoaded();
149-
const { currentResultSetDisplayName, fromResultSet, toResultSet } =
149+
const { currentResultSetDisplayName, fromResultSetName, toResultSetName } =
150150
await this.findResultSetsToCompare(
151151
this.comparePair,
152152
selectedResultSetName,
@@ -155,7 +155,11 @@ export class CompareView extends AbstractWebview<
155155
let result: RawQueryCompareResult | undefined;
156156
let message: string | undefined;
157157
try {
158-
result = this.compareResults(fromResultSet, toResultSet);
158+
result = await this.compareResults(
159+
this.comparePair,
160+
fromResultSetName,
161+
toResultSetName,
162+
);
159163
} catch (e) {
160164
message = getErrorMessage(e);
161165
}
@@ -232,7 +236,7 @@ export class CompareView extends AbstractWebview<
232236
}
233237

234238
private async findResultSetsToCompare(
235-
{ from, fromInfo, to, toInfo, commonResultSetNames }: ComparePair,
239+
{ fromInfo, toInfo, commonResultSetNames }: ComparePair,
236240
selectedResultSetName: string | undefined,
237241
) {
238242
const { currentResultSetDisplayName, fromResultSetName, toResultSetName } =
@@ -243,20 +247,10 @@ export class CompareView extends AbstractWebview<
243247
selectedResultSetName,
244248
);
245249

246-
const fromResultSet = await this.getResultSet(
247-
fromInfo.schemas,
248-
fromResultSetName,
249-
from.completedQuery.query.resultsPaths.resultsPath,
250-
);
251-
const toResultSet = await this.getResultSet(
252-
toInfo.schemas,
253-
toResultSetName,
254-
to.completedQuery.query.resultsPaths.resultsPath,
255-
);
256250
return {
257251
currentResultSetDisplayName,
258-
fromResultSet,
259-
toResultSet,
252+
fromResultSetName,
253+
toResultSetName,
260254
};
261255
}
262256

@@ -279,12 +273,23 @@ export class CompareView extends AbstractWebview<
279273
return bqrsToResultSet(schema, chunk);
280274
}
281275

282-
private compareResults(
283-
fromResults: RawResultSet,
284-
toResults: RawResultSet,
285-
): RawQueryCompareResult {
286-
// Only compare columns that have the same name
287-
return resultsDiff(fromResults, toResults);
276+
private async compareResults(
277+
{ from, fromInfo, to, toInfo }: ComparePair,
278+
fromResultSetName: string,
279+
toResultSetName: string,
280+
): Promise<RawQueryCompareResult> {
281+
const fromResultSet = await this.getResultSet(
282+
fromInfo.schemas,
283+
fromResultSetName,
284+
from.completedQuery.query.resultsPaths.resultsPath,
285+
);
286+
const toResultSet = await this.getResultSet(
287+
toInfo.schemas,
288+
toResultSetName,
289+
to.completedQuery.query.resultsPaths.resultsPath,
290+
);
291+
292+
return resultsDiff(fromResultSet, toResultSet);
288293
}
289294

290295
private async openQuery(kind: "from" | "to") {

0 commit comments

Comments
 (0)