This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new af75f2d510 Minor: simplify SQL number parsing and add a comment about
unused (#11965)
af75f2d510 is described below
commit af75f2d51067d8a6b0d3279a8c5cab36d6096e37
Author: Andrew Lamb <[email protected]>
AuthorDate: Tue Aug 13 14:23:12 2024 -0400
Minor: simplify SQL number parsing and add a comment about unused (#11965)
* Simplify Number parsing
* Add comment explaining unused erorr
---
datafusion/common/src/error.rs | 4 ++++
datafusion/sql/src/parser.rs | 7 +------
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/datafusion/common/src/error.rs b/datafusion/common/src/error.rs
index a5c2b3e55b..27a25d0c9d 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>];
diff --git a/datafusion/sql/src/parser.rs b/datafusion/sql/src/parser.rs
index dcb33aa7b4..2df8d89c59 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),
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]