Search in sources :

Example 1 with ShowColumns

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

the class KsqlResourceTest method testDescribeStatement.

@Test
public void testDescribeStatement() throws Exception {
    KsqlResource testResource = TestKsqlResourceUtil.get(ksqlEngine, ksqlRestConfig);
    final String tableName = "TEST_TABLE";
    final String ksqlString = String.format("DESCRIBE %s;", tableName);
    final ShowColumns ksqlStatement = new ShowColumns(QualifiedName.of(tableName), false, false);
    SourceDescription testDescription = makeSingleRequest(testResource, ksqlString, ksqlStatement, Collections.emptyMap(), SourceDescription.class);
    SourceDescription expectedDescription = new SourceDescription(testResource.getKsqlEngine().getMetaStore().getSource(tableName), false, "serdes", "topo", "exec-plan", Collections.EMPTY_LIST, Collections.EMPTY_LIST, null);
    assertEquals(expectedDescription, testDescription);
}
Also used : ShowColumns(io.confluent.ksql.parser.tree.ShowColumns) SourceDescription(io.confluent.ksql.rest.entity.SourceDescription) Test(org.junit.Test)

Example 2 with ShowColumns

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

the class KsqlResourceTest method testErroneousStatement.

@Test
public void testErroneousStatement() throws Exception {
    KsqlResource testResource = TestKsqlResourceUtil.get(ksqlEngine, ksqlRestConfig);
    final String ksqlString = "DESCRIBE nonexistent_table;";
    final ShowColumns ksqlStatement = new ShowColumns(QualifiedName.of("nonexistent_table"), false, false);
    KsqlEntity resultEntity = makeSingleRequest(testResource, ksqlString, ksqlStatement, Collections.emptyMap(), ErrorMessageEntity.class);
    assertEquals(ErrorMessageEntity.class, resultEntity.getClass());
}
Also used : ShowColumns(io.confluent.ksql.parser.tree.ShowColumns) KsqlEntity(io.confluent.ksql.rest.entity.KsqlEntity) Test(org.junit.Test)

Aggregations

ShowColumns (io.confluent.ksql.parser.tree.ShowColumns)2 Test (org.junit.Test)2 KsqlEntity (io.confluent.ksql.rest.entity.KsqlEntity)1 SourceDescription (io.confluent.ksql.rest.entity.SourceDescription)1