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();
}
}