Search in sources :

Example 1 with TableSelectKey

use of io.confluent.ksql.execution.plan.TableSelectKey in project ksql by confluentinc.

the class StepSchemaResolverTest method shouldResolveSchemaForTableSelectKey.

@Test
public void shouldResolveSchemaForTableSelectKey() {
    // Given:
    final UnqualifiedColumnReferenceExp keyExpression1 = new UnqualifiedColumnReferenceExp(ColumnName.of("ORANGE"));
    final UnqualifiedColumnReferenceExp keyExpression2 = new UnqualifiedColumnReferenceExp(ColumnName.of("APPLE"));
    final TableSelectKey<GenericKey> step = new TableSelectKey<>(PROPERTIES, tableSource, formats, 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 : TableSelectKey(io.confluent.ksql.execution.plan.TableSelectKey) LogicalSchema(io.confluent.ksql.schema.ksql.LogicalSchema) GenericKey(io.confluent.ksql.GenericKey) 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 TableSelectKey (io.confluent.ksql.execution.plan.TableSelectKey)1 LogicalSchema (io.confluent.ksql.schema.ksql.LogicalSchema)1 Test (org.junit.Test)1