mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
cargo fmt
This commit is contained in:
parent
dc97d8ef5d
commit
7bea9a8648
4 changed files with 7 additions and 17 deletions
|
@ -3,13 +3,12 @@ extern crate sqlparser;
|
|||
use sqlparser::sqlparser::*;
|
||||
|
||||
fn main() {
|
||||
|
||||
let sql = "SELECT a, b, 123, myfunc(b) \
|
||||
FROM table_1 \
|
||||
WHERE a > b AND b < 100 \
|
||||
ORDER BY a DESC, b";
|
||||
FROM table_1 \
|
||||
WHERE a > b AND b < 100 \
|
||||
ORDER BY a DESC, b";
|
||||
|
||||
let ast = Parser::parse_sql(sql.to_string()).unwrap();
|
||||
|
||||
println!("AST: {:?}", ast);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,6 @@ pub enum SQLType {
|
|||
Time,
|
||||
/// Timestamp
|
||||
Timestamp,
|
||||
|
||||
}
|
||||
|
||||
/// SQL Operator
|
||||
|
|
|
@ -309,7 +309,6 @@ impl Parser {
|
|||
true
|
||||
}
|
||||
|
||||
|
||||
//TODO: this function is inconsistent and sometimes returns bool and sometimes fails
|
||||
|
||||
/// Consume the next token if it matches the expected token, otherwise return an error
|
||||
|
@ -383,10 +382,7 @@ impl Parser {
|
|||
}
|
||||
}
|
||||
|
||||
Ok(ASTNode::SQLCreateTable {
|
||||
name: id,
|
||||
columns,
|
||||
})
|
||||
Ok(ASTNode::SQLCreateTable { name: id, columns })
|
||||
}
|
||||
_ => parser_err!(format!(
|
||||
"Unexpected token after CREATE EXTERNAL TABLE: {:?}",
|
||||
|
@ -802,10 +798,7 @@ mod tests {
|
|||
);
|
||||
let ast = parse_sql(&sql);
|
||||
match ast {
|
||||
ASTNode::SQLCreateTable {
|
||||
name,
|
||||
columns,
|
||||
} => {
|
||||
ASTNode::SQLCreateTable { name, columns } => {
|
||||
assert_eq!("uk_cities", name);
|
||||
assert_eq!(3, columns.len());
|
||||
|
||||
|
|
|
@ -166,8 +166,7 @@ impl Tokenizer {
|
|||
.filter(|t| match t {
|
||||
Token::Whitespace => false,
|
||||
_ => true,
|
||||
})
|
||||
.collect())
|
||||
}).collect())
|
||||
}
|
||||
|
||||
/// Get the next token or return None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue