Skip to content

Commit

Permalink
Minor: simplify SQL number parsing and add a comment about unused (ap…
Browse files Browse the repository at this point in the history
…ache#11965)

* Simplify Number parsing

* Add comment explaining unused erorr
  • Loading branch information
alamb authored Aug 13, 2024
1 parent 8e23cba commit af75f2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 4 additions & 0 deletions datafusion/common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>];
Expand Down
7 changes: 1 addition & 6 deletions datafusion/sql/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}
Expand Down

0 comments on commit af75f2d

Please sign in to comment.