Skip to content

Commit 14eb7ff

Browse files
authored
Merge pull request #2395 from github/koesie10/bqrs-use-select
Prefer `#select` result set over other result sets
2 parents 467e5ce + 36be323 commit 14eb7ff

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

extensions/ql-vscode/src/variant-analysis/bqrs-processing.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Logger } from "../common";
33
import { transformBqrsResultSet } from "../pure/bqrs-cli-types";
44
import { AnalysisRawResults } from "./shared/analysis-result";
55
import { MAX_RAW_RESULTS } from "./shared/result-limits";
6+
import { SELECT_TABLE_NAME } from "../pure/interface-types";
67

78
export async function extractRawResults(
89
cliServer: CodeQLCliServer,
@@ -19,11 +20,15 @@ export async function extractRawResults(
1920
}
2021
if (resultSets.length > 1) {
2122
void logger.log(
22-
"Multiple result sets found in results file. Only the first one will be used.",
23+
"Multiple result sets found in results file. Only one will be used.",
2324
);
2425
}
2526

26-
const schema = resultSets[0];
27+
// Always prefer #select over any other result set. #select is usually the result the user
28+
// wants to see since it contains the outer #select.
29+
const schema =
30+
resultSets.find((resultSet) => resultSet.name === SELECT_TABLE_NAME) ??
31+
resultSets[0];
2732

2833
const chunk = await cliServer.bqrsDecode(filePath, schema.name, {
2934
pageSize: MAX_RAW_RESULTS,

0 commit comments

Comments
 (0)