apache / apache/datafusion

Float to int cast behaviour

Open
#11,886 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

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 |
+--------+
```

Contributor guide

Open the contributing guide

Research direction

The issue provides SQL examples but names no files or tests. Start by tracing DataFusion's float-to-integer CAST handling and clarify whether rounding should be configurable or changed by default. Done when the chosen behavior is specified and covered by tests for 2.8, including the supported configuration if one is added.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
data-engineering, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.