@Override
    public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx,
        Object... nodeOutputs) throws SemanticException {
    	
      SelectOperator sel = (SelectOperator)nd;
      List<Operator<? extends OperatorDesc>> parents = sel.getParentOperators();
      if (parents.size() != 1 || parents.get(0) instanceof LateralViewForwardOperator) {
        // Multi parents, cant handle that.
        // Right now, we do not remove projection on top of
        // LateralViewForward operators.
        return null;
      }
      Operator<? extends OperatorDesc> parent = parents.get(0);
      if (parent instanceof ReduceSinkOperator && Iterators.any(sel.getChildOperators().iterator(),
          Predicates.instanceOf(ReduceSinkOperator.class))) {
        // For RS-SEL-RS case. reducer operator in reducer task cannot be null in task compiler
        return null;
      }
      List<Operator<? extends OperatorDesc>> ancestorList = new ArrayList<Operator<? extends OperatorDesc>>();
      ancestorList.addAll(sel.getParentOperators());
      while (!ancestorList.isEmpty()) {
        Operator<? extends OperatorDesc> curParent = ancestorList.remove(0);
            // PTF need a SelectOp.
        if ((curParent instanceof PTFOperator)) {
          return null;
        }
        if ((curParent instanceof FilterOperator) && curParent.getParentOperators() != null) {
          ancestorList.addAll(curParent.getParentOperators());
        }
      }

      if(sel.isIdentitySelect()) {
        parent.removeChildAndAdoptItsChildren(sel);
        LOG.debug("Identity project remover optimization removed : " + sel);
      }
      return null;
    }
This optimization tries to remove {@link SelectOperator} from tree which don't do any
processing except forwarding columns from its parent to its children.
e.g., select * from (select * from src where key = value) t1 join (select * from src where key = value) t2;
Query tree

 Without this optimization:

 TS -&gt; FIL -&gt; SEL -&gt; RS -&gt;
                            JOIN -&gt; SEL -&gt; FS
 TS -&gt; FIL -&gt; SEL -&gt; RS -&gt;

 With this optimization

 TS -&gt; FIL -&gt; RS -&gt;
                     JOIN -&gt; FS
 TS -&gt; FIL -&gt; RS -&gt;

 Note absence of select operator after filter and after join operator.
 Also, see : identity_proj_remove.q
ql/src/java/org/apache/hadoop/hive/ql/optimizer/IdentityProjectRemover.java