From 78f999e0a282459f596bfc8e40bb270e73bceae6 Mon Sep 17 00:00:00 2001 From: francis-du Date: Wed, 16 Nov 2022 20:28:29 +0800 Subject: [PATCH] improve code --- src/sql/src/parser.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/sql/src/parser.rs b/src/sql/src/parser.rs index e45b0ea1a304..4222d0d29905 100644 --- a/src/sql/src/parser.rs +++ b/src/sql/src/parser.rs @@ -269,23 +269,14 @@ impl<'a> ParserContext<'a> { _ => false, }; - let explain_statement = if has_describe_alias { + let explain_statement = self.parser - .parse_explain(false) + .parse_explain(has_describe_alias) .with_context(|_| error::UnexpectedSnafu { sql: self.sql, expected: "a statement", actual: self.peek_token_as_string(), - })? - } else { - self.parser - .parse_explain(false) - .with_context(|_| error::UnexpectedSnafu { - sql: self.sql, - expected: "a statement", - actual: self.peek_token_as_string(), - })? - }; + })?; Ok(Statement::Explain(Explain::try_from(explain_statement)?)) }