public static String getFQName(ASTNode node) {
    if (node.getChildCount() == 0) {
      return node.getText();
    } else if (node.getChildCount() == 2) {
      return getFQName((ASTNode) node.getChild(0)) + "." + getFQName((ASTNode) node.getChild(1));
    } else if (node.getChildCount() == 3) {
      return getFQName((ASTNode) node.getChild(0)) + "." + getFQName((ASTNode) node.getChild(1)) + "." +
          getFQName((ASTNode) node.getChild(2));
    } else {
      return null;
    }
  }
Get the fully qualified name in the node.
E.g. the node of the form ^(DOT ^(DOT a b) c) will generate a name of the form "a.b.c".
ql/src/java/org/apache/hadoop/hive/ql/ddl/DDLUtils.java