bux
bux

Reputation: 7739

Influxdb strange time precision usage when apply GROUP BY time()

I have a measurement with nanosecond timestamp time column:

influx -database inject -precision ns -execute "SELECT Ece_V FROM experiment_11 WHERE time >= 0 LIMIT 10"
name: experiment_11
time                Ece_V
----                -----
1495450374115174144 0.012864169
1495450374615486976 0.012692349
1495450375115709952 0.012520528
1495450375615907840 0.012262798
1495450376116103936 0.012090977
1495450376616302080 0.012348708
1495450377116500736 0.012090977
1495450377616705024 0.011919157
1495450378116929024 0.012005067
1495450378617145088 0.012176887

With -precisionparameter conversion from timestamp is correct:

influx -database inject -precision rfc3339 -execute "SELECT Ece_V FROM experiment_11 WHERE time >= 0 LIMIT 10" 
name: experiment_11
time                           Ece_V
----                           -----
2017-05-22T10:52:54.115174144Z 0.012864169
2017-05-22T10:52:54.615486976Z 0.012692349
2017-05-22T10:52:55.115709952Z 0.012520528
2017-05-22T10:52:55.61590784Z  0.012262798
2017-05-22T10:52:56.116103936Z 0.012090977
2017-05-22T10:52:56.61630208Z  0.012348708
2017-05-22T10:52:57.116500736Z 0.012090977
2017-05-22T10:52:57.616705024Z 0.011919157
2017-05-22T10:52:58.116929024Z 0.012005067
2017-05-22T10:52:58.617145088Z 0.012176887

But, if apply a GROUP BY time() result is ... weird:

influx -database inject -precision ns -execute "SELECT MEAN(Ece_V) FROM experiment_11 WHERE time >= 0 GROUP BY time(1h)"
name: experiment_11
time              mean
----              ----
0                 
3600000000000     
7200000000000     
10800000000000    
14400000000000    
18000000000000    
21600000000000    
25200000000000    
28800000000000    
32400000000000    
36000000000000    
[...]

(with rfc3339 parameter):

influx -database inject -precision rfc3339 -execute "SELECT MEAN(Ece_V) FROM experiment_11 WHERE time >= 0 GROUP BY time(1h)"
name: experiment_11
time                 mean
----                 ----
1970-01-01T00:00:00Z 
1970-01-01T01:00:00Z 
1970-01-01T02:00:00Z 
1970-01-01T03:00:00Z 
1970-01-01T04:00:00Z 
1970-01-01T05:00:00Z 
1970-01-01T06:00:00Z 
[...]

What's wrong ? How can i apply GROUP BY time() ?

Upvotes: 1

Views: 98

Answers (1)

bux
bux

Reputation: 7739

Need to use a where clause like that:

WHERE time >= 1496042437806181888 AND time <= 1496048115017701888

Upvotes: 1

Related Questions