Search in sources :

Example 1 with DescribeTables

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

the class KsqlParserTest method testDescribeTablesExtended.

@Test
public void testDescribeTablesExtended() {
    final String statementString = "DESCRIBE TABLES EXTENDED;";
    final Statement statement = KsqlParserTestUtil.buildSingleAst(statementString, metaStore).getStatement();
    assertThat(statement, instanceOf(DescribeTables.class));
    final DescribeTables describeTables = (DescribeTables) statement;
    assertThat(describeTables.getShowExtended(), is(true));
}
Also used : DescribeTables(io.confluent.ksql.parser.tree.DescribeTables) Statement(io.confluent.ksql.parser.tree.Statement) PreparedStatement(io.confluent.ksql.parser.KsqlParser.PreparedStatement) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 2 with DescribeTables

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

the class SqlFormatterTest method shouldFormatDescribeTables.

@Test
public void shouldFormatDescribeTables() {
    // Given:
    final DescribeTables describeTables = new DescribeTables(Optional.empty(), false);
    // When:
    final String formatted = SqlFormatter.formatSql(describeTables);
    // Then:
    assertThat(formatted, is("DESCRIBE TABLES"));
}
Also used : DescribeTables(io.confluent.ksql.parser.tree.DescribeTables) StringContains.containsString(org.hamcrest.core.StringContains.containsString) Test(org.junit.Test)

Example 3 with DescribeTables

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

the class ListSourceExecutor method describeTables.

public static StatementExecutorResponse describeTables(final ConfiguredStatement<DescribeTables> statement, final SessionProperties sessionProperties, final KsqlExecutionContext executionContext, final ServiceContext serviceContext) {
    final List<KsqlTable<?>> ksqlTables = getSpecificTables(executionContext);
    final DescribeTables describeTables = statement.getStatement();
    return StatementExecutorResponse.handled(sourceDescriptionList(statement, sessionProperties, executionContext, serviceContext, ksqlTables, describeTables.getShowExtended()));
}
Also used : DescribeTables(io.confluent.ksql.parser.tree.DescribeTables) KsqlTable(io.confluent.ksql.metastore.model.KsqlTable)

Example 4 with DescribeTables

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

the class KsqlParserTest method testDescribeTables.

@Test
public void testDescribeTables() {
    final String statementString = "DESCRIBE TABLES;";
    final Statement statement = KsqlParserTestUtil.buildSingleAst(statementString, metaStore).getStatement();
    assertThat(statement, instanceOf(DescribeTables.class));
    final DescribeTables describeTables = (DescribeTables) statement;
    assertThat(describeTables.getShowExtended(), is(false));
}
Also used : DescribeTables(io.confluent.ksql.parser.tree.DescribeTables) Statement(io.confluent.ksql.parser.tree.Statement) PreparedStatement(io.confluent.ksql.parser.KsqlParser.PreparedStatement) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Aggregations

DescribeTables (io.confluent.ksql.parser.tree.DescribeTables)4 Test (org.junit.Test)3 PreparedStatement (io.confluent.ksql.parser.KsqlParser.PreparedStatement)2 Statement (io.confluent.ksql.parser.tree.Statement)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 KsqlTable (io.confluent.ksql.metastore.model.KsqlTable)1 StringContains.containsString (org.hamcrest.core.StringContains.containsString)1