use of io.confluent.ksql.execution.expression.tree.SearchedCaseExpression in project ksql by confluentinc.
the class KsqlParserTest method getSearchedCaseExpressionFromCsas.
private static SearchedCaseExpression getSearchedCaseExpressionFromCsas(final Statement statement) {
final Query query = ((CreateStreamAsSelect) statement).getQuery();
final Expression caseExpression = ((SingleColumn) query.getSelect().getSelectItems().get(0)).getExpression();
return (SearchedCaseExpression) caseExpression;
}
use of io.confluent.ksql.execution.expression.tree.SearchedCaseExpression in project ksql by confluentinc.
the class KsqlParserTest method shouldBuildSearchedCaseWithoutDefaultStatement.
@Test
public void shouldBuildSearchedCaseWithoutDefaultStatement() {
// Given:
final String statementString = "CREATE STREAM S AS SELECT CASE WHEN orderunits < 10 THEN 'small' WHEN orderunits < 100 THEN 'medium' END FROM orders;";
// When:
final Statement statement = KsqlParserTestUtil.buildSingleAst(statementString, metaStore).getStatement();
// Then:
final SearchedCaseExpression searchedCaseExpression = getSearchedCaseExpressionFromCsas(statement);
assertThat(searchedCaseExpression.getDefaultValue().isPresent(), equalTo(false));
}
Aggregations