influxdata / influxdb-java

Java client for InfluxDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SelectionQueryImpl should support buildQueryString

kondubhSICKAG opened this issue · comments

If I want to create a query using dynamic selections, for example say from UI we received a request for aggregate function
List functions; which as max,min for columns "test1". This list of functions can be dynamic. Now I cannot use query build to build a query dynamically. SelectionQueryImpl can be used but this cannot generate a string, Is there a work around? or is there a way that i can build select query dynamically when using aggregate functions?

SelectionQueryImpl selection= select();
selection.column(searchFilter.getName().get(0)).function(searchFilter.getFunctions().get(0).toString());
selection.function("mean", searchFilter.getName().get(0));
selection.function("min", searchFilter.getName().get(0));
selection.from(bucket,(ObjectUtils.isNotEmpty(searchFilter.getType()))? searchFilter.getType().stream().toArray(String[]::new): new String[0]);