TPreptimeValue emptyTPV = new TPreptimeValue();
TValidatedScalar isNull = typesRegistryService.getScalarsResolver().get("IsNull", Collections.nCopies(1, emptyTPV)).getOverload();
TValidatedScalar not = typesRegistryService.getScalarsResolver().get("NOT", Collections.nCopies(1, emptyTPV)).getOverload();
TValidatedScalar and = typesRegistryService.getScalarsResolver().get("AND", Collections.nCopies(2, emptyTPV)).getOverload();
TInstance boolType = AkBool.INSTANCE.instance(false);
TPreparedExpression predicate = null;
for (int i = 0; i < plan.ncols; i++) {
Column referencingColumn = referencingColumns.get(i);
TPreparedField field = new TPreparedField(referencingColumn.getType(), referencingColumn.getPosition());
TPreparedExpression clause = new TPreparedFunction(isNull, boolType, Arrays.asList(field));
clause = new TPreparedFunction(not, boolType, Arrays.asList(clause));
if (predicate == null) {
predicate = clause;
}
else {