public int validate(
      final ServiceContext serviceContext,
      final List<ParsedStatement> statements,
      final SessionProperties sessionProperties,
      final String sql
  ) {
    requireSandbox(serviceContext);

    final KsqlExecutionContext ctx = requireSandbox(snapshotSupplier.apply(serviceContext));
    final Injector injector = injectorFactory.apply(ctx, serviceContext);
    final KsqlConfig ksqlConfig = ctx.getKsqlConfig();

    int numPersistentQueries = 0;
    for (final ParsedStatement parsed : statements) {
      final PreparedStatement<?> prepared = ctx.prepare(
          parsed,
          (isVariableSubstitutionEnabled(sessionProperties, ksqlConfig)
              ? sessionProperties.getSessionVariables()
              : Collections.emptyMap())
      );
      final ConfiguredStatement<?> configured = ConfiguredStatement.of(prepared,
          SessionConfig.of(ksqlConfig, sessionProperties.getMutableScopedProperties())
      );

      final int currNumPersistentQueries = validate(
          serviceContext,
          configured,
          sessionProperties,
          ctx,
          injector
      );
      numPersistentQueries += currNumPersistentQueries;

      if (currNumPersistentQueries > 0
          && QueryCapacityUtil.exceedsPersistentQueryCapacity(ctx, ksqlConfig)) {
        QueryCapacityUtil.throwTooManyActivePersistentQueriesException(ctx, ksqlConfig, sql);
      }
    }

    return numPersistentQueries;
  }
@Test
  public void shouldThrowIfNoValidatorAvailable() {
    // Given:
    final List<ParsedStatement> statements =
        givenParsed("EXPLAIN X;");

    // When:
    final Exception e = assertThrows(
        KsqlStatementException.class,
        () -> validator.validate(serviceContext, statements, sessionProperties, "sql")
    );

    // Then:
    assertThat(e.getMessage(), containsString(
        "Do not know how to validate statement"));
  }