use of io.confluent.ksql.planner.plan.FilterNode in project ksql by confluentinc.
the class SqlPredicateTest method testFilterBiggerExpression.
@Test
public void testFilterBiggerExpression() throws Exception {
String selectQuery = "SELECT col0, col2, col3 FROM test1 WHERE col0 > 100 AND LEN(col2) = 5;";
PlanNode logicalPlan = buildLogicalPlan(selectQuery);
FilterNode filterNode = (FilterNode) logicalPlan.getSources().get(0).getSources().get(0);
initialSchemaKStream = new SchemaKStream(logicalPlan.getTheSourceNode().getSchema(), kStream, ksqlStream.getKeyField(), new ArrayList<>(), SchemaKStream.Type.SOURCE, functionRegistry, new MockSchemaRegistryClient());
SqlPredicate predicate = new SqlPredicate(filterNode.getPredicate(), initialSchemaKStream.getSchema(), false, functionRegistry);
Assert.assertTrue(predicate.getFilterExpression().toString().equalsIgnoreCase("((TEST1.COL0 > 100) AND" + " (LEN(TEST1.COL2) = 5))"));
Assert.assertTrue(predicate.getColumnIndexes().length == 3);
}
Aggregations