use of io.confluent.ksql.schema.ksql.LogicalSchema in project ksql by confluentinc.
the class StepSchemaResolverTest method shouldResolveSchemaForStreamFilter.
@Test
public void shouldResolveSchemaForStreamFilter() {
// Given:
final StreamFilter<?> step = new StreamFilter<>(PROPERTIES, streamSource, mock(Expression.class));
// When:
final LogicalSchema result = resolver.resolve(step, SCHEMA);
// Then:
assertThat(result, is(SCHEMA));
}
use of io.confluent.ksql.schema.ksql.LogicalSchema in project ksql by confluentinc.
the class StepSchemaResolverTest method shouldResolveSchemaForStreamWindowedSource.
@Test
public void shouldResolveSchemaForStreamWindowedSource() {
final WindowedStreamSource step = new WindowedStreamSource(PROPERTIES, "foo", formats, WindowInfo.of(WindowType.TUMBLING, Optional.of(Duration.ofMillis(123))), Optional.empty(), SCHEMA, OptionalInt.of(SystemColumns.CURRENT_PSEUDOCOLUMN_VERSION_NUMBER));
// When:
final LogicalSchema result = resolver.resolve(step, SCHEMA);
// Then:
assertThat(result, is(SCHEMA.withPseudoAndKeyColsInValue(true)));
}
use of io.confluent.ksql.schema.ksql.LogicalSchema in project ksql by confluentinc.
the class AggregateParamsFactoryTest method shouldReturnCorrectWindowedSchema.
@Test
public void shouldReturnCorrectWindowedSchema() {
// Given:
aggregateParams = new AggregateParamsFactory(udafFactory, undoUdafFactory).create(INPUT_SCHEMA, NON_AGG_COLUMNS, functionRegistry, FUNCTIONS, true, KsqlConfig.empty());
// When:
final LogicalSchema schema = aggregateParams.getSchema();
// Then:
assertThat(schema, equalTo(LogicalSchema.builder().keyColumns(INPUT_SCHEMA.key()).valueColumn(ColumnName.of("REQUIRED0"), SqlTypes.BIGINT).valueColumn(ColumnName.of("REQUIRED1"), SqlTypes.STRING).valueColumn(ColumnNames.aggregateColumn(0), SqlTypes.INTEGER).valueColumn(ColumnNames.aggregateColumn(1), SqlTypes.STRING).valueColumn(SystemColumns.WINDOWSTART_NAME, SystemColumns.WINDOWBOUND_TYPE).valueColumn(SystemColumns.WINDOWEND_NAME, SystemColumns.WINDOWBOUND_TYPE).build()));
}
use of io.confluent.ksql.schema.ksql.LogicalSchema in project ksql by confluentinc.
the class AggregateParamsFactoryTest method shouldReturnCorrectSchema.
@Test
public void shouldReturnCorrectSchema() {
// When:
final LogicalSchema schema = aggregateParams.getSchema();
// Then:
assertThat(schema, equalTo(LogicalSchema.builder().keyColumns(INPUT_SCHEMA.key()).valueColumn(ColumnName.of("REQUIRED0"), SqlTypes.BIGINT).valueColumn(ColumnName.of("REQUIRED1"), SqlTypes.STRING).valueColumn(ColumnNames.aggregateColumn(0), SqlTypes.INTEGER).valueColumn(ColumnNames.aggregateColumn(1), SqlTypes.STRING).build()));
}
use of io.confluent.ksql.schema.ksql.LogicalSchema in project ksql by confluentinc.
the class RowTest method shouldImplementEquals.
@SuppressWarnings("UnstableApiUsage")
@Test
public void shouldImplementEquals() {
final LogicalSchema differentSchema = LogicalSchema.builder().keyColumn(ColumnName.of("k0"), SqlTypes.STRING).keyColumn(ColumnName.of("k1"), SqlTypes.INTEGER).valueColumn(ColumnName.of("diff0"), SqlTypes.STRING).valueColumn(ColumnName.of("diff1"), SqlTypes.DOUBLE).build();
new EqualsTester().addEqualityGroup(Row.of(SCHEMA, A_KEY, A_VALUE, A_ROWTIME), Row.of(SCHEMA, A_KEY, A_VALUE, A_ROWTIME)).addEqualityGroup(Row.of(differentSchema, A_KEY, A_VALUE, A_ROWTIME)).addEqualityGroup(Row.of(SCHEMA, GenericKey.genericKey("diff", 11), A_VALUE, A_ROWTIME)).addEqualityGroup(Row.of(SCHEMA, A_KEY, GenericRow.genericRow(null, null), A_ROWTIME)).addEqualityGroup(Row.of(SCHEMA, A_KEY, A_VALUE, -1L)).testEquals();
}
Aggregations