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

perf: Remove parsing of integer literals #3019

Merged
merged 3 commits into from
Jun 28, 2019

Conversation

big-andy-coates
Copy link
Contributor

@big-andy-coates big-andy-coates commented Jun 27, 2019

Description

While reviewing another PR I noticed that the code in the SqlToJavaVisitor converted INT and BIGINT literals to strings and then built java code that would parse these strings when processing each row of data. This adds unnecessary overhead to the row processing and so has been replaced with just the int/long value.

Also improved error handling of numeric parsing: DOUBLEs now throw a parse exception if they result in NaN or Infinity and parse exceptions include correct location.

Testing done

Added QTT test

mvn test

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

Old code converted INT and BIGINT literals to strings and then parsed them when processing every row. This adds unnecessary overhead to the row processing and so has been replaced with just the int/long value.

Also improved error handling of numeric parsing: DOUBLEs now throw a parse exception if they result in NaN or Infinity and parse exceptions include correct location.
@big-andy-coates big-andy-coates requested a review from a team as a code owner June 27, 2019 11:25
Copy link
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

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

nice optimization :)

@agavra agavra requested a review from a team June 27, 2019 17:16
Copy link
Contributor

@rodesai rodesai left a comment

Choose a reason for hiding this comment

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

Nice! Couple of testing-related things inline.

@big-andy-coates
Copy link
Contributor Author

Why no green tick @rodesai ? I'm going to assume you meant to give one...

@big-andy-coates big-andy-coates merged commit 6195b76 into confluentinc:master Jun 28, 2019
@big-andy-coates big-andy-coates deleted the literals branch June 28, 2019 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants