Source:
<code>public PlanNode visitFilter(FilterNode node, Void context) { if (!(node.getSource() instanceof TableScanNode)) { return node; } TableScanNode oldTableScanNode = (TableScanNode) node.getSource(); TableHandle oldTableHandle = oldTableScanNode.getTable(); JdbcTableHandle oldConnectorTable = (JdbcTableHandle) oldTableHandle.getConnectorHandle(); RowExpression toTranslate = expressionOptimizer.optimize(node.getPredicate(), OPTIMIZED, session); toTranslate = logicalRowExpressions.convertToConjunctiveNormalForm(toTranslate); TranslatedExpression<JdbcSql> jdbcSqlTranslatedExpression = translateWith( toTranslate, rowExpressionToSqlTranslator, oldTableScanNode.getAssignments()); if (!oldTableHandle.getLayout().isPresent() || !jdbcSqlTranslatedExpression.getTranslated().isPresent()) { return node; } JdbcTableLayoutHandle oldTableLayoutHandle = (JdbcTableLayoutHandle) oldTableHandle.getLayout().get(); JdbcTableLayoutHandle newTableLayoutHandle = new JdbcTableLayoutHandle( oldConnectorTable, oldTableLayoutHandle.getTupleDomain(), jdbcSqlTranslatedExpression.getTranslated()); <START> <END> TableHandle tableHandle = new TableHandle( oldTableHandle.getConnectorId(), oldTableHandle.getConnectorHandle(), oldTableHandle.getTransaction(), Optional.of(newTableLayoutHandle)); TableScanNode newTableScanNode = new TableScanNode( idAllocator.getNextId(), tableHandle, oldTableScanNode.getOutputVariables(), oldTableScanNode.getAssignments(), oldTableScanNode.getCurrentConstraint(), oldTableScanNode.getEnforcedConstraint()); return new FilterNode(idAllocator.getNextId(), newTableScanNode, node.getPredicate()); }</code><technical_language>do finer granularity checking if jdbcSqlTranslatedExpression.getTranslated() is present. A is traverse translated expression walking AND/OR decide part pushed down</technical_language>

Target:
public PlanNode visitFilter(FilterNode node, Void context) { if (!(node.getSource() instanceof TableScanNode)) { return node; } TableScanNode oldTableScanNode = (TableScanNode) node.getSource(); TableHandle oldTableHandle = oldTableScanNode.getTable(); JdbcTableHandle oldConnectorTable = (JdbcTableHandle) oldTableHandle.getConnectorHandle(); RowExpression predicate = expressionOptimizer.optimize(node.getPredicate(), OPTIMIZED, session); predicate = logicalRowExpressions.convertToConjunctiveNormalForm(predicate); TranslatedExpression<JdbcExpression> jdbcExpression = translateWith( predicate, jdbcFilterToSqlTranslator, oldTableScanNode.getAssignments()); if (!oldTableHandle.getLayout().isPresent() || !jdbcExpression.getTranslated().isPresent()) { return node; } JdbcTableLayoutHandle oldTableLayoutHandle = (JdbcTableLayoutHandle) oldTableHandle.getLayout().get(); JdbcTableLayoutHandle newTableLayoutHandle = new JdbcTableLayoutHandle( oldConnectorTable, oldTableLayoutHandle.getTupleDomain(), jdbcExpression.getTranslated()); TableHandle tableHandle = new TableHandle( oldTableHandle.getConnectorId(), oldTableHandle.getConnectorHandle(), oldTableHandle.getTransaction(), Optional.of(newTableLayoutHandle)); TableScanNode newTableScanNode = new TableScanNode( idAllocator.getNextId(), tableHandle, oldTableScanNode.getOutputVariables(), oldTableScanNode.getAssignments(), oldTableScanNode.getCurrentConstraint(), oldTableScanNode.getEnforcedConstraint()); return new FilterNode(idAllocator.getNextId(), newTableScanNode, node.getPredicate()); }