// collect all uids used in the filter plan
Set<Long> uids = collectUidFromExpPlan(filterPlan);
if( pred instanceof LOCogroup ) {
LOCogroup cogrp = (LOCogroup)pred;
if( preds.size() == 1 ) {
if( hasAll( (LogicalRelationalOperator)preds.get( 0 ), uids ) ) {
// Order by is ok if all UIDs can be found from previous operator.
return true;
}
} else if ( 1 == cogrp.getExpressionPlans().get( 0 ).size() && !containUDF( filterPlan ) ) {
// Optimization is possible if there is only a single key.
// For regular cogroup, we cannot use UIDs to determine if filter can be pushed up.
// But if there is no UDF, it's okay, as only UDF can take bag field as input.
return true;
}