final List<TransferPair> transfers = Lists.newArrayList();
final CodeGenerator<Filterer> cg = new CodeGenerator<Filterer>(Filterer.TEMPLATE_DEFINITION, context.getFunctionRegistry());
final LogicalExpression expr = ExpressionTreeMaterializer.materialize(filterExpression, incoming, collector);
if(collector.hasErrors()){
throw new SchemaChangeException(String.format("Failure while trying to materialize incoming schema. Errors:\n %s.", collector.toErrorString()));
}
cg.addExpr(new ReturnValueExpression(expr));
for(VectorWrapper<?> v : incoming){
TransferPair pair = v.getValueVector().getTransferPair();
container.add(pair.getTo());
transfers.add(pair);
}
container.buildSchema(SelectionVectorMode.TWO_BYTE);
try {
TransferPair[] tx = transfers.toArray(new TransferPair[transfers.size()]);
this.filter = context.getImplementationClass(cg);
filter.setup(context, incoming, this, tx);
} catch (ClassTransformationException | IOException e) {
throw new SchemaChangeException("Failure while attempting to load generated class", e);
}
}