mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-21 14:40:18 +00:00
Fix new clippy errors (#412)
This commit is contained in:
parent
fbc1d9659b
commit
5cbf1e797a
4 changed files with 14 additions and 5 deletions
|
@ -92,7 +92,7 @@ impl fmt::Display for AlterTableOperation {
|
||||||
),
|
),
|
||||||
AlterTableOperation::AddConstraint(c) => write!(f, "ADD {}", c),
|
AlterTableOperation::AddConstraint(c) => write!(f, "ADD {}", c),
|
||||||
AlterTableOperation::AddColumn { column_def } => {
|
AlterTableOperation::AddColumn { column_def } => {
|
||||||
write!(f, "ADD COLUMN {}", column_def.to_string())
|
write!(f, "ADD COLUMN {}", column_def)
|
||||||
}
|
}
|
||||||
AlterTableOperation::AlterColumn { column_name, op } => {
|
AlterTableOperation::AlterColumn { column_name, op } => {
|
||||||
write!(f, "ALTER COLUMN {} {}", column_name, op)
|
write!(f, "ALTER COLUMN {} {}", column_name, op)
|
||||||
|
|
|
@ -1548,7 +1548,7 @@ impl fmt::Display for Privileges {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Privileges::Actions(actions) => {
|
Privileges::Actions(actions) => {
|
||||||
write!(f, "{}", display_comma_separated(actions).to_string())
|
write!(f, "{}", display_comma_separated(actions))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2649,7 +2649,7 @@ impl<'a> Parser<'a> {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Not Sure if Top should be cheked here as well. Trino doesn't support TOP.
|
// Not Sure if Top should be cheked here as well. Trino doesn't support TOP.
|
||||||
let is_l_parent = if distinct {
|
let is_l_paren = if distinct {
|
||||||
self.consume_token(&Token::LParen)
|
self.consume_token(&Token::LParen)
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
@ -2657,8 +2657,8 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
let projection = self.parse_comma_separated(Parser::parse_select_item)?;
|
let projection = self.parse_comma_separated(Parser::parse_select_item)?;
|
||||||
|
|
||||||
if is_l_parent {
|
if is_l_paren && !self.consume_token(&Token::RParen) {
|
||||||
self.consume_token(&Token::RParen);
|
return self.expected(")", self.peek_token());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that for keywords to be properly handled here, they need to be
|
// Note that for keywords to be properly handled here, they need to be
|
||||||
|
|
|
@ -343,6 +343,15 @@ fn parse_select_distinct_two_fields() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parse_select_distinct_missing_paren() {
|
||||||
|
let result = parse_sql_statements("SELECT DISTINCT (name, id FROM customer");
|
||||||
|
assert_eq!(
|
||||||
|
ParserError::ParserError("Expected ), found: FROM".to_string()),
|
||||||
|
result.unwrap_err(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_select_all() {
|
fn parse_select_all() {
|
||||||
one_statement_parses_to("SELECT ALL name FROM customer", "SELECT name FROM customer");
|
one_statement_parses_to("SELECT ALL name FROM customer", "SELECT name FROM customer");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue