public ClientHook getHook(BeeLine beeLine, String cmdLine) {
    if (!beeLine.isBeeLine()) {
      // In compatibility mode we need to hook to set, and use
      if (cmdLine.toLowerCase().startsWith("set")) {
        // Only set A = B command needs updating the configuration stored in client side.
        if (cmdLine.contains("=")) {
          return new SetCommandHook(cmdLine);
        } else {
          return null;
        }
      } else if (cmdLine.toLowerCase().startsWith("use")) {
        return new UseCommandHook(cmdLine);
      } else {
        return null;
      }
    } else {
      // In beeline mode we need to hook to use, connect, go, in case
      // the ShowDbInPrompt is set, so the database name is needed
      if (beeLine.getOpts().getShowDbInPrompt()) {
        if (cmdLine.toLowerCase().startsWith("use")) {
          return new UseCommandHook(cmdLine);
        } else if (cmdLine.toLowerCase().startsWith("connect")) {
          return new ConnectCommandHook(cmdLine);
        } else if (cmdLine.toLowerCase().startsWith("go")) {
          return new GoCommandHook(cmdLine);
        } else {
          return null;
        }
      } else {
        return null;
      }
    }
  }
We need to update some client side information after executing some Hive Commands
beeline/src/java/org/apache/hive/beeline/ClientCommandHookFactory.java