public MapWork createMapWork(GenTezProcContext context, Operator<?> root,
      TezWork tezWork, PrunedPartitionList partitions) throws SemanticException {
    assert root.getParentOperators().isEmpty();
    MapWork mapWork = new MapWork(Utilities.MAPNAME + context.nextSequenceNumber());
    LOG.debug("Adding map work (" + mapWork.getName() + ") for " + root);

    // map work starts with table scan operators
    assert root instanceof TableScanOperator;
    TableScanOperator ts = (TableScanOperator) root;

    String alias = ts.getConf().getAlias();

    setupMapWork(mapWork, context, partitions, ts, alias);

    if (ts.getConf().getTableMetadata() != null && ts.getConf().getTableMetadata().isDummyTable()) {
      mapWork.setDummyTableScan(true);
    }

    if (ts.getConf().getNumBuckets() > 0) {
      mapWork.setIncludedBuckets(ts.getConf().getIncludedBuckets());
    }

    if (ts.getProbeDecodeContext() != null) {
      // TODO: some operators like VectorPTFEvaluator do not allow the use of Selected take this into account here?
      mapWork.setProbeDecodeContext(ts.getProbeDecodeContext());
    }

    // add new item to the tez work
    tezWork.add(mapWork);

    return mapWork;
  }
Checks if there is a Bucket Map Join (BMJ) following a hierarchy:
ReduceSinkOperator (RS) -> ReduceSinkOperator (RS) -> MapJoinOperator (MJ).
Ensures at most **two** RSOs before MJ.
ql/src/java/org/apache/hadoop/hive/ql/parse/GenTezUtils.java