Skip to content
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

[Backport 2.x] fix explorer stats function typing crash #1434

Merged
merged 1 commit into from
Feb 13, 2024
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
8 changes: 7 additions & 1 deletion common/query_manager/query_parser/ppl_query_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

export class PPLQueryParser {
parser: OpenSearchPPLParser | null = null;
visitor: any = null;

Check warning on line 12 in common/query_manager/query_parser/ppl_query_parser.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
rawQuery: string = '';

parse(pplQuery: string) {
Expand All @@ -20,6 +20,12 @@

getStats() {
this.visitor = new StatsAstBuilder();
return this.visitor.visitRoot(this.parser!.root()).getTokens();
let inter = null;
try {
inter = this.visitor.visitRoot(this.parser!.root()).getTokens();
} catch (e) {
console.error(e);

Check warning on line 27 in common/query_manager/query_parser/ppl_query_parser.ts

View check run for this annotation

Codecov / codecov/patch

common/query_manager/query_parser/ppl_query_parser.ts#L27

Added line #L27 was not covered by tests
}
return inter;
}
}
Loading