Search in sources :

Example 1 with ProfiledIterator

use of org.janusgraph.graphdb.util.ProfiledIterator in project janusgraph by JanusGraph.

the class JanusGraphStep method executeGraphCentricQuery.

private void executeGraphCentricQuery(final GraphCentricQueryBuilder builder, final List<Iterator<E>> responses, final Entry<Integer, GraphCentricQuery> entry) {
    final GraphCentricQuery query = entry.getValue();
    final QueryProfiler profiler = query.getProfiler();
    final Class<? extends JanusGraphElement> graphClass = Vertex.class.isAssignableFrom(this.returnClass) ? JanusGraphVertex.class : JanusGraphEdge.class;
    final ProfiledIterator iterator = new ProfiledIterator(profiler, () -> builder.iterables(query, graphClass).iterator());
    long i = 0;
    while (i < entry.getKey() && iterator.hasNext()) {
        iterator.next();
        i++;
    }
    responses.add(iterator);
}
Also used : JanusGraphVertex(org.janusgraph.core.JanusGraphVertex) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) GraphCentricQuery(org.janusgraph.graphdb.query.graph.GraphCentricQuery) ProfiledIterator(org.janusgraph.graphdb.util.ProfiledIterator) QueryProfiler(org.janusgraph.graphdb.query.profile.QueryProfiler)

Aggregations

Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)1 JanusGraphVertex (org.janusgraph.core.JanusGraphVertex)1 GraphCentricQuery (org.janusgraph.graphdb.query.graph.GraphCentricQuery)1 QueryProfiler (org.janusgraph.graphdb.query.profile.QueryProfiler)1 ProfiledIterator (org.janusgraph.graphdb.util.ProfiledIterator)1