Source:
private static JoinFilterAnalysis rewriteFilterDirect( Filter filterClause, JoinFilterPreAnalysis joinFilterPreAnalysis, Map<Expr, VirtualColumn> pushDownVirtualColumnsForLhsExprs ) { if (!filterClause.supportsRequiredColumnRewrite()) { return JoinFilterAnalysis.createNoPushdownFilterAnalysis(filterClause); } List<Filter> newFilters = new ArrayList<>(); String reqColumn = filterClause.getRequiredColumns().iterator().next(); Optional<List<JoinFilterColumnCorrelationAnalysis>> correlationAnalyses = joinFilterPreAnalysis.getCorrelationsByFilteringColumn() .get(reqColumn); if (!correlationAnalyses.isPresent()) { return JoinFilterAnalysis.createNoPushdownFilterAnalysis(filterClause); } for (JoinFilterColumnCorrelationAnalysis correlationAnalysis : correlationAnalyses.get()) { if (correlationAnalysis.supportsPushDown()) { for (String correlatedBaseColumn : correlationAnalysis.getBaseColumns()) { Filter rewrittenFilter = filterClause.rewriteRequiredColumns(ImmutableMap.of( reqColumn, correlatedBaseColumn )); newFilters.add(rewrittenFilter); } for (Expr correlatedBaseExpr : correlationAnalysis.getBaseExpressions()) { VirtualColumn pushDownVirtualColumn = pushDownVirtualColumnsForLhsExprs.computeIfAbsent( correlatedBaseExpr, (expr) -> { String vcName = getCorrelatedBaseExprVirtualColumnName(pushDownVirtualColumnsForLhsExprs.size()); return new ExpressionVirtualColumn( vcName, correlatedBaseExpr, ValueType.STRING ); } ); Filter rewrittenFilter = filterClause.rewriteRequiredColumns(ImmutableMap.of( reqColumn, pushDownVirtualColumn.getOutputName() )); newFilters.add(rewrittenFilter); } } } if (newFilters.isEmpty()) { return JoinFilterAnalysis.createNoPushdownFilterAnalysis(filterClause); } return new JoinFilterAnalysis( false, filterClause, Filters.and(newFilters) ); }

Target:
private static JoinFilterAnalysis rewriteFilterDirect( Filter filterClause, JoinFilterPreAnalysis joinFilterPreAnalysis, Map<Expr, VirtualColumn> pushDownVirtualColumnsForLhsExprs ) { if (!filterClause.supportsRequiredColumnRewrite()) { return JoinFilterAnalysis.createNoPushdownFilterAnalysis(filterClause); } List<Filter> newFilters = new ArrayList<>(); String reqColumn = filterClause.getRequiredColumns().iterator().next(); List<JoinFilterColumnCorrelationAnalysis> correlationAnalyses = joinFilterPreAnalysis.getCorrelationsByDirectFilteringColumn() .get(reqColumn); if (correlationAnalyses == null) { return JoinFilterAnalysis.createNoPushdownFilterAnalysis(filterClause); } for (JoinFilterColumnCorrelationAnalysis correlationAnalysis : correlationAnalyses) { if (correlationAnalysis.supportsPushDown()) { for (String correlatedBaseColumn : correlationAnalysis.getBaseColumns()) { Filter rewrittenFilter = filterClause.rewriteRequiredColumns(ImmutableMap.of( reqColumn, correlatedBaseColumn )); newFilters.add(rewrittenFilter); } for (Expr correlatedBaseExpr : correlationAnalysis.getBaseExpressions()) { VirtualColumn pushDownVirtualColumn = pushDownVirtualColumnsForLhsExprs.computeIfAbsent( correlatedBaseExpr, (expr) -> { String vcName = getCorrelatedBaseExprVirtualColumnName(pushDownVirtualColumnsForLhsExprs.size()); return new ExpressionVirtualColumn( vcName, correlatedBaseExpr, ValueType.STRING ); } ); Filter rewrittenFilter = filterClause.rewriteRequiredColumns(ImmutableMap.of( reqColumn, pushDownVirtualColumn.getOutputName() )); newFilters.add(rewrittenFilter); } } } if (newFilters.isEmpty()) { return JoinFilterAnalysis.createNoPushdownFilterAnalysis(filterClause); } return new JoinFilterAnalysis( false, filterClause, Filters.and(newFilters) ); }