Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor: simplify SQL number parsing and add a comment about unused #11965

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Aug 13, 2024

Which issue does this PR close?

Follow on to #11958

Rationale for this change

In discussion with @itsjunetime on #11958 I saw 2 improvements

What changes are included in this PR?

  1. Simplify number parsing (there is no need to parse a string
  2. Add comment explaining the use of allow(unused)

Are these changes tested?

By CI

Are there any user-facing changes?

No

@github-actions github-actions bot added sql SQL Planner common Related to common crate labels Aug 13, 2024
@@ -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() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

n is already a string, so calling parse on it to turn into a String always succeeds (and e is Unfallible). We can just use n directly here and save the ceremony

@alamb alamb changed the title Minor: Minor: simplioty SQL number parsing and add a comment Aug 13, 2024
@alamb alamb marked this pull request as ready for review August 13, 2024 12:47
@alamb alamb changed the title Minor: simplioty SQL number parsing and add a comment Minor: simplify SQL number parsing and add a comment Aug 13, 2024
@alamb alamb changed the title Minor: simplify SQL number parsing and add a comment Minor: simplify SQL number parsing and add a comment about unused Aug 13, 2024
Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks @alamb

@alamb alamb merged commit af75f2d into apache:main Aug 13, 2024
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Related to common crate sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants