From 6345682064096259a8844b054659a9fc815a342d Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:12:24 -0800 Subject: [PATCH] add error handling to stats query parser antlr (#1429) (#1434) (cherry picked from commit 50fe73206a06f63a3456627cc9dbc4172f3a4f07) Signed-off-by: Paul Sebastian Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- common/query_manager/query_parser/ppl_query_parser.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/query_manager/query_parser/ppl_query_parser.ts b/common/query_manager/query_parser/ppl_query_parser.ts index 9a39276e0c..e3acc54dd4 100644 --- a/common/query_manager/query_parser/ppl_query_parser.ts +++ b/common/query_manager/query_parser/ppl_query_parser.ts @@ -20,6 +20,12 @@ export class PPLQueryParser { 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); + } + return inter; } }