查询有差异 returns 无数据
Query with difference returns no data
我有一个使用 difference
函数的查询,我不明白为什么它 returns 没有数据。
查询是:
SELECT
difference(FIRST(grid_power_counter)) as grid_power_consumed
FROM homesolar.origin.main GROUP BY time(15m)
如果我删除差异函数它 returns 数据:
SELECT
FIRST(grid_power_counter) as grid_power_consumed
FROM homesolar.origin.main GROUP BY time(15m)
此外,如果我将 where time > now()-24h 添加到 select with difference 函数,我可以获得结果。
我真的无法理解这种行为。有人可以帮助我吗?
问: 我的查询只有在我添加 where 过滤器时才有效。为什么会这样?
引自 influxdb 的 Groupby time
文档:
Basic GROUP BY time() queries require an InfluxQL function in the
SELECT clause and a time range in the WHERE clause.
我怀疑您的第一个 DIFFERENCE
查询不起作用,因为它缺少 Groupby time(...)
函数的强制性 WHERE
过滤器。
Group by time()
子句可能没有返回任何行,因此不会。
这可能是涌入团队的 github issue,因为我认为他们的查询解析器应该向您抱怨 Group by time
.[=20= 缺少 where
过滤器]
参考文献:
https://docs.influxdata.com/influxdb/v1.5/query_language/data_exploration/#the-group-by-clause
我有一个使用 difference
函数的查询,我不明白为什么它 returns 没有数据。
查询是:
SELECT
difference(FIRST(grid_power_counter)) as grid_power_consumed
FROM homesolar.origin.main GROUP BY time(15m)
如果我删除差异函数它 returns 数据:
SELECT
FIRST(grid_power_counter) as grid_power_consumed
FROM homesolar.origin.main GROUP BY time(15m)
此外,如果我将 where time > now()-24h 添加到 select with difference 函数,我可以获得结果。
我真的无法理解这种行为。有人可以帮助我吗?
问: 我的查询只有在我添加 where 过滤器时才有效。为什么会这样?
引自 influxdb 的 Groupby time
文档:
Basic GROUP BY time() queries require an InfluxQL function in the SELECT clause and a time range in the WHERE clause.
我怀疑您的第一个 DIFFERENCE
查询不起作用,因为它缺少 Groupby time(...)
函数的强制性 WHERE
过滤器。
Group by time()
子句可能没有返回任何行,因此不会。
这可能是涌入团队的 github issue,因为我认为他们的查询解析器应该向您抱怨 Group by time
.[=20= 缺少 where
过滤器]
参考文献: https://docs.influxdata.com/influxdb/v1.5/query_language/data_exploration/#the-group-by-clause