public static UnionWork createUnionWork(
      GenTezProcContext context, Operator<?> root, Operator<?> leaf, TezWork tezWork) {
    UnionWork unionWork = new UnionWork("Union "+ context.nextSequenceNumber());
    context.rootUnionWorkMap.put(root, unionWork);
    context.unionWorkMap.put(leaf, unionWork);
    tezWork.add(unionWork);
    return unionWork;
  }
GenTezUtils is a collection of shared helper methods to produce TezWork.
All the methods in this class should be static, but some aren't; this is to facilitate testing.
Methods are made non-static on as needed basis.
ql/src/java/org/apache/hadoop/hive/ql/parse/GenTezUtils.java