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

[VL][1.2] Result of cast(double as string) is inconsistent with vanilla spark #7730

Open
wForget opened this issue Oct 30, 2024 · 4 comments
Labels
bug Something isn't working triage

Comments

@wForget
Copy link
Member

wForget commented Oct 30, 2024

Backend

VL (Velox)

Bug description

sql:

create table t1 as select cast(0.000642224797047674666 as double) as c1;
select cast(c1 as string) from t1;

vanilla spark result:

6.422247970476747E-4

gluten 1.2.0 with velox result:

6.4222479704767466E-4

Spark version

Spark-3.5.x

Spark configurations

No response

System information

No response

Relevant logs

No response

@wForget wForget added bug Something isn't working triage labels Oct 30, 2024
@zhouyuan
Copy link
Contributor

This is due to the double precision issue - in short, double precision is not enough and might change(2 == 1.9999999). Is it possible to switch to decimal data type in this case?

CC @rui-mo

@wForget
Copy link
Member Author

wForget commented Oct 30, 2024

This is due to the double precision issue - in short, double precision is not enough and might change(2 == 1.9999999). Is it possible to switch to decimal data type in this case?

This issue may not be because the double precision is not enough, it happens in cast double to string, I guess it is because the precision of the double to string formatter is not aligned.

@rui-mo
Copy link
Contributor

rui-mo commented Oct 31, 2024

The related code is: https://github.com/facebookincubator/velox/blob/264ccdfcbc26f8fb56258cb7031f6cba915013ea/velox/type/Conversions.h#L562-L587. And would you like to try to reproduce it in Velox with a unit test? Thanks.

@wForget
Copy link
Member Author

wForget commented Oct 31, 2024

The related code is: https://github.com/facebookincubator/velox/blob/264ccdfcbc26f8fb56258cb7031f6cba915013ea/velox/type/Conversions.h#L562-L587. And would you like to try to reproduce it in Velox with a unit test? Thanks.

Thank you for the information, I will try to add unit test in velox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

3 participants