Search in sources :

Example 1 with QueryExecutionType

use of org.neo4j.graphdb.QueryExecutionType in project neo4j by neo4j.

the class CypherAdapterStream method accept.

@Override
public void accept(final Visitor visitor) throws Exception {
    long start = clock.millis();
    delegate.accept(row -> {
        visitor.visit(currentRecord.reset(row));
        return true;
    });
    visitor.addMetadata("result_consumed_after", clock.millis() - start);
    QueryExecutionType qt = delegate.getQueryExecutionType();
    visitor.addMetadata("type", queryTypeCode(qt.queryType()));
    if (delegate.getQueryStatistics().containsUpdates()) {
        Object stats = queryStats(delegate.getQueryStatistics());
        visitor.addMetadata("stats", stats);
    }
    if (qt.requestedExecutionPlanDescription()) {
        ExecutionPlanDescription rootPlanTreeNode = delegate.getExecutionPlanDescription();
        String metadataFieldName = rootPlanTreeNode.hasProfilerStatistics() ? "profile" : "plan";
        visitor.addMetadata(metadataFieldName, ExecutionPlanConverter.convert(rootPlanTreeNode));
    }
    Iterable<Notification> notifications = delegate.getNotifications();
    if (notifications.iterator().hasNext()) {
        visitor.addMetadata("notifications", NotificationConverter.convert(notifications));
    }
}
Also used : QueryExecutionType(org.neo4j.graphdb.QueryExecutionType) ExecutionPlanDescription(org.neo4j.graphdb.ExecutionPlanDescription) Notification(org.neo4j.graphdb.Notification)

Aggregations

ExecutionPlanDescription (org.neo4j.graphdb.ExecutionPlanDescription)1 Notification (org.neo4j.graphdb.Notification)1 QueryExecutionType (org.neo4j.graphdb.QueryExecutionType)1