Search in sources :

Example 1 with StreamSelect

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

the class StepSchemaResolverTest method shouldResolveSchemaForStreamSelectWithoutColumnNames.

@Test
public void shouldResolveSchemaForStreamSelectWithoutColumnNames() {
    // Given:
    final StreamSelect<?> step = new StreamSelect<>(PROPERTIES, streamSource, ImmutableList.of(ColumnName.of("NEW_KEY")), ImmutableList.of(add("JUICE", "ORANGE", "APPLE"), ref("PLANTAIN", "BANANA"), ref("CITRUS", "ORANGE")));
    // When:
    final LogicalSchema result = resolver.resolve(step, SCHEMA);
    // Then:
    assertThat(result, is(LogicalSchema.builder().keyColumn(ColumnName.of("NEW_KEY"), SqlTypes.INTEGER).valueColumn(ColumnName.of("JUICE"), SqlTypes.BIGINT).valueColumn(ColumnName.of("PLANTAIN"), SqlTypes.STRING).valueColumn(ColumnName.of("CITRUS"), SqlTypes.INTEGER).build()));
}
Also used : StreamSelect(io.confluent.ksql.execution.plan.StreamSelect) LogicalSchema(io.confluent.ksql.schema.ksql.LogicalSchema) Test(org.junit.Test)

Example 2 with StreamSelect

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

the class StepSchemaResolverTest method shouldResolveSchemaForStreamSelect.

@Test
public void shouldResolveSchemaForStreamSelect() {
    // Given:
    final StreamSelect<?> step = new StreamSelect<>(PROPERTIES, streamSource, ImmutableList.of(), ImmutableList.of(add("JUICE", "ORANGE", "APPLE"), ref("PLANTAIN", "BANANA"), ref("CITRUS", "ORANGE")));
    // 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()));
}
Also used : StreamSelect(io.confluent.ksql.execution.plan.StreamSelect) LogicalSchema(io.confluent.ksql.schema.ksql.LogicalSchema) Test(org.junit.Test)

Aggregations

StreamSelect (io.confluent.ksql.execution.plan.StreamSelect)2 LogicalSchema (io.confluent.ksql.schema.ksql.LogicalSchema)2 Test (org.junit.Test)2