public static StatementExecutorResponse execute(
      final ConfiguredStatement<Explain> statement,
      final SessionProperties sessionProperties,
      final KsqlExecutionContext executionContext,
      final ServiceContext serviceContext
  ) {
    return StatementExecutorResponse.handled(Optional
        .of(ExplainExecutor.explain(
            serviceContext,
            statement,
            executionContext,
            sessionProperties)));
  }
@Test
  public void shouldExplainQueryId() {
    // Given:
    final ConfiguredStatement<?> explain = engine.configure("EXPLAIN id;");
    final PersistentQueryMetadata metadata = givenPersistentQuery("id");

    final KsqlEngine engine = mock(KsqlEngine.class);
    when(engine.getPersistentQuery(metadata.getQueryId())).thenReturn(Optional.of(metadata));

    // When:
    final QueryDescriptionEntity query = (QueryDescriptionEntity) CustomExecutors.EXPLAIN.execute(
        explain,
        sessionProperties,
        engine,
        this.engine.getServiceContext()
    ).getEntity().orElseThrow(IllegalStateException::new);

    // Then:
    assertThat(
        query.getQueryDescription(),
        equalTo(QueryDescriptionFactory.forQueryMetadata(
            metadata, Collections.singletonMap(new KsqlHostInfoEntity(LOCAL_HOST), STATE))));
  }