public static Map.Entry<String, String> getDbTableNamePair(ASTNode tableNameNode) throws SemanticException {

    if (tableNameNode.getType() != HiveParser.TOK_TABNAME ||
        (tableNameNode.getChildCount() != 1 && tableNameNode.getChildCount() != 2
            && tableNameNode.getChildCount() != 3)) {
      throw new SemanticException(ASTErrorUtils.getMsg(ErrorMsg.INVALID_TABLE_NAME.getMsg(), tableNameNode));
    }

    if (tableNameNode.getChildCount() == 2 || tableNameNode.getChildCount() == 3) {
      String dbName = unescapeIdentifier(tableNameNode.getChild(0).getText());
      String tableName = unescapeIdentifier(tableNameNode.getChild(1).getText());
      if (dbName.contains(".") || tableName.contains(".")) {
        throw new SemanticException(ASTErrorUtils.getMsg(ErrorMsg.OBJECTNAME_CONTAINS_DOT.getMsg(), tableNameNode));
      }
      if (tableNameNode.getChildCount() == 3) {
        String metaTable = unescapeIdentifier(tableNameNode.getChild(2).getText());
        tableName = tableName + "." + metaTable;
      }
      return Pair.of(dbName, tableName);
    } else {
      String tableName = unescapeIdentifier(tableNameNode.getChild(0).getText());
      if (tableName.contains(".")) {
        throw new SemanticException(ASTErrorUtils.getMsg(ErrorMsg.OBJECTNAME_CONTAINS_DOT.getMsg(), tableNameNode));
      }
      return Pair.of(null,tableName);
    }
  }
Get dequoted name from a table/column node.
@param tableOrColumnNode the table or column node
@return for table node, db.tab or tab. for column node column.
@throws SemanticException
ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java