public AggregateAnalysisResult analyze(
      final ImmutableAnalysis analysis,
      final List<SelectExpression> finalProjection
  ) {
    if (!analysis.getGroupBy().isPresent()) {
      throw new IllegalArgumentException("Not an aggregate query");
    }

    final AggAnalyzer aggAnalyzer = new AggAnalyzer(analysis, functionRegistry);
    aggAnalyzer.process(finalProjection);
    return aggAnalyzer.result();
  }
@Test
  public void shouldThrowOnNonExistentFunctionCall() {
    // Given:
    givenSelectExpression(new FunctionCall(FunctionName.of("NOT_FOUND"), ImmutableList.of(COL2)));

    // When:
    final KsqlException e = assertThrows(
        KsqlException.class,
        () -> analyzer.analyze(analysis, selects)
    );

    // Then:
    assertThat(e.getMessage(),
        containsString("Can't find any functions with the name 'NOT_FOUND'"));
  }