flink/flink1.15-shims/src/main/java/org/apache/zeppelin/flink/Flink115SqlInterpreter.java [69:179]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private static final String CMD_DESC_DELIMITER = "\t\t";

  /**
   * SQL Client HELP command helper class.
   */
  private static final class SQLCliCommandsDescriptions {
    private int commandMaxLength;
    private final Map<String, String> commandsDescriptions;

    public SQLCliCommandsDescriptions() {
      this.commandsDescriptions = new LinkedHashMap<>();
      this.commandMaxLength = -1;
    }

    public SQLCliCommandsDescriptions commandDescription(String command, String description) {
      Preconditions.checkState(
              StringUtils.isNotBlank(command), "content of command must not be empty.");
      Preconditions.checkState(
              StringUtils.isNotBlank(description),
              "content of command's description must not be empty.");
      this.updateMaxCommandLength(command.length());
      this.commandsDescriptions.put(command, description);
      return this;
    }

    private void updateMaxCommandLength(int newLength) {
      Preconditions.checkState(newLength > 0);
      if (this.commandMaxLength < newLength) {
        this.commandMaxLength = newLength;
      }
    }

    public AttributedString build() {
      AttributedStringBuilder attributedStringBuilder = new AttributedStringBuilder();
      if (!this.commandsDescriptions.isEmpty()) {
        this.commandsDescriptions.forEach(
                (cmd, cmdDesc) -> {
                  attributedStringBuilder
                          .style(AttributedStyle.DEFAULT.bold())
                          .append(
                                  String.format(
                                          String.format("%%-%ds", commandMaxLength), cmd))
                          .append(CMD_DESC_DELIMITER)
                          .style(AttributedStyle.DEFAULT)
                          .append(cmdDesc)
                          .append('\n');
                });
      }
      return attributedStringBuilder.toAttributedString();
    }
  }

  private static final AttributedString SQL_CLI_COMMANDS_DESCRIPTIONS =
          new SQLCliCommandsDescriptions()
                  .commandDescription("HELP", "Prints the available commands.")
                  .commandDescription(
                          "SET",
                          "Sets a session configuration property. Syntax: \"SET '<key>'='<value>';\". Use \"SET;\" for listing all properties.")
                  .commandDescription(
                          "RESET",
                          "Resets a session configuration property. Syntax: \"RESET '<key>';\". Use \"RESET;\" for reset all session properties.")
                  .commandDescription(
                          "INSERT INTO",
                          "Inserts the results of a SQL SELECT query into a declared table sink.")
                  .commandDescription(
                          "INSERT OVERWRITE",
                          "Inserts the results of a SQL SELECT query into a declared table sink and overwrite existing data.")
                  .commandDescription(
                          "SELECT", "Executes a SQL SELECT query on the Flink cluster.")
                  .commandDescription(
                          "EXPLAIN",
                          "Describes the execution plan of a query or table with the given name.")
                  .commandDescription(
                          "BEGIN STATEMENT SET",
                          "Begins a statement set. Syntax: \"BEGIN STATEMENT SET;\"")
                  .commandDescription("END", "Ends a statement set. Syntax: \"END;\"")
                  // (TODO) zjffdu, ADD/REMOVE/SHOW JAR
                  .build();

  // --------------------------------------------------------------------------------------------

  public static final AttributedString MESSAGE_HELP =
          new AttributedStringBuilder()
                  .append("The following commands are available:\n\n")
                  .append(SQL_CLI_COMMANDS_DESCRIPTIONS)
                  .style(AttributedStyle.DEFAULT.underline())
                  .append("\nHint")
                  .style(AttributedStyle.DEFAULT)
                  .append(
                          ": Make sure that a statement ends with \";\" for finalizing (multi-line) statements.")
                  // About Documentation Link.
                  .style(AttributedStyle.DEFAULT)
                  .append(
                          "\nYou can also type any Flink SQL statement, please visit https://nightlies.apache.org/flink/flink-docs-stable/docs/dev/table/sql/overview/ for more details.")
                  .toAttributedString();

  private static final String MESSAGE_NO_STATEMENT_IN_STATEMENT_SET = "No statement in the statement set, skip submit.";

  private FlinkSqlContext flinkSqlContext;
  private TableEnvironment tbenv;
  private ZeppelinContext z;
  private Parser sqlParser;
  private SqlSplitter sqlSplitter;
  // paragraphId -> list of ModifyOperation, used for statement set in 2 syntax:
  // 1. runAsOne= true
  // 2. begin statement set;
  //    ...
  //    end;
  private Map<String, List<ModifyOperation>> statementOperationsMap = new HashMap<>();
  private boolean isBatch;
  private ReentrantReadWriteLock.WriteLock lock = new ReentrantReadWriteLock().writeLock();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



flink/flink1.16-shims/src/main/java/org/apache/zeppelin/flink/Flink116SqlInterpreter.java [69:179]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private static final String CMD_DESC_DELIMITER = "\t\t";

  /**
   * SQL Client HELP command helper class.
   */
  private static final class SQLCliCommandsDescriptions {
    private int commandMaxLength;
    private final Map<String, String> commandsDescriptions;

    public SQLCliCommandsDescriptions() {
      this.commandsDescriptions = new LinkedHashMap<>();
      this.commandMaxLength = -1;
    }

    public SQLCliCommandsDescriptions commandDescription(String command, String description) {
      Preconditions.checkState(
              StringUtils.isNotBlank(command), "content of command must not be empty.");
      Preconditions.checkState(
              StringUtils.isNotBlank(description),
              "content of command's description must not be empty.");
      this.updateMaxCommandLength(command.length());
      this.commandsDescriptions.put(command, description);
      return this;
    }

    private void updateMaxCommandLength(int newLength) {
      Preconditions.checkState(newLength > 0);
      if (this.commandMaxLength < newLength) {
        this.commandMaxLength = newLength;
      }
    }

    public AttributedString build() {
      AttributedStringBuilder attributedStringBuilder = new AttributedStringBuilder();
      if (!this.commandsDescriptions.isEmpty()) {
        this.commandsDescriptions.forEach(
                (cmd, cmdDesc) -> {
                  attributedStringBuilder
                          .style(AttributedStyle.DEFAULT.bold())
                          .append(
                                  String.format(
                                          String.format("%%-%ds", commandMaxLength), cmd))
                          .append(CMD_DESC_DELIMITER)
                          .style(AttributedStyle.DEFAULT)
                          .append(cmdDesc)
                          .append('\n');
                });
      }
      return attributedStringBuilder.toAttributedString();
    }
  }

  private static final AttributedString SQL_CLI_COMMANDS_DESCRIPTIONS =
          new SQLCliCommandsDescriptions()
                  .commandDescription("HELP", "Prints the available commands.")
                  .commandDescription(
                          "SET",
                          "Sets a session configuration property. Syntax: \"SET '<key>'='<value>';\". Use \"SET;\" for listing all properties.")
                  .commandDescription(
                          "RESET",
                          "Resets a session configuration property. Syntax: \"RESET '<key>';\". Use \"RESET;\" for reset all session properties.")
                  .commandDescription(
                          "INSERT INTO",
                          "Inserts the results of a SQL SELECT query into a declared table sink.")
                  .commandDescription(
                          "INSERT OVERWRITE",
                          "Inserts the results of a SQL SELECT query into a declared table sink and overwrite existing data.")
                  .commandDescription(
                          "SELECT", "Executes a SQL SELECT query on the Flink cluster.")
                  .commandDescription(
                          "EXPLAIN",
                          "Describes the execution plan of a query or table with the given name.")
                  .commandDescription(
                          "BEGIN STATEMENT SET",
                          "Begins a statement set. Syntax: \"BEGIN STATEMENT SET;\"")
                  .commandDescription("END", "Ends a statement set. Syntax: \"END;\"")
                  // (TODO) zjffdu, ADD/REMOVE/SHOW JAR
                  .build();

  // --------------------------------------------------------------------------------------------

  public static final AttributedString MESSAGE_HELP =
          new AttributedStringBuilder()
                  .append("The following commands are available:\n\n")
                  .append(SQL_CLI_COMMANDS_DESCRIPTIONS)
                  .style(AttributedStyle.DEFAULT.underline())
                  .append("\nHint")
                  .style(AttributedStyle.DEFAULT)
                  .append(
                          ": Make sure that a statement ends with \";\" for finalizing (multi-line) statements.")
                  // About Documentation Link.
                  .style(AttributedStyle.DEFAULT)
                  .append(
                          "\nYou can also type any Flink SQL statement, please visit https://nightlies.apache.org/flink/flink-docs-stable/docs/dev/table/sql/overview/ for more details.")
                  .toAttributedString();

  private static final String MESSAGE_NO_STATEMENT_IN_STATEMENT_SET = "No statement in the statement set, skip submit.";

  private FlinkSqlContext flinkSqlContext;
  private TableEnvironment tbenv;
  private ZeppelinContext z;
  private Parser sqlParser;
  private SqlSplitter sqlSplitter;
  // paragraphId -> list of ModifyOperation, used for statement set in 2 syntax:
  // 1. runAsOne= true
  // 2. begin statement set;
  //    ...
  //    end;
  private Map<String, List<ModifyOperation>> statementOperationsMap = new HashMap<>();
  private boolean isBatch;
  private ReentrantReadWriteLock.WriteLock lock = new ReentrantReadWriteLock().writeLock();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



