Search in sources :

Example 11 with QueryContainer

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

the class AstBuilderTest method shouldSupportExplicitEmitChangesForCsas.

@Test
public void shouldSupportExplicitEmitChangesForCsas() {
    // Given:
    final SingleStatementContext stmt = givenQuery("CREATE STREAM X AS SELECT * FROM TEST1 EMIT CHANGES;");
    // When:
    final Query result = ((QueryContainer) builder.buildStatement(stmt)).getQuery();
    // Then:
    assertThat("Should be push", result.isPullQuery(), is(false));
    assertThat(result.getRefinement().get().getOutputRefinement(), is(OutputRefinement.CHANGES));
}
Also used : Query(io.confluent.ksql.parser.tree.Query) SingleStatementContext(io.confluent.ksql.parser.SqlBaseParser.SingleStatementContext) QueryContainer(io.confluent.ksql.parser.tree.QueryContainer) Test(org.junit.Test)

Aggregations

QueryContainer (io.confluent.ksql.parser.tree.QueryContainer)11 Query (io.confluent.ksql.parser.tree.Query)10 SingleStatementContext (io.confluent.ksql.parser.SqlBaseParser.SingleStatementContext)9 Test (org.junit.Test)9 KsqlException (io.confluent.ksql.util.KsqlException)2 KsqlStatementException (io.confluent.ksql.util.KsqlStatementException)2 KsqlExecutionContext (io.confluent.ksql.KsqlExecutionContext)1 DdlCommand (io.confluent.ksql.execution.ddl.commands.DdlCommand)1 PreparedStatement (io.confluent.ksql.parser.KsqlParser.PreparedStatement)1 CreateStream (io.confluent.ksql.parser.tree.CreateStream)1 CreateTable (io.confluent.ksql.parser.tree.CreateTable)1 ExecutableDdlStatement (io.confluent.ksql.parser.tree.ExecutableDdlStatement)1 Statement (io.confluent.ksql.parser.tree.Statement)1 KsqlStructuredDataOutputNode (io.confluent.ksql.planner.plan.KsqlStructuredDataOutputNode)1 ConfiguredStatement (io.confluent.ksql.statement.ConfiguredStatement)1 PersistentQueryMetadata (io.confluent.ksql.util.PersistentQueryMetadata)1 QueryMetadata (io.confluent.ksql.util.QueryMetadata)1