Search in sources :

Example 1 with QueryContainer

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

the class AstBuilderTest method shouldSupportExplicitEmitFinalForInsertInto.

@Test
public void shouldSupportExplicitEmitFinalForInsertInto() {
    // Given:
    final SingleStatementContext stmt = givenQuery("INSERT INTO TEST1 SELECT * FROM TEST2 EMIT FINAL;");
    // 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.FINAL));
}
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)

Example 2 with QueryContainer

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

the class AstBuilderTest method shouldSupportExplicitEmitFinalForCsas.

@Test
public void shouldSupportExplicitEmitFinalForCsas() {
    // Given:
    final SingleStatementContext stmt = givenQuery("CREATE STREAM X AS SELECT * FROM TEST1 EMIT FINAL;");
    // 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.FINAL));
}
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)

Example 3 with QueryContainer

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

the class AstBuilderTest method shouldDefaultToEmitChangesForCtas.

@Test
public void shouldDefaultToEmitChangesForCtas() {
    // Given:
    final SingleStatementContext stmt = givenQuery("CREATE TABLE X AS SELECT COUNT(1) FROM TEST1 GROUP BY ROWKEY;");
    // 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)

Example 4 with QueryContainer

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

the class AstBuilderTest method shouldDefaultToEmitChangesForInsertInto.

@Test
public void shouldDefaultToEmitChangesForInsertInto() {
    // Given:
    final SingleStatementContext stmt = givenQuery("INSERT INTO TEST1 SELECT * FROM TEST2;");
    // 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)

Example 5 with QueryContainer

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

the class AstBuilderTest method shouldSupportExplicitEmitFinalForCtas.

@Test
public void shouldSupportExplicitEmitFinalForCtas() {
    // Given:
    final SingleStatementContext stmt = givenQuery("CREATE TABLE X AS SELECT COUNT(1) FROM TEST1 GROUP BY ROWKEY EMIT FINAL;");
    // 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.FINAL));
}
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