use of io.confluent.ksql.execution.windows.WindowTimeClause in project ksql by confluentinc.
the class WithinExpressionTest method shouldDisplayCorrectStringWithGracePeriod.
@Test
public void shouldDisplayCorrectStringWithGracePeriod() {
final WindowTimeClause gracePeriod = new WindowTimeClause(5, TimeUnit.SECONDS);
final WithinExpression expression = new WithinExpression(20, TimeUnit.SECONDS, gracePeriod);
assertEquals(" WITHIN 20 SECONDS GRACE PERIOD 5 SECONDS", expression.toString());
assertEquals(JoinWindows.of(Duration.ofSeconds(20)).grace(Duration.ofSeconds(5)), expression.joinWindow());
}
use of io.confluent.ksql.execution.windows.WindowTimeClause 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()));
}
use of io.confluent.ksql.execution.windows.WindowTimeClause in project ksql by confluentinc.
the class StreamAggregateBuilderTest method givenHoppingWindowedAggregate.
private void givenHoppingWindowedAggregate() {
givenTimeWindowedAggregate();
windowedAggregate = new StreamWindowedAggregate(new ExecutionStepPropertiesV1(CTX), sourceStep, Formats.of(KEY_FORMAT, VALUE_FORMAT, SerdeFeatures.of(), SerdeFeatures.of()), NON_AGG_COLUMNS, FUNCTIONS, new HoppingWindowExpression(Optional.empty(), new WindowTimeClause(WINDOW.getSeconds(), TimeUnit.SECONDS), new WindowTimeClause(HOP.getSeconds(), TimeUnit.SECONDS), Optional.of(retentionClause), Optional.of(gracePeriodClause)));
}
use of io.confluent.ksql.execution.windows.WindowTimeClause 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)));
}
Aggregations