@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 != 2) {
        // unable to parse the use command
        dbName = "";
      } else {
        dbName = strs[1];
      }
      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