Search in sources :

Example 6 with TableElement

use of io.confluent.ksql.parser.tree.TableElement in project ksql by confluentinc.

the class CommandFactoriesTest method shouldFailCreateTableIfTimestampColumnNameIsIncorrect.

@Test
public void shouldFailCreateTableIfTimestampColumnNameIsIncorrect() {
    HashMap<String, Expression> tableProperties = new HashMap<>();
    tableProperties.putAll(properties);
    tableProperties.put(DdlConfig.TIMESTAMP_NAME_PROPERTY, new StringLiteral("COL3"));
    try {
        final DdlCommand result = commandFactories.create(sqlExpression, new CreateTable(QualifiedName.of("foo"), Arrays.asList(new TableElement("COL1", "BIGINT"), new TableElement("COL2", "VARCHAR")), true, tableProperties), Collections.emptyMap());
    } catch (KsqlException e) {
        assertThat(e.getMessage(), equalTo("No column with the provided timestamp column name in the WITH clause, COL3, exists in the defined schema."));
    }
}
Also used : StringLiteral(io.confluent.ksql.parser.tree.StringLiteral) Expression(io.confluent.ksql.parser.tree.Expression) HashMap(java.util.HashMap) CreateTable(io.confluent.ksql.parser.tree.CreateTable) EasyMock.anyString(org.easymock.EasyMock.anyString) KsqlException(io.confluent.ksql.util.KsqlException) TableElement(io.confluent.ksql.parser.tree.TableElement) Test(org.junit.Test)

Aggregations

TableElement (io.confluent.ksql.parser.tree.TableElement)6 Expression (io.confluent.ksql.parser.tree.Expression)5 StringLiteral (io.confluent.ksql.parser.tree.StringLiteral)5 HashMap (java.util.HashMap)5 EasyMock.anyString (org.easymock.EasyMock.anyString)4 Test (org.junit.Test)4 CreateTable (io.confluent.ksql.parser.tree.CreateTable)3 KsqlException (io.confluent.ksql.util.KsqlException)3 SchemaMetadata (io.confluent.kafka.schemaregistry.client.SchemaMetadata)1 SchemaRegistryClient (io.confluent.kafka.schemaregistry.client.SchemaRegistryClient)1 KsqlEngine (io.confluent.ksql.KsqlEngine)1 CreateStreamCommand (io.confluent.ksql.ddl.commands.CreateStreamCommand)1 RegisterTopicCommand (io.confluent.ksql.ddl.commands.RegisterTopicCommand)1 AbstractStreamCreateStatement (io.confluent.ksql.parser.tree.AbstractStreamCreateStatement)1 CreateStream (io.confluent.ksql.parser.tree.CreateStream)1 RegisterTopic (io.confluent.ksql.parser.tree.RegisterTopic)1 ServerInfo (io.confluent.ksql.rest.entity.ServerInfo)1 Command (io.confluent.ksql.rest.server.computation.Command)1 CommandId (io.confluent.ksql.rest.server.computation.CommandId)1 CommandIdAssigner (io.confluent.ksql.rest.server.computation.CommandIdAssigner)1