use of io.confluent.ksql.execution.expression.tree.IntegerLiteral in project ksql by confluentinc.
the class DefaultSchemaInjectorTest method shouldThrowIfCtasKeyTableElementsNotCompatibleWrongKeyType.
@Test
public void shouldThrowIfCtasKeyTableElementsNotCompatibleWrongKeyType() {
// Given:
givenFormatsAndProps("protobuf", null, ImmutableMap.of("KEY_SCHEMA_ID", new IntegerLiteral(42)));
givenDDLSchemaAndFormats(LOGICAL_SCHEMA_INT_KEY, "protobuf", "avro", SerdeFeature.WRAP_SINGLES, SerdeFeature.UNWRAP_SINGLES);
// When:
final Exception e = assertThrows(KsqlException.class, () -> injector.inject(ctasStatement));
// Then:
assertThat(e.getMessage(), containsString("The following key columns are changed, missing or reordered: " + "[`key` INTEGER KEY]. Schema from schema registry is [`key` STRING KEY]"));
}
use of io.confluent.ksql.execution.expression.tree.IntegerLiteral in project ksql by confluentinc.
the class DefaultSchemaInjectorTest method shouldThrowIfValueFormatDoesNotSupportSchemaIdInference.
@Test
public void shouldThrowIfValueFormatDoesNotSupportSchemaIdInference() {
// Given
givenKeyButNotValueInferenceSupported(ImmutableMap.of("value_schema_id", new IntegerLiteral(123), "WRAP_SINGLE_VALUE", new BooleanLiteral(true)));
when(cs.getElements()).thenReturn(SOME_KEY_ELEMENTS_STREAM);
// When:
final Exception e = assertThrows(KsqlException.class, () -> injector.inject(csStatement));
// Then:
assertThat(e.getMessage(), containsString("VALUE_FORMAT should support schema inference when VALUE_SCHEMA_ID is provided. " + "Current format is DELIMITED."));
}
use of io.confluent.ksql.execution.expression.tree.IntegerLiteral in project ksql by confluentinc.
the class DefaultSchemaInjectorTest method shouldThrowIfCsasKeyFormatDoesnotSupportInference.
@Test
public void shouldThrowIfCsasKeyFormatDoesnotSupportInference() {
// Given:
givenFormatsAndProps("kafka", null, ImmutableMap.of("KEY_SCHEMA_ID", new IntegerLiteral(42)));
givenDDLSchemaAndFormats(LOGICAL_SCHEMA, "kafka", "avro", SerdeFeature.WRAP_SINGLES, SerdeFeature.UNWRAP_SINGLES);
// When:
final Exception e = assertThrows(KsqlException.class, () -> injector.inject(csasStatement));
// Then:
assertThat(e.getMessage(), containsString("KEY_FORMAT should support schema inference when " + "KEY_SCHEMA_ID is provided. Current format is KAFKA."));
}
use of io.confluent.ksql.execution.expression.tree.IntegerLiteral in project ksql by confluentinc.
the class DefaultSchemaInjectorTest method shouldThrowIfCsasKeyTableElementsNotCompatibleReorderedValue.
@Test
public void shouldThrowIfCsasKeyTableElementsNotCompatibleReorderedValue() {
// Given:
givenFormatsAndProps("kafka", "avro", ImmutableMap.of("VALUE_SCHEMA_ID", new IntegerLiteral(42)));
givenDDLSchemaAndFormats(LOGICAL_SCHEMA_VALUE_REORDERED, "kafka", "avro", SerdeFeature.UNWRAP_SINGLES, SerdeFeature.UNWRAP_SINGLES);
// When:
final Exception e = assertThrows(KsqlException.class, () -> injector.inject(csasStatement));
// Then:
assertThat(e.getMessage(), containsString("The following value columns are changed, missing or reordered: " + "[`bigIntField` BIGINT, `intField` INTEGER]. Schema from schema registry is [" + "`intField` INTEGER, " + "`bigIntField` BIGINT, " + "`doubleField` DOUBLE, " + "`stringField` STRING, " + "`booleanField` BOOLEAN, " + "`arrayField` ARRAY<INTEGER>, " + "`mapField` MAP<STRING, BIGINT>, " + "`structField` STRUCT<`s0` BIGINT>, " + "`decimalField` DECIMAL(4, 2)]"));
}
use of io.confluent.ksql.execution.expression.tree.IntegerLiteral in project ksql by confluentinc.
the class DefaultSchemaInjectorTest method shouldThrowIfCsasValueFormatDoesnotSupportInference.
@Test
public void shouldThrowIfCsasValueFormatDoesnotSupportInference() {
// Given:
givenFormatsAndProps(null, "kafka", ImmutableMap.of("VALUE_SCHEMA_ID", new IntegerLiteral(42)));
givenDDLSchemaAndFormats(LOGICAL_SCHEMA, "kafka", "delimited", SerdeFeature.UNWRAP_SINGLES, SerdeFeature.UNWRAP_SINGLES);
// When:
final Exception e = assertThrows(KsqlException.class, () -> injector.inject(csasStatement));
// Then:
assertThat(e.getMessage(), containsString("VALUE_FORMAT should support schema inference when " + "VALUE_SCHEMA_ID is provided. Current format is DELIMITED."));
}
Aggregations