Search in sources :

Example 1 with DescribeStreams

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

the class SqlFormatterTest method shouldFormatDescribeStreams.

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

Example 2 with DescribeStreams

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

the class KsqlParserTest method testDescribeStreams.

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

Example 3 with DescribeStreams

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

the class KsqlParserTest method testDescribeStreamsExtended.

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

Example 4 with DescribeStreams

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

the class ListSourceExecutor method describeStreams.

public static StatementExecutorResponse describeStreams(final ConfiguredStatement<DescribeStreams> statement, final SessionProperties sessionProperties, final KsqlExecutionContext executionContext, final ServiceContext serviceContext) {
    final List<KsqlStream<?>> ksqlStreams = getSpecificStreams(executionContext);
    final DescribeStreams describeStreams = statement.getStatement();
    return StatementExecutorResponse.handled(sourceDescriptionList(statement, sessionProperties, executionContext, serviceContext, ksqlStreams, describeStreams.getShowExtended()));
}
Also used : KsqlStream(io.confluent.ksql.metastore.model.KsqlStream) DescribeStreams(io.confluent.ksql.parser.tree.DescribeStreams)

Aggregations

DescribeStreams (io.confluent.ksql.parser.tree.DescribeStreams)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 KsqlStream (io.confluent.ksql.metastore.model.KsqlStream)1 StringContains.containsString (org.hamcrest.core.StringContains.containsString)1