@Override public Matcher visit(IsNull isNull) { return isNull .getField() .accept( new VisitorAdapter<Matcher>() { @Override public Matcher visit(final Field field) { return new Matcher() { @Override public boolean match(DataRecord record) { return record.get(field.getFieldMetadata()) == null; } }; } @Override public Matcher visit(StagingBlockKey stagingBlockKey) { return new Matcher() { @Override public boolean match(DataRecord record) { return record .getRecordMetadata() .getRecordProperties() .get(StagingStorage.METADATA_STAGING_BLOCK_KEY) == null; } }; } }); }
@Override public void visit(IsNull obj) { visitNode(obj.getExpression()); Column column = (Column) onGoingExpression.pop(); // this will never be part of the rowid, as it can never be null, so scan this.doScanEvaluation = true; }
@SuppressWarnings("rawtypes") public static FilterConditionContext visit( IsNull obj, QueryBuilder queryBuilder, FilterConditionBeginContext fcbc) { LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing IsNull criteria."); // $NON-NLS-1$ Expression exp = obj.getExpression(); Column c = ((ColumnReference) exp).getMetadataObject(); if (fcbc == null) { if (obj.isNegated()) { return queryBuilder.not().having(c.getSourceName()).isNull(); } return queryBuilder.having(c.getSourceName()).isNull(); } if (obj.isNegated()) { return fcbc.not().having(c.getSourceName()).isNull(); } return fcbc.having(c.getSourceName()).isNull(); }