@Override public QueryExecutionType getQueryExecutionType() { return originalResult.getQueryExecutionType(); }
@Override public QueryExecutionType executionType() { return originalResult.getQueryExecutionType(); }
@SafeVarargs private static Result mockExecutionResult( ExecutionPlanDescription planDescription, Iterable<Notification> notifications, Map<String, Object>... rows ) { Set<String> keys = new TreeSet<>(); for ( Map<String, Object> row : rows ) { keys.addAll( row.keySet() ); } Result executionResult = mock( Result.class ); when( executionResult.columns() ).thenReturn( new ArrayList<>( keys ) ); final Iterator<Map<String, Object>> inner = asList( rows ).iterator(); when( executionResult.hasNext() ).thenAnswer( invocation -> inner.hasNext() ); when( executionResult.next() ).thenAnswer( invocation -> inner.next() ); when( executionResult.getQueryExecutionType() ) .thenReturn( null != planDescription ? QueryExecutionType.profiled( QueryExecutionType.QueryType.READ_WRITE ) : QueryExecutionType.query( QueryExecutionType.QueryType.READ_WRITE ) ); if ( executionResult.getQueryExecutionType().requestedExecutionPlanDescription() ) { when( executionResult.getExecutionPlanDescription() ).thenReturn( planDescription ); } mockAccept( executionResult ); when( executionResult.getNotifications() ).thenReturn( notifications ); return executionResult; }
includePlan = result.getQueryExecutionType().requestedExecutionPlanDescription();
@Test public void eagerResultContainsExecutionType() { Result result = database.execute( "MATCH (n) RETURN n.c" ); assertEquals( 1, testCursorContext.getAdditionalAttempts() ); assertEquals( QueryExecutionType.query( QueryExecutionType.QueryType.READ_ONLY ), result.getQueryExecutionType() ); }
if ( result.getQueryExecutionType().requestedExecutionPlanDescription() )
@Override public QueryExecutionType getQueryExecutionType() { return originalResult.getQueryExecutionType(); }
@Override public QueryExecutionType executionType() { return originalResult.getQueryExecutionType(); }
private void printResult( Output out, Result result, long startTime ) throws RemoteException { result.writeAsStringTo( new PrintWriter( new OutputAsWriter( out ) ) ); out.println( (now() - startTime) + " ms" ); if ( result.getQueryExecutionType().requestedExecutionPlanDescription() ) { out.println(); out.println( result.getExecutionPlanDescription().toString() ); } }
includePlan = result.getQueryExecutionType().requestedExecutionPlanDescription();
@Test public void explain_returns_plan() throws Exception { // START SNIPPET: explain_returns_plan Result result = db.execute( "EXPLAIN CREATE (user:User{name:{name}}) RETURN user" ); assert result.getQueryExecutionType().isExplained(); assert result.getQueryExecutionType().requestedExecutionPlanDescription(); assert !result.hasNext(); assert !result.getQueryStatistics().containsUpdates(); assert result.columns().isEmpty(); assert !result.getExecutionPlanDescription().hasProfilerStatistics(); // END SNIPPET: explain_returns_plan }
if ( result.getQueryExecutionType().requestedExecutionPlanDescription() )