influxdata / influxdb-client-java

InfluxDB 2 JVM Based Clients
https://influxdata.github.io/influxdb-client-java/
MIT License
430 stars 129 forks source link

Java client: SHOW SERIES return empty result #684

Closed marcinkoziarz closed 4 months ago

marcinkoziarz commented 6 months ago

Hi, During implementation of tool that needs to retrieve schema of InfluxDB 2.7, I have encountered issue where show series return empty result, although underlying CSV contains correct data.

Data retrieved underneath as CSV is in format (note that two columns are empty!):

name,tags,key
,,temperature
,,pressure

I believe issue is in line https://github.com/influxdata/influxdb-client-java/blob/master/client/src/main/java/com/influxdb/client/internal/InfluxQLQueryApiImpl.java#L129 where last line of CSV is detected incorrectly, and instead of

if (csvRecord.size() == 1 || csvRecord.get(0).equals("")) {

it should be

if (csvRecord.size() == 1 && csvRecord.get(0).equals("")) {

Steps to reproduce:

  1. Run InfluxQLQueryResult result = client.getInfluxQLQueryApi().query(new InfluxQLQuery("SHOW SERIES", "mydb"));
  2. Observe that result.getResults().size() == 1, but result.getResults().get(0).getSeries().size() == 0

Expected behavior: Object InfluxQLQueryResult should contain list of series retrieved from InfluxDB, as running SHOW SERIES from command line does it.

Actual behavior: First result from InfluxQLQueryResult has no series parsed from InfluxDB query response.

Specifications:

karel-rehor commented 4 months ago

@marcinkoziarz

Thanks for this report. This should be fixed in PR #704.