Search in sources :

Example 1 with TableGroupBy

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

Example 2 with TableGroupBy

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

Aggregations

UnqualifiedColumnReferenceExp (io.confluent.ksql.execution.expression.tree.UnqualifiedColumnReferenceExp)2 TableGroupBy (io.confluent.ksql.execution.plan.TableGroupBy)2 LogicalSchema (io.confluent.ksql.schema.ksql.LogicalSchema)2 Test (org.junit.Test)2