Search in sources :

Example 1 with StreamSelectKey

use of io.confluent.ksql.execution.plan.StreamSelectKey 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()));
}
Also used : LogicalSchema(io.confluent.ksql.schema.ksql.LogicalSchema) GenericKey(io.confluent.ksql.GenericKey) StreamSelectKey(io.confluent.ksql.execution.plan.StreamSelectKey) UnqualifiedColumnReferenceExp(io.confluent.ksql.execution.expression.tree.UnqualifiedColumnReferenceExp) Test(org.junit.Test)

Aggregations

GenericKey (io.confluent.ksql.GenericKey)1 UnqualifiedColumnReferenceExp (io.confluent.ksql.execution.expression.tree.UnqualifiedColumnReferenceExp)1 StreamSelectKey (io.confluent.ksql.execution.plan.StreamSelectKey)1 LogicalSchema (io.confluent.ksql.schema.ksql.LogicalSchema)1 Test (org.junit.Test)1