Map<Rule, NodeProcessor> opRules = new LinkedHashMap<Rule, NodeProcessor>();
opRules.put(new RuleRegExp("R1", SelectOperator.getOperatorName() + "%"),
BucketingSortingOpProcFactory.getSelProc());
// Matches only GroupByOpeartors which are reducers, rather than map group by operators,
// or multi group by optimization specific operators
opRules.put(new RuleExactMatch("R2", GroupByOperator.getOperatorName() + "%"),
BucketingSortingOpProcFactory.getGroupByProc());
// Matches only JoinOperators which are reducers, rather than map joins, SMB map joins, etc.
opRules.put(new RuleExactMatch("R3", JoinOperator.getOperatorName() + "%"),
BucketingSortingOpProcFactory.getJoinProc());
opRules.put(new RuleRegExp("R5", FileSinkOperator.getOperatorName() + "%"),
BucketingSortingOpProcFactory.getFileSinkProc());
// Matches only ExtractOperators which are reducers
opRules.put(new RuleExactMatch("R6", ExtractOperator.getOperatorName() + "%"),
BucketingSortingOpProcFactory.getExtractProc());
opRules.put(new RuleRegExp("R7", FilterOperator.getOperatorName() + "%"),
BucketingSortingOpProcFactory.getFilterProc());
opRules.put(new RuleRegExp("R8", LimitOperator.getOperatorName() + "%"),
BucketingSortingOpProcFactory.getLimitProc());
opRules.put(new RuleRegExp("R9", LateralViewForwardOperator.getOperatorName() + "%"),
BucketingSortingOpProcFactory.getLateralViewForwardProc());
opRules.put(new RuleRegExp("R10", LateralViewJoinOperator.getOperatorName() + "%"),
BucketingSortingOpProcFactory.getLateralViewJoinProc());
// Matches only ForwardOperators which are preceded by some other operator in the tree,
// in particular it can't be a reducer (and hence cannot be one of the ForwardOperators
// added by the multi group by optimization)
opRules.put(new RuleRegExp("R11", ".+" + ForwardOperator.getOperatorName() + "%"),
BucketingSortingOpProcFactory.getForwardProc());
// Matches only ForwardOperators which are reducers and are followed by GroupByOperators
// (specific to the multi group by optimization)
opRules.put(new RuleExactMatch("R12", ForwardOperator.getOperatorName() + "%" +
GroupByOperator.getOperatorName() + "%"),
BucketingSortingOpProcFactory.getMultiGroupByProc());
// The dispatcher fires the processor corresponding to the closest matching rule and passes
// the context along