Skip to content

Commit

Permalink
Merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
hntd187 committed Feb 4, 2021
1 parent 0f7c976 commit 349d758
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 30 deletions.
6 changes: 0 additions & 6 deletions src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -675,11 +675,6 @@ pub enum Statement {
/// A SQL query that specifies what to explain
statement: Box<Statement>,
},
/// ANALYZE
Analyze {
/// Name of table
table_name: ObjectName,
},
}

impl fmt::Display for Statement {
Expand All @@ -705,7 +700,6 @@ impl fmt::Display for Statement {

write!(f, "{}", statement)
}
Statement::Analyze { table_name } => write!(f, "ANALYZE TABLE {}", table_name),
Statement::Query(s) => write!(f, "{}", s),
Statement::Directory {
overwrite,
Expand Down
10 changes: 0 additions & 10 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ impl<'a> Parser<'a> {
self.prev_token();
Ok(Statement::Query(Box::new(self.parse_query()?)))
}
Keyword::ANALYZE => Ok(self.parse_analyze()?),
Keyword::TRUNCATE => Ok(self.parse_truncate()?),
Keyword::MSCK => Ok(self.parse_msck()?),
Keyword::CREATE => Ok(self.parse_create()?),
Expand Down Expand Up @@ -2102,15 +2101,6 @@ 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
Expand Down
4 changes: 2 additions & 2 deletions src/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ mod tests {
Token::Whitespace(Whitespace::Space),
Token::Eq,
Token::Whitespace(Whitespace::Space),
Token::Number(String::from("1")),
Token::Number(String::from("1"), false),
];

compare(expected, tokens);
Expand Down Expand Up @@ -817,7 +817,7 @@ mod tests {
Token::Whitespace(Whitespace::Space),
Token::Eq,
Token::Whitespace(Whitespace::Space),
Token::Number(String::from("1")),
Token::Number(String::from("1"), false),
];

compare(expected, tokens);
Expand Down
12 changes: 0 additions & 12 deletions tests/sqlparser_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1639,18 +1639,6 @@ fn parse_explain_analyze_with_simple_select() {
);
}

#[test]
fn parse_simple_analyze() {
let sql = "ANALYZE TABLE t";
let stmt = verified_stmt(sql);
assert_eq!(
stmt,
Statement::Analyze {
table_name: ObjectName(vec![Ident::new("t")])
}
);
}

#[test]
fn parse_named_argument_function() {
let sql = "SELECT FUN(a => '1', b => '2') FROM foo";
Expand Down

0 comments on commit 349d758

Please sign in to comment.