use of io.confluent.ksql.parser.SqlBaseParser.SingleStatementContext in project ksql by confluentinc.
the class AstBuilderTest method shouldSupportQuotedExplainStatements.
@Test
public void shouldSupportQuotedExplainStatements() {
// Given:
final SingleStatementContext stmt = givenQuery("EXPLAIN `CSAS_FOO-BAR`;");
// When:
final Explain explain = (Explain) builder.buildStatement(stmt);
// Then:
assertThat(explain.getQueryId(), is(Optional.of("CSAS_FOO-BAR")));
}
use of io.confluent.ksql.parser.SqlBaseParser.SingleStatementContext in project ksql by confluentinc.
the class AstBuilderTest method shouldSupportExplicitEmitChangesForCtas.
@Test
public void shouldSupportExplicitEmitChangesForCtas() {
// Given:
final SingleStatementContext stmt = givenQuery("CREATE TABLE X AS SELECT COUNT(1) FROM TEST1 GROUP BY ROWKEY 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));
}
use of io.confluent.ksql.parser.SqlBaseParser.SingleStatementContext in project ksql by confluentinc.
the class AstBuilderTest method shouldHandleQualifiedSelectStarOnRightJoinSource.
@Test
public void shouldHandleQualifiedSelectStarOnRightJoinSource() {
// Given:
final SingleStatementContext stmt = givenQuery("SELECT TEST2.* FROM TEST1 JOIN TEST2 WITHIN 1 SECOND ON TEST1.ID = TEST2.ID;");
// When:
final Query result = (Query) builder.buildStatement(stmt);
// Then:
assertThat(result.getSelect(), is(new Select(ImmutableList.of(new AllColumns(Optional.of(TEST2_NAME))))));
}
use of io.confluent.ksql.parser.SqlBaseParser.SingleStatementContext in project ksql by confluentinc.
the class AstBuilderTest method shouldHandleAliasQualifiedSelectStarOnLeftJoinSource.
@Test
public void shouldHandleAliasQualifiedSelectStarOnLeftJoinSource() {
// Given:
final SingleStatementContext stmt = givenQuery("SELECT T1.* FROM TEST1 T1 JOIN TEST2 WITHIN 1 SECOND ON T1.ID = TEST2.ID;");
// When:
final Query result = (Query) builder.buildStatement(stmt);
// Then:
assertThat(result.getSelect(), is(new Select(ImmutableList.of(new AllColumns(Optional.of(SourceName.of("T1")))))));
}
use of io.confluent.ksql.parser.SqlBaseParser.SingleStatementContext in project ksql by confluentinc.
the class AstBuilderTest method shouldCreateSourceStream.
public void shouldCreateSourceStream() {
// Given:
final SingleStatementContext stmt = givenQuery("CREATE SOURCE STREAM X WITH (kafka_topic='X');");
// When:
final CreateStream result = (CreateStream) builder.buildStatement(stmt);
// Then:
assertThat(result.isSource(), is(true));
}
Aggregations