Search in sources :

Example 6 with TumblingWindowExpression

use of io.confluent.ksql.execution.windows.TumblingWindowExpression in project ksql by confluentinc.

the class StepSchemaResolverTest method shouldResolveSchemaForStreamWindowedAggregate.

@Test
public void shouldResolveSchemaForStreamWindowedAggregate() {
    // Given:
    givenAggregateFunction("COUNT", SqlTypes.BIGINT);
    final StreamWindowedAggregate step = new StreamWindowedAggregate(PROPERTIES, groupedStreamSource, formats, ImmutableList.of(ColumnName.of("ORANGE")), ImmutableList.of(functionCall("COUNT", "APPLE")), new TumblingWindowExpression(new WindowTimeClause(10, TimeUnit.SECONDS)));
    // When:
    final LogicalSchema result = resolver.resolve(step, SCHEMA);
    // Then:
    assertThat(result, is(LogicalSchema.builder().keyColumn(ColumnName.of("K0"), SqlTypes.INTEGER).valueColumn(ColumnName.of("ORANGE"), SqlTypes.INTEGER).valueColumn(ColumnNames.aggregateColumn(0), SqlTypes.BIGINT).valueColumn(SystemColumns.WINDOWSTART_NAME, SystemColumns.WINDOWBOUND_TYPE).valueColumn(SystemColumns.WINDOWEND_NAME, SystemColumns.WINDOWBOUND_TYPE).build()));
}
Also used : StreamWindowedAggregate(io.confluent.ksql.execution.plan.StreamWindowedAggregate) WindowTimeClause(io.confluent.ksql.execution.windows.WindowTimeClause) LogicalSchema(io.confluent.ksql.schema.ksql.LogicalSchema) TumblingWindowExpression(io.confluent.ksql.execution.windows.TumblingWindowExpression) Test(org.junit.Test)

Example 7 with TumblingWindowExpression

use of io.confluent.ksql.execution.windows.TumblingWindowExpression in project ksql by confluentinc.

the class StreamAggregateBuilderTest method givenTumblingWindowedAggregate.

private void givenTumblingWindowedAggregate() {
    givenTimeWindowedAggregate();
    windowedAggregate = new StreamWindowedAggregate(new ExecutionStepPropertiesV1(CTX), sourceStep, Formats.of(KEY_FORMAT, VALUE_FORMAT, SerdeFeatures.of(), SerdeFeatures.of()), NON_AGG_COLUMNS, FUNCTIONS, new TumblingWindowExpression(Optional.empty(), new WindowTimeClause(WINDOW.getSeconds(), TimeUnit.SECONDS), Optional.of(retentionClause), Optional.of(gracePeriodClause)));
}
Also used : ExecutionStepPropertiesV1(io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1) StreamWindowedAggregate(io.confluent.ksql.execution.plan.StreamWindowedAggregate) WindowTimeClause(io.confluent.ksql.execution.windows.WindowTimeClause) TumblingWindowExpression(io.confluent.ksql.execution.windows.TumblingWindowExpression)

Aggregations

TumblingWindowExpression (io.confluent.ksql.execution.windows.TumblingWindowExpression)7 WindowTimeClause (io.confluent.ksql.execution.windows.WindowTimeClause)7 Test (org.junit.Test)5 KsqlWindowExpression (io.confluent.ksql.execution.windows.KsqlWindowExpression)3 StreamWindowedAggregate (io.confluent.ksql.execution.plan.StreamWindowedAggregate)2 WindowExpression (io.confluent.ksql.parser.tree.WindowExpression)2 ExecutionStepPropertiesV1 (io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1)1 ColumnExtractor (io.confluent.ksql.execution.util.ColumnExtractor)1 HoppingWindowExpression (io.confluent.ksql.execution.windows.HoppingWindowExpression)1 SessionWindowExpression (io.confluent.ksql.execution.windows.SessionWindowExpression)1 NodeLocation (io.confluent.ksql.parser.NodeLocation)1 LogicalSchema (io.confluent.ksql.schema.ksql.LogicalSchema)1 RefinementInfo (io.confluent.ksql.serde.RefinementInfo)1 KsqlException (io.confluent.ksql.util.KsqlException)1