influxdata / influxdata/influxdb
[1.6.3] FIRST(),LAST() do not return the relevant timestamp with * or regex input
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
__System info:__ [InfluxDB shell version: 1.6.3, Ubuntu 16.04.5 LTS]
__Steps to reproduce:__
Using the sample data from the docs:
The following queries return the correct timestamp as expected:
```
> use NOAA_water_database
Using database NOAA_water_database
> SELECT FIRST(water_level) FROM h2o_feet WHERE location = 'santa_monica'
name: h2o_feet
time first
---- -----
2015-08-18T00:00:00Z 2.064
> SELECT LAST(water_level) FROM h2o_feet WHERE location = 'santa_monica'
name: h2o_feet
time last
---- ----
2015-09-18T21:42:00Z 4.938
```
but when using `*` or a regular expression a 1970 timestamp is returned:
```
> SELECT FIRST(/level/) FROM h2o_feet WHERE location = 'santa_monica'
name: h2o_feet
time first_level description first_water_level
---- ----------------------- -----------------
1970-01-01T00:00:00Z below 3 feet 2.064
> SELECT LAST(/level/) FROM h2o_feet WHERE location = 'santa_monica'
name: h2o_feet
time last_level description last_water_level
---- ---------------------- ----------------
1970-01-01T00:00:00Z between 3 and 6 feet 4.938
> SELECT FIRST(*) FROM h2o_feet WHERE location = 'santa_monica'
name: h2o_feet
time first_level description first_water_level
---- ----------------------- -----------------
1970-01-01T00:00:00Z below 3 feet 2.064
> SELECT LAST(*) FROM h2o_feet WHERE location = 'santa_monica'
name: h2o_feet
time last_level description last_water_level
---- ---------------------- ----------------
1970-01-01T00:00:00Z between 3 and 6 feet 4.938
```
__Additional info:__
This appears to be a subcase of issue #5890
Contributor guide
Research direction
Reproduce the four FIRST() and LAST() queries in the issue against the NOAA_water_database sample data, comparing direct field input with * and regex input. Trace the query or timestamp handling entry point responsible for aggregate results; done means wildcard and regex queries return the relevant first or last data timestamp instead of 1970-01-01T00:00:00Z, with regression coverage for these cases.
Written by the indexing model from the issue text.
Assessment
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100