@Override
    public void postHook(BeeLine beeLine) {
      // Handler multi-line sql
      String line = sql.replaceAll("\\s+", " ");
      String strs[] = line.split(" ");
      String dbName;
      if (strs == null || strs.length < 1) {
        // unable to parse the connect command
        dbName = "";
      } else {
        try {
          dbName = Utils.parseURL(strs[1]).getDbName();
        } catch (Exception e) {
          // unable to parse the connect command
          dbName = "";
        }
      }
      beeLine.setCurrentDatabase(dbName);
    }
We need to update some client side information after executing some Hive Commands
beeline/src/java/org/apache/hive/beeline/ClientCommandHookFactory.java