/**
   * Return the statement execution plan as a String.
   *
   * @param depth Indentation level.
   * @return String The statement execution plan as a String.
   */
  public String getStatementExecutionPlanText(int depth) {
    initFormatInfo(depth);

    return indent
        + MessageService.getTextMessage(SQLState.RTS_SCALAR_AGG_RS)
        + ":\n"
        + indent
        + MessageService.getTextMessage(SQLState.RTS_NUM_OPENS)
        + " = "
        + numOpens
        + "\n"
        + indent
        + MessageService.getTextMessage(SQLState.RTS_ROWS_INPUT)
        + " = "
        + rowsInput
        + "\n"
        + dumpTimeStats(indent, subIndent)
        + "\n"
        + dumpEstimatedCosts(subIndent)
        + "\n"
        + indent
        + MessageService.getTextMessage(SQLState.RTS_INDEX_KEY_OPT)
        + " = "
        + indexKeyOptimization
        + "\n"
        + indent
        + MessageService.getTextMessage(SQLState.RTS_SOURCE_RS)
        + ":\n"
        + childResultSetStatistics.getStatementExecutionPlanText(sourceDepth)
        + "\n";
  }
  /**
   * Return the statement execution plan as a String.
   *
   * @param depth Indentation level.
   * @return String The statement execution plan as a String.
   */
  public String getStatementExecutionPlanText(int depth) {
    initFormatInfo(depth);

    String insertMode;

    if (userSpecifiedBulkInsert) {
      if (bulkInsertPerformed) {
        insertMode = indent + MessageService.getTextMessage(SQLState.RTS_INSERT_MODE_BULK);
      } else {
        insertMode = indent + MessageService.getTextMessage(SQLState.RTS_INSERT_MODE_NOT_BULK);
      }
    } else {
      insertMode = indent + MessageService.getTextMessage(SQLState.RTS_INSERT_MODE_NORMAL);
    }

    insertMode += "\n";

    return indent
        + MessageService.getTextMessage(SQLState.RTS_INSERT_USING)
        + " "
        + MessageService.getTextMessage(
            tableLock ? SQLState.RTS_TABLE_LOCKING : SQLState.RTS_ROW_LOCKING)
        + ":\n"
        + indent
        + MessageService.getTextMessage(SQLState.RTS_DEFERRED)
        + ": "
        + deferred
        + "\n"
        + insertMode
        + indent
        + MessageService.getTextMessage(SQLState.RTS_ROWS_INSERTED)
        + " = "
        + rowCount
        + "\n"
        + indent
        + MessageService.getTextMessage(SQLState.RTS_INDEXES_UPDATED)
        + " = "
        + indexesUpdated
        + "\n"
        + dumpTimeStats(indent)
        + ((sourceResultSetStatistics == null)
            ? null
            : sourceResultSetStatistics.getStatementExecutionPlanText(1));
  }
 /** Format for display, a name for this node. */
 public String getNodeName() {
   return MessageService.getTextMessage(SQLState.RTS_SCALAR_AGG);
 }
 /** Format for display, a name for this node. */
 public String getNodeName() {
   return MessageService.getTextMessage(SQLState.RTS_INSERT);
 }
 /** Format for display, a name for this node. */
 public String getNodeName() {
   return MessageService.getTextMessage(SQLState.RTS_HASH_SCAN);
 }
 /**
  * If this node is on a database item (like a table or an index), then provide a string that
  * describes the on item.
  */
 public String getNodeOn() {
   return MessageService.getTextMessage(SQLState.RTS_ON_USING, tableName, indexName);
 }
  /**
   * Return the statement execution plan as a String.
   *
   * @param depth Indentation level.
   * @return String The statement executio plan as a String.
   */
  public String getStatementExecutionPlanText(int depth) {
    String header;
    String isolationString = null;

    initFormatInfo(depth);

    if (indexName != null) {
      header =
          indent
              + MessageService.getTextMessage(
                  SQLState.RTS_HASH_SCAN_RS_USING,
                  tableName,
                  MessageService.getTextMessage(
                      isConstraint ? SQLState.RTS_CONSTRAINT : SQLState.RTS_INDEX),
                  indexName);
    } else {
      header = indent + MessageService.getTextMessage(SQLState.RTS_HASH_SCAN_RS, tableName);
    }

    header =
        header
            + " "
            + MessageService.getTextMessage(SQLState.RTS_LOCKING, isolationLevel, lockString)
            + ": \n";

    String scanInfo =
        indent
            + MessageService.getTextMessage(SQLState.RTS_SCAN_INFO)
            + ": \n"
            + PropertyUtil.sortProperties(scanProperties, subIndent);

    String hashKeyColumnString;
    if (hashKeyColumns.length == 1) {
      hashKeyColumnString =
          MessageService.getTextMessage(SQLState.RTS_HASH_KEY) + " " + hashKeyColumns[0];
    } else {
      hashKeyColumnString =
          MessageService.getTextMessage(SQLState.RTS_HASH_KEYS) + " (" + hashKeyColumns[0];
      for (int index = 1; index < hashKeyColumns.length; index++) {
        hashKeyColumnString = hashKeyColumnString + "," + hashKeyColumns[index];
      }
      hashKeyColumnString = hashKeyColumnString + ")";
    }

    return header
        + indent
        + MessageService.getTextMessage(SQLState.RTS_NUM_OPENS)
        + " = "
        + numOpens
        + "\n"
        + indent
        + MessageService.getTextMessage(SQLState.RTS_HASH_TABLE_SIZE)
        + " = "
        + hashtableSize
        + "\n"
        + indent
        + hashKeyColumnString
        + "\n"
        + indent
        + MessageService.getTextMessage(SQLState.RTS_ROWS_SEEN)
        + " = "
        + rowsSeen
        + "\n"
        + indent
        + MessageService.getTextMessage(SQLState.RTS_ROWS_FILTERED)
        + " = "
        + rowsFiltered
        + "\n"
        + dumpTimeStats(indent, subIndent)
        + "\n"
        + ((rowsSeen > 0)
            ? subIndent
                + MessageService.getTextMessage(SQLState.RTS_NEXT_TIME)
                + " = "
                + (nextTime / rowsSeen)
                + "\n"
            : "")
        + "\n"
        + scanInfo
        + subIndent
        + MessageService.getTextMessage(SQLState.RTS_START_POSITION)
        + ": \n"
        + startPosition
        + subIndent
        + MessageService.getTextMessage(SQLState.RTS_STOP_POSITION)
        + ": \n"
        + stopPosition
        + subIndent
        + MessageService.getTextMessage(SQLState.RTS_SCAN_QUALS)
        + ":\n"
        + scanQualifiers
        + "\n"
        + subIndent
        + MessageService.getTextMessage(SQLState.RTS_NEXT_QUALS)
        + ":\n"
        + nextQualifiers
        + "\n"
        +
        // RESOLVE - estimated row count and cost will eventually
        // be displayed for all nodes
        dumpEstimatedCosts(subIndent);
  }