Java Code Examples for org.influxdb.dto.QueryResult.Series#getValues()

The following examples show how to use org.influxdb.dto.QueryResult.Series#getValues() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InfluxDbSources.java    From hazelcast-jet-contrib with Apache License 2.0 6 votes vote down vote up
void fillBufferWithMeasurementMapping(SourceBuffer<T> sourceBuffer) {
    queue.drainTo(buffer, MAX_FILL_ELEMENTS);
    for (QueryResult result : buffer) {
        boolean done = throwExceptionIfResultWithErrorOrNull(result);
        if (done) {
            break;
        }
        for (Result internalResult : result.getResults()) {
            if (internalResult != null && internalResult.getSeries() != null) {
                for (Series s : internalResult.getSeries()) {
                    for (List<Object> objects : s.getValues()) {
                        sourceBuffer.add(
                                measurementProjection.apply(s.getName(), s.getTags(), s.getColumns(), objects));
                    }
                }
            }
        }
    }
    buffer.clear();
    if (finished && queue.isEmpty()) {
        sourceBuffer.close();
    }
}
 
Example 2
Source File: InfluxDB.java    From iotdb-benchmark with Apache License 2.0 6 votes vote down vote up
private Status executeQueryAndGetStatus(String sql) {
  LOGGER.debug("{} query SQL: {}", Thread.currentThread().getName(), sql);

  QueryResult results = influxDbInstance.query(new Query(sql, influxDbName));
  int cnt = 0;
  for (Result result : results.getResults()) {
    List<Series> series = result.getSeries();
    if (series == null) {
      continue;
    }
    if (result.getError() != null) {
      return new Status(false, cnt, new Exception(result.getError()), sql);
    }
    for (Series serie : series) {
      List<List<Object>> values = serie.getValues();
      cnt += values.size() * (serie.getColumns().size() - 1);
    }
  }

  LOGGER.debug("{} 查到数据点数: {}", Thread.currentThread().getName(), cnt);
  return new Status(true, cnt);
}