use of io.confluent.ksql.name.ColumnName in project ksql by confluentinc.
the class ColumnNamesTest method shouldDefaultToRowKeySyntheticJoinColumn.
@Test
public void shouldDefaultToRowKeySyntheticJoinColumn() {
// When:
final ColumnName columnName = ColumnNames.generateSyntheticJoinKey(Stream.of());
// Then:
assertThat(columnName, is(ColumnName.of("ROWKEY")));
}
use of io.confluent.ksql.name.ColumnName in project ksql by confluentinc.
the class GenericRecordFactoryTest method shouldHandleArbitraryOrdering.
@Test
public void shouldHandleArbitraryOrdering() {
// Given:
final LogicalSchema schema = LogicalSchema.builder().keyColumn(KEY, SqlTypes.STRING).valueColumn(COL0, SqlTypes.STRING).build();
final List<ColumnName> names = ImmutableList.of(COL0, KEY);
// When:
final KsqlGenericRecord record = recordFactory.build(names, ImmutableList.of(new StringLiteral("value"), new StringLiteral("key")), schema, DataSourceType.KSTREAM);
// Then:
assertThat(record, is(KsqlGenericRecord.of(GenericKey.genericKey("key"), GenericRow.genericRow("value"), 0)));
}
use of io.confluent.ksql.name.ColumnName in project ksql by confluentinc.
the class GenericRecordFactoryTest method shouldThrowOnUnknownColumn.
@Test
public void shouldThrowOnUnknownColumn() {
// Given:
final LogicalSchema schema = LogicalSchema.builder().keyColumn(KEY, SqlTypes.STRING).valueColumn(COL0, SqlTypes.STRING).build();
final List<ColumnName> names = ImmutableList.of(KEY, COL1);
final Expression exp = new StringLiteral("a");
// When:
final KsqlException e = assertThrows(KsqlException.class, () -> recordFactory.build(names, ImmutableList.of(exp, exp), schema, DataSourceType.KSTREAM));
// Then:
assertThat(e.getMessage(), containsString("does not exist"));
}
use of io.confluent.ksql.name.ColumnName in project ksql by confluentinc.
the class GenericRecordFactoryTest method shouldUseClockTime.
@Test
public void shouldUseClockTime() {
// Given:
final LogicalSchema schema = LogicalSchema.builder().keyColumn(KEY, SqlTypes.STRING).valueColumn(COL0, SqlTypes.STRING).build();
final List<ColumnName> names = ImmutableList.of(KEY, COL0);
final Expression exp = new StringLiteral("a");
clock.set(1L);
// When:
final KsqlGenericRecord record = recordFactory.build(names, ImmutableList.of(exp, exp), schema, DataSourceType.KSTREAM);
// Then:
assertThat(record, is(KsqlGenericRecord.of(GenericKey.genericKey("a"), GenericRow.genericRow("a"), 1)));
}
use of io.confluent.ksql.name.ColumnName in project ksql by confluentinc.
the class GenericRecordFactoryTest method shouldBuildWithRowtime.
@Test
public void shouldBuildWithRowtime() {
// Given:
final LogicalSchema schema = LogicalSchema.builder().keyColumn(KEY, SqlTypes.STRING).valueColumn(COL0, SqlTypes.STRING).build();
final List<ColumnName> names = ImmutableList.of(SystemColumns.ROWTIME_NAME, KEY, COL0);
final Expression exp = new StringLiteral("a");
// When:
final KsqlGenericRecord record = recordFactory.build(names, ImmutableList.of(new LongLiteral(1L), exp, exp), schema, DataSourceType.KSTREAM);
// Then:
assertThat(record, is(KsqlGenericRecord.of(GenericKey.genericKey("a"), GenericRow.genericRow("a"), 1)));
}
Aggregations