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

SQL: Better handling of number parsing exceptions #33776

Merged
merged 3 commits into from
Sep 18, 2018

Conversation

costin
Copy link
Member

@costin costin commented Sep 17, 2018

Add proper exceptions in case the parsing of numbers (too large, invalid
format) fails.

Close #33622

Add proper exceptions in case the parsing of numbers (too large, invalid
format) fails.
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs


public void testLiteralIntegerInvalid() throws Exception {
ParsingException ex = expectThrows(ParsingException.class, () -> parser.createExpression("123456789098765432101"));
assertEquals(ex.getErrorMessage(), "Cannot parse number [123456789098765432101]");
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be a "Number X is too large" situation?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed that - makes the parsing code a bit more ugly but the description is more accurate.

@costin costin closed this Sep 18, 2018
@costin costin deleted the fix-33622 branch September 18, 2018 08:47
@costin costin restored the fix-33622 branch September 18, 2018 08:48
@costin costin reopened this Sep 18, 2018
Copy link
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@astefan astefan left a comment

Choose a reason for hiding this comment

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

LGTM

@costin costin merged commit 91e45ca into elastic:master Sep 18, 2018
costin added a commit that referenced this pull request Sep 18, 2018
Add proper exceptions in case the parsing of numbers (too large, invalid
format) fails.

Close #33622

(cherry picked from commit 91e45ca)
@costin costin deleted the fix-33622 branch September 22, 2018 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants