public static String getExprString(RowSchema rs, ExprNodeDesc expr,
      LineageCtx lctx, Operator<? extends OperatorDesc> inpOp, Predicate cond) {
    if (expr instanceof ExprNodeColumnDesc) {
      ExprNodeColumnDesc col = (ExprNodeColumnDesc) expr;
      String internalName = col.getColumn();
      String alias = internalName;
      String tabAlias = col.getTabAlias();
      ColumnInfo ci = rs.getColumnInfo(internalName);
      if (ci != null) {
        if (ci.getAlias() != null) {
          alias = ci.getAlias();
        }
        if (ci.getTabAlias() != null) {
          tabAlias = ci.getTabAlias();
        }
      }
      Dependency dep = lctx.getIndex().getDependency(inpOp, internalName);
      if ((tabAlias == null || tabAlias.startsWith("_") || tabAlias.startsWith("$"))
          && (dep != null && dep.getType() == DependencyType.SIMPLE)) {
        Set<BaseColumnInfo> baseCols = dep.getBaseCols();
        if (baseCols != null && !baseCols.isEmpty()) {
          BaseColumnInfo baseCol = baseCols.iterator().next();
          tabAlias = baseCol.getTabAlias().getAlias();
          if (baseCol.getColumn() != null) {
            alias = baseCol.getColumn().getName();
          }
        }
      }
      if (tabAlias != null && tabAlias.length() > 0
          && !tabAlias.startsWith("_") && !tabAlias.startsWith("$")) {
        if (cond != null && !findSourceColumn(lctx, cond, tabAlias, alias) && dep != null) {
          cond.getBaseCols().addAll(dep.getBaseCols());
        }
        return tabAlias + "." + alias;
      }

      if (dep != null) {
        if (cond != null) {
          cond.getBaseCols().addAll(dep.getBaseCols());
        }
        if (dep.getExpr() != null) {
          return dep.getExpr();
        }
      }
      if (alias.startsWith("_")) {
        ci = inpOp.getSchema().getColumnInfo(internalName);
        if (ci != null && ci.getAlias() != null) {
          alias = ci.getAlias();
        }
      }
      return alias;
    } else if (expr instanceof ExprNodeGenericFuncDesc) {
      ExprNodeGenericFuncDesc func = (ExprNodeGenericFuncDesc) expr;
      List<ExprNodeDesc> children = func.getChildren();
      String[] childrenExprStrings = new String[children.size()];
      for (int i = 0; i < childrenExprStrings.length; i++) {
        childrenExprStrings[i] = getExprString(rs, children.get(i), lctx, inpOp, cond);
      }
      return func.getGenericUDF().getDisplayString(childrenExprStrings);
    }
    return expr.getExprString();
  }
Get the expression string of an expression node.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/lineage/ExprProcFactory.java