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 shouldNotCaptureNonAggregateGroupByFunction() {
    // given:
    givenGroupByExpressions(FUNCTION_CALL);

    // When:
    final AggregateAnalysisResult result = analyzer.analyze(analysis, selects);

    // Then:
    assertThat(result.getAggregateFunctions(), contains(REQUIRED_AGG_FUNC_CALL));
  }