use of io.confluent.ksql.execution.plan.StreamFilter in project ksql by confluentinc.
the class StepSchemaResolverTest method shouldResolveSchemaForStreamFilter.
@Test
public void shouldResolveSchemaForStreamFilter() {
// Given:
final StreamFilter<?> step = new StreamFilter<>(PROPERTIES, streamSource, mock(Expression.class));
// When:
final LogicalSchema result = resolver.resolve(step, SCHEMA);
// Then:
assertThat(result, is(SCHEMA));
}
use of io.confluent.ksql.execution.plan.StreamFilter in project ksql by confluentinc.
the class SchemaKStreamTest method shouldRewriteTimeComparisonInFilter.
@Test
@SuppressWarnings("rawtypes")
public void shouldRewriteTimeComparisonInFilter() {
// Given:
final PlanNode logicalPlan = givenInitialKStreamOf("SELECT col0, col2, col3 FROM test1 " + "WHERE ROWTIME = '1984-01-01T00:00:00+00:00' EMIT CHANGES;");
final FilterNode filterNode = (FilterNode) logicalPlan.getSources().get(0).getSources().get(0);
// When:
final SchemaKStream<?> filteredSchemaKStream = initialSchemaKStream.filter(filterNode.getPredicate(), childContextStacker);
// Then:
final StreamFilter step = (StreamFilter) filteredSchemaKStream.getSourceStep();
assertThat(step.getFilterExpression(), equalTo(new ComparisonExpression(ComparisonExpression.Type.EQUAL, new UnqualifiedColumnReferenceExp(ColumnName.of("ROWTIME")), new LongLiteral(441763200000L))));
}
Aggregations