influxdata / influxdata/influxdb
Rounding Problem on toInt()
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
The toInt() function rounds everything down. So for example a value of 4.8 will appear as 4 instead of 5.
__Steps to reproduce:__
List the minimal actions needed to reproduce the behavior.
1. Simply use the toInt() in a query
__Expected behavior:__
I expect floating point numbers with more than 0.5 in the decimal point to be rounded up and others with less than that to be rounded down.
__Actual behavior:__
All results are rounded down.
__Environment info:__
* System info: Linux 5.9.16-1-MANJARO x86_64
* InfluxDB version:Version 2.0.5 ('7c3ead)
* Other relevant environment details: Container runtime, disk info, etc
__Config:__
Copy any non-default config values here or attach the full config as a gist or file.
__Logs:__
Include snippet of errors in log.
__Performance:__
Generate profiles with the following commands for bugs related to performance, locking, out of memory (OOM), etc.
```sh
# Commands should be run when the bug is actively happening.
# Note: This command will run for ~30 seconds.
curl -o profiles.tar.gz "http://localhost:8086/debug/pprof/all?cpu=30s"
iostat -xd 1 30 > iostat.txt
# Attach the `profiles.tar.gz` and `iostat.txt` output files.
```
Contributor guide
Research direction
Start by reproducing the reported toInt() behavior in an InfluxDB query using values such as 4.8 and values below 0.5. Locate the implementation behind the query function and add regression coverage; done means values above the halfway point round up while lower fractional values round down.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100