private SemanticNodeProcessor getBucketSortReduceSinkProc(ParseContext pctx) {
    return new BucketSortReduceSinkProcessor(pctx);
  }
This transformation does optimization for enforcing bucketing and sorting.
For a query of the form:
insert overwrite table T1 select * from T2;
where T1 and T2 are bucketized/sorted on the same keys, we don't need a reducer to
enforce bucketing and sorting.

It also optimizes queries of the form:
insert overwrite table T1
select * from T1 join T2 on T1.key = T2.key
where T1, T2 and T3 are bucketized/sorted on the same key 'key', we don't need a reducer
to enforce bucketing and sorting
ql/src/java/org/apache/hadoop/hive/ql/optimizer/BucketingSortingReduceSinkOptimizer.java