influxdata / influxdata/influxdb

percentile returns unexpected result

Open
#23,485 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

__Steps to reproduce:__

1. Make file with content
```
# DDL

CREATE DATABASE NOAA_water_database5

# DML

# CONTEXT-DATABASE: NOAA_water_database5

h2o_feet,location=coyote_creek water_level=9,level\ description="between 6 and 9 feet" 1566000000
h2o_feet,location=coyote_creek water_level=19,level\ description="between 6 and 9 feet" 1566000360
h2o_feet,location=coyote_creek water_level=29,level\ description="between 6 and 9 feet" 1566000720
h2o_feet,location=coyote_creek water_level=39,level\ description="between 6 and 9 feet" 1566001080
h2o_feet,location=coyote_creek water_level=49,level\ description="between 6 and 9 feet" 1566001440
h2o_feet,location=coyote_creek water_level=59,level\ description="between 6 and 9 feet" 1566001800
h2o_feet,location=coyote_creek water_level=69,level\ description="between 6 and 9 feet" 1566002160
h2o_feet,location=coyote_creek water_level=79,level\ description="between 6 and 9 feet" 1566002520
h2o_feet,location=coyote_creek water_level=89,level\ description="between 6 and 9 feet" 1566002880
h2o_feet,location=coyote_creek water_level=99,level\ description="between 6 and 9 feet" 1566003240
```
3. Load data to inlfluxdb
```
influx -ssl -host somename -username admin -password 'secret' -import -path=NOAA_data2.txt -precision=s -database=NOAA_water_database5
```
5. Open REPL
```
influx -ssl -host somename -precision rfc3339 -username admin -password 'secret' -database NOAA_water_database5
```
7. Check timeseries
```
select water_level from h2o_feet
```
9. Check percentile result
```
select percentile(water_level, 50) from h2o_feet
```

__Expected behavior:__
```
2019-08-17T00:30:00Z 59
```

__Actual behavior:__
```
2019-08-17T00:24:00Z 49
```
it's conflicting with documentation
![image](https://user-images.githubusercontent.com/36618268/175276085-3ed52c4d-d2b6-4629-86df-d4921ad39514.png)

__Environment info:__

* System info: Linux 4.18.0-240.1.1.el8_3.x86_64 x86_64
* InfluxDB version: InfluxDB v1.8.6 (git: 1.8 v1.8.6)

__Config:__
```
$ cat /etc/influxdb/influxdb.conf | egrep -v "^#|^$|^ #"
[meta]
dir = "/var/lib/influxdb/meta"
[data]
dir = "/var/lib/influxdb/data"
wal-dir = "/var/lib/influxdb/wal"
max-values-per-tag = 0
series-id-set-cache-size = 100
[coordinator]
[retention]
[shard-precreation]
[monitor]
[http]
flux-enabled = true
bind-address = ":8086"
auth-enabled = true
log-enabled = true
suppress-write-log = false
access-log-path = "/var/log/influxdb/access.log"
https-enabled = true
https-certificate = "/etc/influxdb/certs/inno.tech.crt"
https-private-key = "/etc/influxdb/certs/inno.tech.key"
[logging]
[subscriber]
[[graphite]]
[[collectd]]
[[opentsdb]]
[[udp]]
[continuous_queries]
[tls]
```
__Logs:__
None:
```
Jun 23 13:12:11 influx1 influxd[189821]: ts=2022-06-23T10:12:11.778737Z lvl=info msg="Executing query" log_id=0bEgNYH0000 service=query query="SELECT percentile(water_level, 50) FROM NOAA_water_database5.autogen.h2o_feet"

```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied InfluxDB import and SELECT percentile(water_level, 50) query with the ten values shown. Compare the returned timestamp and value with the documented expected result of 59 at 2019-08-17T00:30:00Z; done means the percentile result matches the documented behavior and a regression test covers it.

Written by the indexing model from the issue text.

Assessment

Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.