private void pushdownThroughSelect(TopNKeyOperator topNKey) throws SemanticException {

    final SelectOperator select = (SelectOperator) topNKey.getParentOperators().get(0);
    final TopNKeyDesc topNKeyDesc = topNKey.getConf();

    final List<ExprNodeDesc> mappedColumns = mapColumns(topNKeyDesc.getKeyColumns(), select.getColumnExprMap());
    if (mappedColumns.size() != topNKeyDesc.getKeyColumns().size()) {
      return;
    }

    LOG.debug("Pushing {} through {}", topNKey.getName(), select.getName());
    topNKeyDesc.setKeyColumns(mappedColumns);
    topNKeyDesc.setPartitionKeyColumns(mappedColumns.subList(0, topNKeyDesc.getPartitionKeyColumns().size()));
    moveDown(topNKey);
    pushdown(topNKey);
  }
Push through Project if expression(s) in TopNKey can be mapped to expression(s) based on Project input.

@param topNKey TopNKey operator to push
@throws SemanticException when removeChildAndAdoptItsChildren was not successful in the method pushdown
ql/src/java/org/apache/hadoop/hive/ql/optimizer/topnkey/TopNKeyPushdownProcessor.java