congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Result.getExecutionPlanDescription
Code IndexAdd Tabnine to your IDE (free)

How to use
getExecutionPlanDescription
method
in
org.neo4j.graphdb.Result

Best Java code snippets using org.neo4j.graphdb.Result.getExecutionPlanDescription (Showing top 20 results out of 315)

origin: neo4j/neo4j

@Override
public ExecutionPlanDescription getExecutionPlanDescription()
{
  return originalResult.getExecutionPlanDescription();
}
origin: neo4j/neo4j

@Override
public ExecutionPlanDescription executionPlanDescription()
{
  return originalResult.getExecutionPlanDescription();
}
origin: neo4j/neo4j

private Function<Object, ExecutionPlanDescription> planProvider( final Result result )
{
  return from -> result.getExecutionPlanDescription();
}
origin: neo4j/neo4j

private void assertNoIndexSeeks( Result result )
{
  assertThat( result.stream().count(), is( 1L ) );
  String planDescription = result.getExecutionPlanDescription().toString();
  assertThat( planDescription, containsString( "NodeByLabel" ) );
  assertThat( planDescription, not( containsString( "IndexSeek" ) ) );
}
origin: neo4j/neo4j

@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;
}
origin: neo4j/neo4j

when( result.hasNext() ).thenReturn( false );
when( result.columns() ).thenReturn( new ArrayList<>() );
when( result.getExecutionPlanDescription() ).thenReturn( plan );
origin: neo4j/neo4j

void shouldNotNotifyInStream( String version, String query )
{
  // when
  Result result = db().execute( version + query );
  // then
  assertThat( Iterables.asList( result.getNotifications() ), empty() );
  Map<String,Object> arguments = result.getExecutionPlanDescription().getArguments();
  assertThat( arguments.get( "version" ), equalTo( version ) );
  result.close();
}
origin: neo4j/neo4j

@Test
public void shouldNotifyWhenUsingCypher3_1ForTheRulePlannerWhenCypherVersionIsTheDefault()
{
  // when
  Result result = db().execute( "CYPHER planner=rule RETURN 1" );
  InputPosition position = InputPosition.empty;
  // then
  assertThat( result.getNotifications(), containsItem( rulePlannerUnavailable ) );
  Map<String,Object> arguments = result.getExecutionPlanDescription().getArguments();
  assertThat( arguments.get( "version" ), equalTo( "CYPHER 3.1" ) );
  assertThat( arguments.get( "planner" ), equalTo( "RULE" ) );
  result.close();
}
origin: neo4j/neo4j

void shouldNotifyInStream( String version, String query, InputPosition pos, NotificationCode code )
{
  //when
  Result result = db().execute( version + query );
  //then
  NotificationCode.Notification notification = code.notification( pos );
  assertThat( Iterables.asList( result.getNotifications() ), Matchers.hasItems( notification ) );
  Map<String,Object> arguments = result.getExecutionPlanDescription().getArguments();
  assertThat( arguments.get( "version" ), equalTo( version ) );
  result.close();
}
origin: neo4j/neo4j

void shouldNotifyInStreamWithDetail( String version, String query, InputPosition pos, NotificationCode code,
                   NotificationDetail detail )
{
  //when
  Result result = db().execute( version + query );
  //then
  NotificationCode.Notification notification = code.notification( pos, detail );
  assertThat( Iterables.asList( result.getNotifications() ), Matchers.hasItems( notification ) );
  Map<String,Object> arguments = result.getExecutionPlanDescription().getArguments();
  assertThat( arguments.get( "version" ), equalTo( version ) );
  result.close();
}
origin: neo4j/neo4j

@Test
public void shouldNotifyWhenUsingCreateUniqueWhenCypherVersionIs3_5()
{
  // when
  Result result = db().execute( "EXPLAIN CYPHER 3.5 MATCH (b) WITH b LIMIT 1 CREATE UNIQUE (b)-[:REL]->()" );
  InputPosition position = new InputPosition( 44, 1, 45 );
  // then
  assertThat( result.getNotifications(), containsNotification( CREATE_UNIQUE_UNAVAILABLE_FALLBACK.notification( position ) ) );
  Map<String,Object> arguments = result.getExecutionPlanDescription().getArguments();
  assertThat( arguments.get( "version" ), equalTo( "CYPHER 3.1" ) );
  result.close();
}
origin: neo4j/neo4j

@Test
public void shouldNotifyWhenUsingCreateUniqueWhenCypherVersionIsDefault()
{
  // when
  Result result = db().execute( "EXPLAIN MATCH (b) WITH b LIMIT 1 CREATE UNIQUE (b)-[:REL]->()" );
  InputPosition position = new InputPosition( 33, 1, 34 );
  // then
  assertThat( result.getNotifications(),
      containsNotification( CREATE_UNIQUE_UNAVAILABLE_FALLBACK.notification( position ) ) );
  Map<String,Object> arguments = result.getExecutionPlanDescription().getArguments();
  assertThat( arguments.get( "version" ), equalTo( "CYPHER 3.1" ) );
  result.close();
}
origin: neo4j/neo4j

@Test
public void eagerResultHaveExecutionPlan()
{
  Result result = database.execute( "profile MATCH (n) RETURN n.c" );
  assertEquals( 1, testCursorContext.getAdditionalAttempts() );
  assertEquals( 2, result.getExecutionPlanDescription().getProfilerStatistics().getRows() );
}
origin: neo4j/neo4j

writeRootPlanDescription( result.getExecutionPlanDescription() );
origin: org.neo4j/neo4j-cypher

@Override
public ExecutionPlanDescription executionPlanDescription()
{
  return originalResult.getExecutionPlanDescription();
}
origin: org.neo4j/neo4j-cypher

@Override
public ExecutionPlanDescription getExecutionPlanDescription()
{
  return originalResult.getExecutionPlanDescription();
}
origin: org.neo4j.app/neo4j-server

private Function<Object, ExecutionPlanDescription> planProvider( final Result result )
{
  return from -> result.getExecutionPlanDescription();
}
origin: neo4j-contrib/neo4j-apoc-procedures

@Test
public void testRunFirstColumnBugCompiled() throws Exception {
  ResourceIterator<Node> it = db.execute("CREATE (m:Movie  {title:'MovieA'})<-[:ACTED_IN]-(p:Person {name:'PersonA'})-[:ACTED_IN]->(m2:Movie {title:'MovieB'}) RETURN m").columnAs("m");
  Node movie = it.next();
  it.close();
  String query = "WITH {m} AS m MATCH (m)<-[:ACTED_IN]-(:Person)-[:ACTED_IN]->(rec:Movie) RETURN rec LIMIT 10";
  System.out.println(db.execute("EXPLAIN "+query).getExecutionPlanDescription().toString());
  ResourceIterator<Node> rec = db.execute(query, map("m",movie)).columnAs("rec");
  assertEquals(1, rec.stream().count());
}
@Test
origin: org.neo4j/neo4j-shell

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() );
  }
}
origin: org.neo4j.doc/neo4j-cypher-docs

@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
}
org.neo4j.graphdbResultgetExecutionPlanDescription

Javadoc

Returns a description of the query plan used to produce this result.

Retrieving a description of the execution plan that was executed is always possible, regardless of whether the query requested a plan or not. For implementing a client with the ability to present the plan to the user, it is useful to be able to tell if the query requested a description of the plan or not. For these purposes the QueryExecutionType#requestedExecutionPlanDescription()-method is used.

Being able to invoke this method, regardless of whether the user requested the plan or not is useful for purposes of debugging queries in applications.

Popular methods of Result

  • next
  • hasNext
    Denotes there being more rows available in this result. These rows must either be consumed, by invok
  • close
    Closes the result, freeing up any resources held by the result. This is an idempotent operation, inv
  • columns
    The exact names used to represent each column in the result set.
  • columnAs
    Returns an iterator with the result objects from a single column of the result set. This method is b
  • getQueryStatistics
    Statistics about the effects of the query.
  • resultAsString
    Provides a textual representation of the query result. The execution result represented by this obje
  • stream
  • accept
    Visits all rows in this Result by iterating over them. This is an alternative to using the iterator
  • getQueryExecutionType
    Indicates what kind of query execution produced this result.
  • getNotifications
    Provides notifications about the query producing this result. Notifications can be warnings about pr
  • forEachRemaining
  • getNotifications,
  • forEachRemaining,
  • writeAsStringTo

Popular in Java

  • Making http requests using okhttp
  • putExtra (Intent)
  • getSupportFragmentManager (FragmentActivity)
  • findViewById (Activity)
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Option (scala)
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now