All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.simplaex.clients.druid.DruidResult Maven / Gradle / Ivy

package com.simplaex.clients.druid;

import io.druid.java.util.common.guava.Sequence;
import io.druid.java.util.common.guava.Yielder;
import io.druid.java.util.common.guava.YieldingAccumulator;
import io.druid.query.QueryPlus;
import lombok.Value;

import java.util.ArrayList;
import java.util.List;

@Value
public class DruidResult {

  Sequence sequence;

  QueryPlus query;

  public List toList() {
    final Yielder> resultYielder = sequence.toYielder(
      new ArrayList<>(),
        new YieldingAccumulator, T>() {
          @Override
          public ArrayList accumulate(final ArrayList accumulated, final T in) {
            accumulated.add(in);
            return accumulated;
          }
        });
    return resultYielder.get();
  }

  public String getQueryId() {
    return query.getQuery().getId();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy