-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Merged
Merged
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
91d9df3
Catch Round UL error on big negative decimals
ivancea 5201231
Cath round exceptions and add tests for edge cases
ivancea 97de0a1
Don't allow UL as decimals value. Currently raises a 500
ivancea e8aa3ca
Format
ivancea acaa288
Update docs/changelog/119536.yaml
ivancea f3d8e6d
Format
ivancea 95380b2
Merge branch 'main' into esql-round-function-ul-fix
ivancea 0391d68
Add error cases test class
ivancea 15f6717
Updated RoundTests to check UL edge cases
ivancea 9ce3e3a
CSV tests with Ul edge cases
ivancea ea1cc59
Added max value tests for longs and integers
ivancea d81883a
[CI] Auto commit changes from spotless
elasticsearchmachine 8ad05dc
Updated VerifierTests
ivancea 5321b00
Fix another VeritiferTests test
ivancea 1416a25
Format fix
ivancea aa291bd
[CI] Auto commit changes from spotless
elasticsearchmachine f8d3651
Merge branch 'main' into esql-round-function-ul-fix
ivancea 4fd8e66
Merge branch 'main' into esql-round-function-ul-fix
ivancea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 119536 | ||
summary: Fix ROUND() with unsigned longs throwing in some edge cases | ||
area: ES|QL | ||
type: bug | ||
issues: [] |
90 changes: 90 additions & 0 deletions
90
docs/reference/esql/functions/kibana/definition/round.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 16 additions & 5 deletions
21
.../elasticsearch/xpack/esql/expression/function/scalar/math/RoundUnsignedLongEvaluator.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...st/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/RoundErrorTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.esql.expression.function.scalar.math; | ||
|
||
import org.elasticsearch.xpack.esql.core.expression.Expression; | ||
import org.elasticsearch.xpack.esql.core.tree.Source; | ||
import org.elasticsearch.xpack.esql.core.type.DataType; | ||
import org.elasticsearch.xpack.esql.expression.function.ErrorsForCasesWithoutExamplesTestCase; | ||
import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier; | ||
import org.hamcrest.Matcher; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
public class RoundErrorTests extends ErrorsForCasesWithoutExamplesTestCase { | ||
@Override | ||
protected List<TestCaseSupplier> cases() { | ||
return paramsToSuppliers(RoundTests.parameters()); | ||
} | ||
|
||
@Override | ||
protected Expression build(Source source, List<Expression> args) { | ||
return new Round(source, args.get(0), args.size() == 1 ? null : args.get(1)); | ||
} | ||
|
||
@Override | ||
protected Matcher<String> expectedTypeErrorMatcher(List<Set<DataType>> validPerPosition, List<DataType> signature) { | ||
return equalTo( | ||
typeErrorMessage( | ||
true, | ||
validPerPosition, | ||
signature, | ||
(v, p) -> p == 0 ? "numeric" : "whole number except unsigned_long or counter types" | ||
) | ||
); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍