Mutable<ILogicalOperator> joinOpRef = findJoinOp(assignOp.getInputs().get(0)); if (joinOpRef == null) { return false; gatherFunctionCalls(assignOp, funcExprs); if (funcExprs.isEmpty()) { return false; if (pushDownFunctions(joinOp, 0, funcExprs, context)) { modified = true; if (pushDownFunctions(joinOp, 1, funcExprs, context)) { modified = true;
private void gatherFunctionCalls(AssignOperator assignOp, List<Mutable<ILogicalExpression>> funcExprs) { for (Mutable<ILogicalExpression> exprRef : assignOp.getExpressions()) { gatherFunctionCalls(exprRef, funcExprs); } }
private Mutable<ILogicalOperator> findJoinOp(Mutable<ILogicalOperator> opRef) { AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); switch (op.getOperatorTag()) { case INNERJOIN: case LEFTOUTERJOIN: { return opRef; } // Bail on these operators. case GROUP: case AGGREGATE: case DISTINCT: case UNNEST_MAP: { return null; } // Traverse children. default: { for (Mutable<ILogicalOperator> childOpRef : op.getInputs()) { return findJoinOp(childOpRef); } } } return null; }
private void gatherFunctionCalls(Mutable<ILogicalExpression> exprRef, List<Mutable<ILogicalExpression>> funcExprs) { AbstractLogicalExpression expr = (AbstractLogicalExpression) exprRef.getValue(); if (expr.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) { return; } // Check whether the function is a function we want to push. AbstractFunctionCallExpression funcExpr = (AbstractFunctionCallExpression) expr; if (toPushFuncIdents.contains(funcExpr.getFunctionIdentifier())) { funcExprs.add(exprRef); } // Traverse arguments. for (Mutable<ILogicalExpression> funcArg : funcExpr.getArguments()) { gatherFunctionCalls(funcArg, funcExprs); } }