From 92746ad40b88ffd9aa51989c9e0298ee86aaa061 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Tue, 13 Aug 2024 08:38:33 -0400 Subject: [PATCH 1/2] Simplify Number parsing --- datafusion/sql/src/parser.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/datafusion/sql/src/parser.rs b/datafusion/sql/src/parser.rs index dcb33aa7b44f..2df8d89c59bc 100644 --- a/datafusion/sql/src/parser.rs +++ b/datafusion/sql/src/parser.rs @@ -519,12 +519,7 @@ impl<'a> DFParser<'a> { Token::SingleQuotedString(s) => Ok(Value::SingleQuotedString(s)), Token::DoubleQuotedString(s) => Ok(Value::DoubleQuotedString(s)), Token::EscapedStringLiteral(s) => Ok(Value::EscapedStringLiteral(s)), - Token::Number(ref n, l) => match n.parse() { - Ok(n) => Ok(Value::Number(n, l)), - // The tokenizer should have ensured `n` is an integer - // so this should not be possible - Err(e) => match e {}, - }, + Token::Number(n, l) => Ok(Value::Number(n, l)), _ => self.parser.expected("string or numeric value", next_token), } } From 76d111dae9d26e1eeaf0a84931ff1da41685ce7d Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Tue, 13 Aug 2024 08:41:10 -0400 Subject: [PATCH 2/2] Add comment explaining unused erorr --- datafusion/common/src/error.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/datafusion/common/src/error.rs b/datafusion/common/src/error.rs index a5c2b3e55bc7..27a25d0c9dd5 100644 --- a/datafusion/common/src/error.rs +++ b/datafusion/common/src/error.rs @@ -519,6 +519,10 @@ macro_rules! make_error { } } + + // Note: Certain macros are used in this crate, but not all. + // This macro generates a use or all of them in case they are needed + // so we allow unused code to avoid warnings when they are not used #[doc(hidden)] #[allow(unused)] pub use $NAME_ERR as [<_ $NAME_ERR>];