influxdata / influxdata/influxdb
Problem when using offset in subquery
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
Hello!
I have the following values stored in my database:
02/01/2020 08:00:00: 5
02/01/2020 08:15:00: 5
02/01/2020 08:30:00: 5
02/01/2020 08:45:00: 5
\ = time >= 1580541300000ms AND time <= 1580542200000ms AND field1 > XXX AND tag1 = 'XXX' AND tag2 = 'XXX' AND tag3 = 'XXX' AND tag4 = 'XXX' AND tag5 = 'XXX' AND field2 <> 'XXX'
The where clause is no problem, just that i mentioned it here.
With:
SELECT MEAN(value) AS value FROM "XXX"."XXX"."value" WHERE \ GROUP BY time(60000ms),"tag1","tag2","tag3","tag4","tag5" fill(0);
I correctly get:
02/01/2020 08:15:00: 5
02/01/2020 08:16:00: 0
02/01/2020 08:17:00: 0
02/01/2020 08:18:00: 0
02/01/2020 08:19:00: 0
02/01/2020 08:20:00: 0
02/01/2020 08:21:00: 0
02/01/2020 08:22:00: 0
02/01/2020 08:23:00: 0
02/01/2020 08:24:00: 0
02/01/2020 08:25:00: 0
02/01/2020 08:26:00: 0
02/01/2020 08:27:00: 0
02/01/2020 08:28:00: 0
02/01/2020 08:29:00: 0
02/01/2020 08:30:00: 5
With:
SELECT COUNT(value) AS value FROM (SELECT MEAN(value) AS value FROM "XXX"."XXX"."value" WHERE \ GROUP BY time(60000ms),"tag1","tag2","tag3","tag4","tag5" fill(0)) WHERE time >= 1580541300000ms AND time <= 1580542200000ms;
I correctly get:
02/01/2020 08:15:00: 16
With:
SELECT MEAN(value) AS value FROM "XXX"."XXX"."value" WHERE \ GROUP BY time(60000ms,1000ms),"tag1","tag2","tag3","tag4","tag5" fill(0);
I correctly get:
02/01/2020 08:14:01: 5
02/01/2020 08:15:01: 0
02/01/2020 08:16:01: 0
02/01/2020 08:17:01: 0
02/01/2020 08:18:01: 0
02/01/2020 08:19:01: 0
02/01/2020 08:20:01: 0
02/01/2020 08:21:01: 0
02/01/2020 08:22:01: 0
02/01/2020 08:23:01: 0
02/01/2020 08:24:01: 0
02/01/2020 08:25:01: 0
02/01/2020 08:26:01: 0
02/01/2020 08:27:01: 0
02/01/2020 08:28:01: 0
02/01/2020 08:29:01: 5
But with:
SELECT COUNT(value) AS value FROM (SELECT MEAN(value) AS value FROM "XXX"."XXX"."value" WHERE \ GROUP BY time(60000ms,1000ms),"tag1","tag2","tag3","tag4","tag5" fill(0)) WHERE time >= 1580541300000ms AND time <= 1580542200000ms;
I get no results! I would have expected to get a count of 15.
Did i something wrong here?
I am running influxdb 1.7.7 on Windows.
The queries where tested with chronograph 1.7.14.
Greetings
Michael
Contributor guide
Research direction
Reproduce the two subquery examples against InfluxDB 1.7.7, comparing the unshifted and offset time-grouping cases. Start by investigating how the outer time filter is applied to grouped subquery results; done means the empty-result behavior is explained and a verified correction or documented limitation is established.
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
- Needs clarification
- Newbie friendliness
- 25/100