[英]Why does InfluxDB return a List of Results on Query
Im using InfluxDB v1.8.6 with the java client.我使用带有 java 客户端的 InfluxDB v1.8.6。 And I use the following code to make queries to the database:
我使用以下代码对数据库进行查询:
public List<Result> query(String aQuery){
Query queryObject = new Query(aQuery,this.dbName);
QueryResult queryResult = this.influxDB.query(queryObject);
List<Result> resultList = queryResult.getResults();
return resultList;
}
The thing is I know QueryResult.getResults() is supposed to return a List of Results but I've never made a single query that could return more than one result and I cant see how it could.问题是我知道 QueryResult.getResults() 应该返回一个结果列表,但我从来没有做过一个可以返回多个结果的查询,而且我看不出它是怎么做到的。 This is annoying because to get my Series object I always have to iterate resultList even when I know it returns a single Result.
这很烦人,因为要获得我的 object 系列,即使我知道它返回单个结果,我也总是必须迭代 resultList。
My question is, is there a way to utilize the fact that InfluxDB.query() can return more than one result?我的问题是,有没有办法利用 InfluxDB.query() 可以返回多个结果的事实? What query would return more than one result?
什么查询会返回多个结果? I've read the documentation but I haven't found a way to return more than one Result on a single query.
我已经阅读了文档,但我还没有找到在单个查询中返回多个结果的方法。 I dont know if it matters but im using InfluxQL to write the queries and not Flux.
我不知道这是否重要,但我使用 InfluxQL 编写查询而不是 Flux。
Thank you very much!非常感谢!
Just for the record, I think I found the answer.只是为了记录,我想我找到了答案。 You can send multiple queries at once: https://docs.influxdata.com/influxdb/v1.7/guides/querying_data/#multiple-queries
您可以一次发送多个查询: https://docs.influxdata.com/influxdb/v1.7/guides/querying_data/#multiple-queries
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.