Skip to content

Prefer #select result set over other result sets #2395

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

Merged
merged 1 commit into from
May 2, 2023
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Logger } from "../common";
import { transformBqrsResultSet } from "../pure/bqrs-cli-types";
import { AnalysisRawResults } from "./shared/analysis-result";
import { MAX_RAW_RESULTS } from "./shared/result-limits";
import { SELECT_TABLE_NAME } from "../pure/interface-types";

export async function extractRawResults(
cliServer: CodeQLCliServer,
Expand All @@ -19,11 +20,15 @@ export async function extractRawResults(
}
if (resultSets.length > 1) {
void logger.log(
"Multiple result sets found in results file. Only the first one will be used.",
"Multiple result sets found in results file. Only one will be used.",
);
}

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

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