mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-26 23:49:10 +00:00
fix compiler warnings
This commit is contained in:
parent
4b6967ccd6
commit
661ada0664
3 changed files with 17 additions and 22 deletions
|
@ -14,15 +14,10 @@
|
||||||
|
|
||||||
//! SQL Abstract Syntax Tree (AST) types
|
//! SQL Abstract Syntax Tree (AST) types
|
||||||
//!
|
//!
|
||||||
use chrono::{
|
|
||||||
offset::{FixedOffset, TimeZone},
|
|
||||||
DateTime, NaiveDate, NaiveDateTime, NaiveTime, Utc,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub use self::sqltype::SQLType;
|
pub use self::sqltype::SQLType;
|
||||||
pub use self::table_key::{AlterOperation, Key, TableKey};
|
pub use self::table_key::{AlterOperation, Key, TableKey};
|
||||||
pub use self::value::Value;
|
pub use self::value::Value;
|
||||||
use uuid::Uuid;
|
|
||||||
|
|
||||||
pub use self::sql_operator::SQLOperator;
|
pub use self::sql_operator::SQLOperator;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use chrono::{
|
use chrono::{
|
||||||
offset::{FixedOffset, TimeZone},
|
offset::{FixedOffset},
|
||||||
DateTime, NaiveDate, NaiveDateTime, NaiveTime, Utc,
|
DateTime, NaiveDate, NaiveDateTime, NaiveTime,
|
||||||
};
|
};
|
||||||
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
|
@ -18,8 +18,8 @@ use super::dialect::Dialect;
|
||||||
use super::sqlast::*;
|
use super::sqlast::*;
|
||||||
use super::sqltokenizer::*;
|
use super::sqltokenizer::*;
|
||||||
use chrono::{
|
use chrono::{
|
||||||
offset::{FixedOffset, TimeZone},
|
offset::{FixedOffset},
|
||||||
DateTime, NaiveDate, NaiveDateTime, NaiveTime, Utc,
|
DateTime, NaiveDate, NaiveDateTime, NaiveTime,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -138,19 +138,19 @@ impl Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Token::Number(ref n) => {
|
Token::Number(_) => {
|
||||||
self.prev_token();
|
self.prev_token();
|
||||||
self.parse_sql_value()
|
self.parse_sql_value()
|
||||||
}
|
}
|
||||||
Token::String(ref s) => {
|
Token::String(_) => {
|
||||||
self.prev_token();
|
self.prev_token();
|
||||||
self.parse_sql_value()
|
self.parse_sql_value()
|
||||||
}
|
}
|
||||||
Token::SingleQuotedString(ref s) => {
|
Token::SingleQuotedString(_) => {
|
||||||
self.prev_token();
|
self.prev_token();
|
||||||
self.parse_sql_value()
|
self.parse_sql_value()
|
||||||
}
|
}
|
||||||
Token::DoubleQuotedString(ref s) => {
|
Token::DoubleQuotedString(_) => {
|
||||||
self.prev_token();
|
self.prev_token();
|
||||||
self.parse_sql_value()
|
self.parse_sql_value()
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ impl Parser {
|
||||||
|
|
||||||
/// Parse a postgresql casting style which is in the form or expr::datatype
|
/// Parse a postgresql casting style which is in the form or expr::datatype
|
||||||
pub fn parse_pg_cast(&mut self, expr: ASTNode) -> Result<ASTNode, ParserError> {
|
pub fn parse_pg_cast(&mut self, expr: ASTNode) -> Result<ASTNode, ParserError> {
|
||||||
let ast = self.consume_token(&Token::DoubleColon)?;
|
let _ = self.consume_token(&Token::DoubleColon)?;
|
||||||
let datatype = if let Ok(data_type) = self.parse_data_type() {
|
let datatype = if let Ok(data_type) = self.parse_data_type() {
|
||||||
Ok(data_type)
|
Ok(data_type)
|
||||||
} else if let Ok(table_name) = self.parse_tablename() {
|
} else if let Ok(table_name) = self.parse_tablename() {
|
||||||
|
@ -328,7 +328,7 @@ impl Parser {
|
||||||
pub fn skip_whitespace(&mut self) -> Option<Token> {
|
pub fn skip_whitespace(&mut self) -> Option<Token> {
|
||||||
loop {
|
loop {
|
||||||
match self.next_token_no_skip() {
|
match self.next_token_no_skip() {
|
||||||
Some(Token::Whitespace(ws)) => {
|
Some(Token::Whitespace(_)) => {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
token => {
|
token => {
|
||||||
|
@ -343,10 +343,10 @@ impl Parser {
|
||||||
let mut index = self.index;
|
let mut index = self.index;
|
||||||
loop {
|
loop {
|
||||||
match self.token_at(index) {
|
match self.token_at(index) {
|
||||||
Some(Token::Whitespace(ws)) => {
|
Some(Token::Whitespace(_)) => {
|
||||||
index = index + 1;
|
index = index + 1;
|
||||||
}
|
}
|
||||||
Some(token) => {
|
Some(_) => {
|
||||||
return Some(index);
|
return Some(index);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
@ -392,7 +392,7 @@ impl Parser {
|
||||||
pub fn prev_token_skip_whitespace(&mut self) -> Option<Token> {
|
pub fn prev_token_skip_whitespace(&mut self) -> Option<Token> {
|
||||||
loop {
|
loop {
|
||||||
match self.prev_token_no_skip() {
|
match self.prev_token_no_skip() {
|
||||||
Some(Token::Whitespace(ws)) => {
|
Some(Token::Whitespace(_)) => {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
token => {
|
token => {
|
||||||
|
@ -581,7 +581,7 @@ impl Parser {
|
||||||
|
|
||||||
pub fn parse_alter(&mut self) -> Result<ASTNode, ParserError> {
|
pub fn parse_alter(&mut self) -> Result<ASTNode, ParserError> {
|
||||||
if self.parse_keyword("TABLE") {
|
if self.parse_keyword("TABLE") {
|
||||||
let is_only = self.parse_keyword("ONLY");
|
let _ = self.parse_keyword("ONLY");
|
||||||
let table_name = self.parse_tablename()?;
|
let table_name = self.parse_tablename()?;
|
||||||
let operation: Result<AlterOperation, ParserError> =
|
let operation: Result<AlterOperation, ParserError> =
|
||||||
if self.parse_keywords(vec!["ADD", "CONSTRAINT"]) {
|
if self.parse_keywords(vec!["ADD", "CONSTRAINT"]) {
|
||||||
|
@ -627,7 +627,7 @@ impl Parser {
|
||||||
};
|
};
|
||||||
self.parse_keyword("FROM");
|
self.parse_keyword("FROM");
|
||||||
self.parse_keyword("STDIN");
|
self.parse_keyword("STDIN");
|
||||||
self.consume_token(&Token::SemiColon);
|
self.consume_token(&Token::SemiColon)?;
|
||||||
let values = self.parse_tsv()?;
|
let values = self.parse_tsv()?;
|
||||||
Ok(ASTNode::SQLCopy {
|
Ok(ASTNode::SQLCopy {
|
||||||
table_name,
|
table_name,
|
||||||
|
@ -724,7 +724,7 @@ impl Parser {
|
||||||
Token::DoubleQuotedString(ref s) => {
|
Token::DoubleQuotedString(ref s) => {
|
||||||
Ok(Value::DoubleQuotedString(s.to_string()))
|
Ok(Value::DoubleQuotedString(s.to_string()))
|
||||||
}
|
}
|
||||||
other => parser_err!(format!("Unsupported value: {:?}", self.peek_token())),
|
_ => parser_err!(format!("Unsupported value: {:?}", self.peek_token())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => parser_err!("Expecting a value, but found EOF"),
|
None => parser_err!("Expecting a value, but found EOF"),
|
||||||
|
@ -827,7 +827,7 @@ impl Parser {
|
||||||
let min = self.parse_literal_int()?;
|
let min = self.parse_literal_int()?;
|
||||||
self.consume_token(&Token::Colon)?;
|
self.consume_token(&Token::Colon)?;
|
||||||
let sec = self.parse_literal_double()?;
|
let sec = self.parse_literal_double()?;
|
||||||
let ms = (sec.fract() * 1000.0).round();
|
let _ = (sec.fract() * 1000.0).round();
|
||||||
if let Ok(true) = self.consume_token(&Token::Period) {
|
if let Ok(true) = self.consume_token(&Token::Period) {
|
||||||
let ms = self.parse_literal_int()?;
|
let ms = self.parse_literal_int()?;
|
||||||
Ok(NaiveTime::from_hms_milli(
|
Ok(NaiveTime::from_hms_milli(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue