Set<SourceName> analyzeExpression(
      final Expression expression,
      final String clauseType
  ) {
    final Validator extractor = new Validator(clauseType);
    extractor.process(expression, null);
    return extractor.referencedSources;
  }
@Test
  public void shouldThrowOnPossibleSyntheticKeyColumnIfNotValidSyntheticKeyColumnName() {
    // Given:
    when(sourceSchemas.isJoin()).thenReturn(true);

    final Expression notSyntheticKey = new UnqualifiedColumnReferenceExp(
        ColumnName.of("NOT_ROWKEY")
    );

    // When:
    final Exception e = assertThrows(
        UnknownColumnException.class,
        () -> analyzer.analyzeExpression(notSyntheticKey, "SELECT")
    );

    // Then:
    assertThat(e.getMessage(), containsString(
        "SELECT column 'NOT_ROWKEY' cannot be resolved."));
  }