-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fixed bug where sum returns wrong values with long data type #6984
Fixed bug where sum returns wrong values with long data type #6984
Conversation
…null values to clean code and solve bug Signed-off-by: Matthew Wells <matthew.wells@improving.com>
Signed-off-by: Matthew Wells <matthew.wells@improving.com>
Signed-off-by: Matthew Wells <matthew.wells@improving.com>
Signed-off-by: Matthew Wells <matthew.wells@improving.com>
Signed-off-by: Matthew Wells <matthew.wells@improving.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
server/src/main/java/org/opensearch/search/aggregations/metrics/SumIntegralAggregator.java
Outdated
Show resolved
Hide resolved
…' for normal or high precision but slower summation Signed-off-by: Matthew Wells <matthew.wells@improving.com>
Gradle Check (Jenkins) Run Completed with:
|
server/src/internalClusterTest/java/org/opensearch/search/aggregations/metrics/SumLongIT.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/aggregations/metrics/SumAggregationBuilder.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/aggregations/metrics/SumAggregationBuilder.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/aggregations/metrics/SumAggregationBuilder.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/aggregations/metrics/SumAggregationBuilder.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/aggregations/metrics/SumIntegralAggregator.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/aggregations/metrics/SumNullAggregator.java
Show resolved
Hide resolved
Thanks a lot @matthewryanwells for moving it forward |
Thank you! I had some other stuff to work on but now I can focus on this now, with the optional parameter implemented (with a few updates still needed) I can fully focus on a solution that solves the bug now |
server/src/internalClusterTest/java/org/opensearch/search/aggregations/metrics/SumLongIT.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/aggregations/metrics/SumAggregationBuilder.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/aggregations/metrics/SumAggregationBuilder.java
Outdated
Show resolved
Hide resolved
server/src/internalClusterTest/java/org/opensearch/search/aggregations/metrics/SumLongIT.java
Show resolved
Hide resolved
…ional parameter, added tests, set correct default value, changed method to enum Signed-off-by: Matthew Wells <matthew.wells@improving.com>
There is still some work I need to do, specifically it seems that the precise sum aggregator is sometimes not returning the correct result but we are getting close to being done |
Gradle Check (Jenkins) Run Completed with:
|
@reta I don't know if you have any suggestions to solve this: |
@matthewryanwells I think the exact approach may look more complicated. So we have basically 3 data types (as of today): long, double and unsigned long (was recently merged). The
The Does it make sense? |
The explanation is slightly confusing for me. For this improvement to work out we would need Do you know if something like this would be possible/a reasonable thing we could implement? |
This PR is stalled because it has been open for 30 days with no activity. Remove stalled label or comment or this will be closed in 7 days. |
Apologies, @matthewryanwells, I missed your reply
I think there is a way to implement that (taking into account that the precise calculation is opt-in), but that would increase basically transfer both double and BigInteger/BigDecimal values, I will try to prototype the solution this week. |
@matthewryanwells some updates
I was hacking around and I think we could implement that by passing both
I have trouble projecting the precise sum to |
@matthewryanwells has unfortunately paused work on this because of the increased scope and experimental flags requirements. There isn't a huge use-case for the 'fix' (its becoming more of an enhancement now). Hopefully he will find some time to work on it in the near future and we can re-open the ticket. |
This PR is stalled because it has been open for 30 days with no activity. Remove stalled label or comment or this will be closed in 7 days. |
This PR was closed because it has been stalled for 7 days with no activity. |
Description
Fixes a bug regarding sum returning an incorrect value when working with large long values because the current code uses the double data type. In addition we also extracted code for checking null source into it's own class so it doesn't need to be checked for.
Issues Resolved
#5537
opensearch-project/sql#1052
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.