public static ColumnName generateSyntheticJoinKey(final Stream<LogicalSchema> schemas) {
    final AliasGenerator generator = buildAliasGenerators(schemas)
        .getOrDefault(
            SYNTHETIC_JOIN_KEY_COLUMN_PRIFIX,
            new AliasGenerator(0, SYNTHETIC_JOIN_KEY_COLUMN_PRIFIX, ImmutableSet.of())
        );

    return generator.next();
  }
@Test
  public void shouldIncrementSyntheticJoinColumnOnClashes() {
    // Given:
    final LogicalSchema schema = LogicalSchema.builder()
        .keyColumn(ColumnName.of("ROWKEY"), SqlTypes.STRING)
        .keyColumn(ColumnName.of("ROWKEY_1"), SqlTypes.STRING)
        .keyColumn(ColumnName.of("ROWKEY_2"), SqlTypes.STRING)
        .valueColumn(ColumnName.of("someField"), SqlTypes.STRING)
        .valueColumn(ColumnName.of("ROWKEY_3"), SqlTypes.STRING)
        .build();

    // When:
    final ColumnName columnName = ColumnNames.generateSyntheticJoinKey(Stream.of(schema));

    // Then:
    assertThat(columnName, is(ColumnName.of("ROWKEY_4")));
  }