1 21 22 package org.apache.derby.impl.sql.execute.rts; 23 24 import org.apache.derby.iapi.services.i18n.MessageService; 25 import org.apache.derby.iapi.reference.SQLState; 26 27 import org.apache.derby.impl.sql.compile.IntersectOrExceptNode; 28 29 35 public class RealSetOpResultSetStatistics 36 extends RealNoPutResultSetStatistics 37 { 38 39 40 public int opType; 41 public int rowsSeenLeft; 42 public int rowsSeenRight; 43 public int rowsReturned; 44 public ResultSetStatistics leftResultSetStatistics; 45 public ResultSetStatistics rightResultSetStatistics; 46 47 49 72 public RealSetOpResultSetStatistics( 73 int opType, 74 int numOpens, 75 int rowsSeen, 76 int rowsFiltered, 77 long constructorTime, 78 long openTime, 79 long nextTime, 80 long closeTime, 81 int resultSetNumber, 82 int rowsSeenLeft, 83 int rowsSeenRight, 84 int rowsReturned, 85 double optimizerEstimatedRowCount, 86 double optimizerEstimatedCost, 87 ResultSetStatistics leftResultSetStatistics, 88 ResultSetStatistics rightResultSetStatistics 89 ) 90 { 91 super( 92 numOpens, 93 rowsSeen, 94 rowsFiltered, 95 constructorTime, 96 openTime, 97 nextTime, 98 closeTime, 99 resultSetNumber, 100 optimizerEstimatedRowCount, 101 optimizerEstimatedCost 102 ); 103 104 this.opType = opType; 105 this.rowsSeenLeft = rowsSeenLeft; 106 this.rowsSeenRight = rowsSeenRight; 107 this.rowsReturned = rowsReturned; 108 this.leftResultSetStatistics = leftResultSetStatistics; 109 this.rightResultSetStatistics = rightResultSetStatistics; 110 } 111 112 114 121 public String getStatementExecutionPlanText(int depth) { 122 initFormatInfo(depth); 123 124 String rs = (opType == IntersectOrExceptNode.INTERSECT_OP) 125 ? (SQLState.RTS_INTERSECT_RS) : (SQLState.RTS_EXCEPT_RS); 126 127 return 128 indent + MessageService.getTextMessage(rs) + 129 ":\n" + 130 indent + MessageService.getTextMessage(SQLState.RTS_NUM_OPENS) + 131 " = " + numOpens + "\n" + 132 indent + MessageService.getTextMessage( 133 SQLState.RTS_ROWS_SEEN_LEFT) + 134 " = " + rowsSeenLeft + "\n" + 135 indent + MessageService.getTextMessage( 136 SQLState.RTS_ROWS_SEEN_RIGHT) + 137 " = " + rowsSeenRight + "\n" + 138 indent + MessageService.getTextMessage( 139 SQLState.RTS_ROWS_RETURNED) + 140 " = " + rowsReturned + "\n" + 141 dumpTimeStats(indent, subIndent) + "\n" + 142 dumpEstimatedCosts(subIndent) + "\n" + 143 indent + MessageService.getTextMessage(SQLState.RTS_LEFT_RS) + 144 ":\n" + 145 leftResultSetStatistics.getStatementExecutionPlanText(sourceDepth) + 146 "\n" + 147 indent + MessageService.getTextMessage(SQLState.RTS_RIGHT_RS) + 148 ":\n" + 149 rightResultSetStatistics.getStatementExecutionPlanText( 150 sourceDepth) + 151 "\n"; 152 } 153 154 164 public String getScanStatisticsText(String tableName, int depth) { 165 return leftResultSetStatistics.getScanStatisticsText(tableName, depth) 166 + rightResultSetStatistics.getScanStatisticsText(tableName, depth); 167 } 168 169 171 177 public String toString() { 178 return getStatementExecutionPlanText(0); 179 } 180 181 190 public java.util.Vector getChildren() { 191 java.util.Vector children = new java.util.Vector (); 192 children.addElement(leftResultSetStatistics); 193 children.addElement(rightResultSetStatistics); 194 return children; 195 } 196 197 202 public String getNodeName() { 203 String nodeName = 204 (opType == IntersectOrExceptNode.INTERSECT_OP) 205 ? (SQLState.RTS_INTERSECT) : (SQLState.RTS_EXCEPT); 206 207 return MessageService.getTextMessage(nodeName); 208 } 209 } 210 | Popular Tags |