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

Float to int cast behaviour #11886

Open
oleggator opened this issue Aug 8, 2024 · 1 comment
Open

Float to int cast behaviour #11886

oleggator opened this issue Aug 8, 2024 · 1 comment

Comments

@oleggator
Copy link

At the moment, DataFusion casts floats to integers using the floor function.
Is it possible to configure this behavior?

Actual

select cast(2.8 as int) as result;
+--------+
| result |
+--------+
| 2      |
+--------+

Expected

This way work Postgresql and MySQL.

select cast(2.8 as int) as result;
+--------+
| result |
+--------+
| 3      |
+--------+
@jayzhan211
Copy link
Contributor

I think we would need to support configuration in arrow-rs first. The actual casting is here https://github.com/apache/arrow-rs/blob/e28cf44e65cdd1fefaa1b857ca4336e7a9da5d06/arrow-cast/src/cast/mod.rs#L2177

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

No branches or pull requests

2 participants