use of io.confluent.ksql.schema.ksql.LogicalSchema in project ksql by confluentinc.
the class StepSchemaResolverTest method shouldResolveSchemaForTableGroupByAnyKey.
@Test
public void shouldResolveSchemaForTableGroupByAnyKey() {
// Given:
final TableGroupBy<?> step = new TableGroupBy<>(PROPERTIES, tableSource, formats, ImmutableList.of(new UnqualifiedColumnReferenceExp(Optional.empty(), ORANGE_COL)));
// When:
final LogicalSchema result = resolver.resolve(step, SCHEMA);
// Then:
assertThat(result, is(LogicalSchema.builder().keyColumn(ORANGE_COL, SqlTypes.INTEGER).valueColumns(SCHEMA.value()).build()));
}
use of io.confluent.ksql.schema.ksql.LogicalSchema in project ksql by confluentinc.
the class StepSchemaResolverTest method shouldResolveSchemaForStreamGroupBy.
@Test
public void shouldResolveSchemaForStreamGroupBy() {
// Given:
final StreamGroupBy<?> step = new StreamGroupBy<>(PROPERTIES, streamSource, formats, ImmutableList.of(new UnqualifiedColumnReferenceExp(Optional.empty(), ORANGE_COL)));
// When:
final LogicalSchema result = resolver.resolve(step, SCHEMA);
// Then:
assertThat(result, is(LogicalSchema.builder().keyColumn(ORANGE_COL, SqlTypes.INTEGER).valueColumns(SCHEMA.value()).build()));
}
use of io.confluent.ksql.schema.ksql.LogicalSchema in project ksql by confluentinc.
the class StepSchemaResolverTest method shouldResolveSchemaForStreamSelectKeyV2.
@Test
public void shouldResolveSchemaForStreamSelectKeyV2() {
// Given:
final UnqualifiedColumnReferenceExp keyExpression1 = new UnqualifiedColumnReferenceExp(ColumnName.of("ORANGE"));
final UnqualifiedColumnReferenceExp keyExpression2 = new UnqualifiedColumnReferenceExp(ColumnName.of("APPLE"));
final StreamSelectKey<GenericKey> step = new StreamSelectKey<>(PROPERTIES, streamSource, ImmutableList.of(keyExpression1, keyExpression2));
// When:
final LogicalSchema result = resolver.resolve(step, SCHEMA);
// Then:
assertThat(result, is(LogicalSchema.builder().keyColumn(keyExpression1.getColumnName(), SqlTypes.INTEGER).keyColumn(keyExpression2.getColumnName(), SqlTypes.BIGINT).valueColumns(SCHEMA.value()).build()));
}
use of io.confluent.ksql.schema.ksql.LogicalSchema in project ksql by confluentinc.
the class StepSchemaResolverTest method shouldResolveSchemaForTableSelect.
@Test
public void shouldResolveSchemaForTableSelect() {
// Given:
final TableSelect<?> step = new TableSelect<>(PROPERTIES, tableSource, ImmutableList.of(), ImmutableList.of(add("JUICE", "ORANGE", "APPLE"), ref("PLANTAIN", "BANANA"), ref("CITRUS", "ORANGE")), internalFormats);
// When:
final LogicalSchema result = resolver.resolve(step, SCHEMA);
// Then:
assertThat(result, is(LogicalSchema.builder().keyColumn(ColumnName.of("K0"), SqlTypes.INTEGER).valueColumn(ColumnName.of("JUICE"), SqlTypes.BIGINT).valueColumn(ColumnName.of("PLANTAIN"), SqlTypes.STRING).valueColumn(ColumnName.of("CITRUS"), SqlTypes.INTEGER).build()));
}
use of io.confluent.ksql.schema.ksql.LogicalSchema in project ksql by confluentinc.
the class StepSchemaResolverTest method shouldResolveSchemaForTableGroupBy.
@Test
public void shouldResolveSchemaForTableGroupBy() {
// Given:
final TableGroupBy<?> step = new TableGroupBy<>(PROPERTIES, tableSource, formats, ImmutableList.of(new UnqualifiedColumnReferenceExp(Optional.empty(), ORANGE_COL)));
// When:
final LogicalSchema result = resolver.resolve(step, SCHEMA);
// Then:
assertThat(result, is(LogicalSchema.builder().keyColumn(ORANGE_COL, SqlTypes.INTEGER).valueColumns(SCHEMA.value()).build()));
}
Aggregations