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

ESQL: Fix ROUND() with unsigned longs throwing in some edge cases #119536

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ivancea
Copy link
Contributor

@ivancea ivancea commented Jan 3, 2025

There were 3 error cases with ROUND(number, decimals):

  • Decimals accepted unsigned longs, but threw a 500 with a can't process [unsigned_long -> long] in the cast evaluator
    • Fixed by improving the resolveType()
  • If the number was a BigInteger unsigned long, there were 2 cases throwing an exception:
    1. Negative decimals outside the range of integer: Error
    2. Negative decimals insie the range of integer, but "big enough" for BigInteger.TEN.pow(...) to throw a BigInteger would overflow supported range

Also, when the number is a BigInteger and the decimals is a big negative (but not big enough to throw), it may be very slow. Taking many seconds for a single computation (It tries to calculate a 10^(big number). I didn't do anything here, but I wonder if we should limit it.
It's not an "error" in any case, so this PR is limited to the 500 errors.

@ivancea ivancea added >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) auto-backport Automatically create backport pull requests when merged :Analytics/ES|QL AKA ESQL v9.0.0 v8.18.0 labels Jan 3, 2025
Copy link
Contributor

github-actions bot commented Jan 3, 2025

Documentation preview:

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@elasticsearchmachine
Copy link
Collaborator

Hi @ivancea, I've created a changelog YAML for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants