use of org.neo4j.driver.summary.Plan in project neo4j by neo4j.
the class TablePlanFormatterTest method withNoDetails.
@Test
public void withNoDetails() {
Plan plan = mock(Plan.class);
Map<String, Value> args = Collections.singletonMap("EstimatedRows", new FloatValue(55));
when(plan.arguments()).thenReturn(args);
when(plan.operatorType()).thenReturn("Projection");
assertThat(tablePlanFormatter.formatPlan(plan), is(String.join(NEWLINE, "+-------------+----------------+", "| Operator | Estimated Rows |", "+-------------+----------------+", "| +Projection | 55 |", "+-------------+----------------+", "")));
}
use of org.neo4j.driver.summary.Plan in project neo4j by neo4j.
the class OutputFormatter method info.
@Nonnull
static Map<String, Value> info(@Nonnull ResultSummary summary) {
Map<String, Value> result = new LinkedHashMap<>();
if (!summary.hasPlan()) {
return result;
}
Plan plan = summary.plan();
result.put("Plan", Values.value(summary.hasProfile() ? "PROFILE" : "EXPLAIN"));
result.put("Statement", Values.value(summary.queryType().name()));
Map<String, Value> arguments = plan.arguments();
Value emptyString = Values.value("");
Value questionMark = Values.value("?");
for (String key : INFO_SUMMARY) {
Value value = arguments.getOrDefault(key, arguments.getOrDefault(key.toLowerCase(), emptyString));
result.put(key, value);
}
result.put("Time", Values.value(summary.resultAvailableAfter(MILLISECONDS) + summary.resultConsumedAfter(MILLISECONDS)));
if (summary.hasProfile()) {
result.put("DbHits", Values.value(collectHits(summary.profile())));
}
if (summary.hasProfile()) {
result.put("Rows", Values.value(summary.profile().records()));
}
if (summary.hasProfile()) {
result.put("Memory (Bytes)", arguments.getOrDefault("GlobalMemory", questionMark));
}
return result;
}
Aggregations