我有一个纳秒时间戳时间列的测量值:
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
来自时间戳的-precision
参数转换是正确的:
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
但是,如果应用GROUP BY time()
结果是......很奇怪:
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
[...]
(使用rfc3339参数):
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
[...]
怎么了?我如何申请GROUP BY time()
?
答案 0 :(得分:1)
需要使用类似的where子句:
WHERE time >= 1496042437806181888 AND time <= 1496048115017701888