mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-22 06:54:07 +00:00
parent
17f2930885
commit
94ff46802c
3 changed files with 37 additions and 9 deletions
|
@ -132,6 +132,7 @@ impl<'a> Parser<'a> {
|
|||
match self.next_token() {
|
||||
Token::Word(w) => match w.keyword {
|
||||
Keyword::EXPLAIN => Ok(self.parse_explain()?),
|
||||
Keyword::ANALYZE => Ok(self.parse_analyze()?),
|
||||
Keyword::SELECT | Keyword::WITH | Keyword::VALUES => {
|
||||
self.prev_token();
|
||||
Ok(Statement::Query(Box::new(self.parse_query()?)))
|
||||
|
@ -1804,6 +1805,15 @@ impl<'a> Parser<'a> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn parse_analyze(&mut self) -> Result<Statement, ParserError> {
|
||||
// ANALYZE TABLE table_name
|
||||
self.expect_keyword(Keyword::TABLE)?;
|
||||
|
||||
let table_name = self.parse_object_name()?;
|
||||
|
||||
Ok(Statement::Analyze { table_name })
|
||||
}
|
||||
|
||||
/// Parse a query expression, i.e. a `SELECT` statement optionally
|
||||
/// preceeded with some `WITH` CTE declarations and optionally followed
|
||||
/// by `ORDER BY`. Unlike some other parse_... methods, this one doesn't
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue