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

[BUG] TRUNCATE functions returns incorrect result #1043

Closed
Yury-Fridlyand opened this issue Nov 8, 2022 · 1 comment
Closed

[BUG] TRUNCATE functions returns incorrect result #1043

Yury-Fridlyand opened this issue Nov 8, 2022 · 1 comment
Labels

Comments

@Yury-Fridlyand
Copy link
Collaborator

What is the bug?

TRUNCATE functions returns incorrect result for some input data.

How can one reproduce the bug?

Test data:
ddouble_mapping.json.txt
ddouble.json.txt

curl -s -H 'Content-Type: application/json' -XPUT "http://localhost:9200/ddouble?pretty" -u admin:admin --insecure --data-binary @ddouble_mapping.json
curl -s -H 'Content-Type: application/json' -XPOST "http://localhost:9200/ddouble/_bulk?pretty" -u admin:admin --insecure --data-binary @ddouble.json | grep -i error
SELECT `ddouble`.`key`, `ddouble`.`val`, TRUNCATE(`ddouble`.`val`, 1) AS `EXPR$2` FROM `ddouble`

What is your host/environment?

2.x @ 21373b9

Do you have any screenshots?

image

Do you have any additional context?

Reported on behalf of @kylepbit

new BigDecimal(x.doubleValue()).setScale(y.integerValue(),
RoundingMode.DOWN).doubleValue())),

import java.math.BigDecimal
import java.math.RoundingMode

new BigDecimal(-1.2D).setScale(1, RoundingMode.DOWN).doubleValue() = -1.1
@Yury-Fridlyand Yury-Fridlyand added the bug Something isn't working label Nov 8, 2022
@Yury-Fridlyand
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants