001: /*
002:
003: Derby - Class org.apache.derby.impl.sql.execute.rts.RealNormalizeResultSetStatistics
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to you under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.impl.sql.execute.rts;
023:
024: import org.apache.derby.iapi.services.io.StoredFormatIds;
025:
026: import org.apache.derby.iapi.services.i18n.MessageService;
027: import org.apache.derby.iapi.reference.SQLState;
028:
029: import org.apache.derby.iapi.services.io.FormatableHashtable;
030:
031: import java.io.ObjectOutput;
032: import java.io.ObjectInput;
033: import java.io.IOException;
034:
035: /**
036: ResultSetStatistics implemenation for NormalizeResultSet.
037:
038: @author jerry
039:
040: */
041: public class RealNormalizeResultSetStatistics extends
042: RealNoPutResultSetStatistics {
043:
044: /* Leave these fields public for object inspectors */
045: public ResultSetStatistics childResultSetStatistics;
046:
047: // CONSTRUCTORS
048:
049: /**
050: *
051: *
052: */
053: public RealNormalizeResultSetStatistics(int numOpens, int rowsSeen,
054: int rowsFiltered, long constructorTime, long openTime,
055: long nextTime, long closeTime, int resultSetNumber,
056: double optimizerEstimatedRowCount,
057: double optimizerEstimatedCost,
058: ResultSetStatistics childResultSetStatistics) {
059: super (numOpens, rowsSeen, rowsFiltered, constructorTime,
060: openTime, nextTime, closeTime, resultSetNumber,
061: optimizerEstimatedRowCount, optimizerEstimatedCost);
062: this .childResultSetStatistics = childResultSetStatistics;
063: }
064:
065: // ResultSetStatistics methods
066:
067: /**
068: * Return the statement execution plan as a String.
069: *
070: * @param depth Indentation level.
071: *
072: * @return String The statement execution plan as a String.
073: */
074: public String getStatementExecutionPlanText(int depth) {
075: initFormatInfo(depth);
076:
077: return indent
078: + MessageService
079: .getTextMessage(SQLState.RTS_NORMALIZE_RS)
080: + ":\n"
081: + indent
082: + MessageService.getTextMessage(SQLState.RTS_NUM_OPENS)
083: + " = "
084: + numOpens
085: + "\n"
086: + indent
087: + MessageService.getTextMessage(SQLState.RTS_ROWS_SEEN)
088: + " = "
089: + rowsSeen
090: + "\n"
091: + dumpTimeStats(indent, subIndent)
092: + "\n"
093: + dumpEstimatedCosts(subIndent)
094: + "\n"
095: + indent
096: + MessageService.getTextMessage(SQLState.RTS_SOURCE_RS)
097: + ":\n"
098: + childResultSetStatistics
099: .getStatementExecutionPlanText(sourceDepth)
100: + "\n";
101: }
102:
103: /**
104: * Return information on the scan nodes from the statement execution
105: * plan as a String.
106: *
107: * @param depth Indentation level.
108: * @param tableName if not NULL then print information for this table only
109: *
110: * @return String The information on the scan nodes from the
111: * statement execution plan as a String.
112: */
113: public String getScanStatisticsText(String tableName, int depth) {
114: return childResultSetStatistics.getScanStatisticsText(
115: tableName, depth);
116: }
117:
118: // Class implementation
119:
120: public String toString() {
121: return getStatementExecutionPlanText(0);
122: }
123:
124: public java.util.Vector getChildren() {
125: java.util.Vector children = new java.util.Vector();
126: children.addElement(childResultSetStatistics);
127: return children;
128: }
129:
130: /**
131: * Format for display, a name for this node.
132: *
133: */
134: public String getNodeName() {
135: return MessageService.getTextMessage(SQLState.RTS_NORMALIZE_RS);
136: }
137: }
|