1 21 22 package org.apache.derby.impl.sql.execute.rts; 23 24 import org.apache.derby.iapi.services.io.StoredFormatIds; 25 26 import org.apache.derby.iapi.services.i18n.MessageService; 27 import org.apache.derby.iapi.reference.SQLState; 28 29 import org.apache.derby.iapi.services.io.FormatableHashtable; 30 import org.apache.derby.iapi.services.io.FormatableProperties; 31 import org.apache.derby.iapi.util.PropertyUtil; 32 33 import java.io.ObjectOutput ; 34 import java.io.ObjectInput ; 35 import java.io.IOException ; 36 37 import java.util.Enumeration ; 38 import java.util.Properties ; 39 40 46 public class RealSortStatistics 47 extends RealNoPutResultSetStatistics 48 { 49 50 51 public int rowsInput; 52 public int rowsReturned; 53 public boolean eliminateDuplicates; 54 public boolean inSortedOrder; 55 public ResultSetStatistics childResultSetStatistics; 56 public FormatableProperties sortProperties; 57 58 60 64 public RealSortStatistics( 65 int numOpens, 66 int rowsSeen, 67 int rowsFiltered, 68 long constructorTime, 69 long openTime, 70 long nextTime, 71 long closeTime, 72 int resultSetNumber, 73 int rowsInput, 74 int rowsReturned, 75 boolean eliminateDuplicates, 76 boolean inSortedOrder, 77 Properties sortProperties, 78 double optimizerEstimatedRowCount, 79 double optimizerEstimatedCost, 80 ResultSetStatistics childResultSetStatistics 81 ) 82 { 83 super( 84 numOpens, 85 rowsSeen, 86 rowsFiltered, 87 constructorTime, 88 openTime, 89 nextTime, 90 closeTime, 91 resultSetNumber, 92 optimizerEstimatedRowCount, 93 optimizerEstimatedCost 94 ); 95 this.rowsInput = rowsInput; 96 this.rowsReturned = rowsReturned; 97 this.eliminateDuplicates = eliminateDuplicates; 98 this.inSortedOrder = inSortedOrder; 99 this.childResultSetStatistics = childResultSetStatistics; 100 this.sortProperties = new FormatableProperties(); 101 for (Enumeration e = sortProperties.keys(); e.hasMoreElements(); ) 102 { 103 String key = (String )e.nextElement(); 104 this.sortProperties.put(key, sortProperties.get(key)); 105 } 106 } 107 108 110 117 public String getStatementExecutionPlanText(int depth) 118 { 119 initFormatInfo(depth); 120 121 String sortInfo = (inSortedOrder) ? "" : 122 indent + MessageService.getTextMessage(SQLState.RTS_SORT_INFO) + 123 ": \n" + PropertyUtil.sortProperties(sortProperties, subIndent); 124 125 return 126 indent + MessageService.getTextMessage(SQLState.RTS_SORT_RS) + 127 ":\n" + 128 indent + MessageService.getTextMessage(SQLState.RTS_NUM_OPENS) + 129 " = " + numOpens + "\n" + 130 indent + MessageService.getTextMessage(SQLState.RTS_ROWS_INPUT) + 131 " = " + rowsInput + "\n" + 132 indent + MessageService.getTextMessage( 133 SQLState.RTS_ROWS_RETURNED) + 134 " = " + rowsReturned + "\n" + 135 indent + MessageService.getTextMessage( 136 SQLState.RTS_ELIMINATE_DUPS) + 137 " = " + eliminateDuplicates + "\n" + 138 indent + MessageService.getTextMessage( 139 SQLState.RTS_IN_SORTED_ORDER) + 140 " = " + inSortedOrder + "\n" + 141 sortInfo + 142 dumpTimeStats(indent, subIndent) + "\n" + 143 dumpEstimatedCosts(subIndent) + "\n" + 144 indent + MessageService.getTextMessage(SQLState.RTS_SOURCE_RS) + 145 ":\n" + 146 childResultSetStatistics.getStatementExecutionPlanText( 147 sourceDepth) + 148 "\n"; 149 } 150 151 161 public String getScanStatisticsText(String tableName, int depth) 162 { 163 return childResultSetStatistics.getScanStatisticsText(tableName, depth); 164 } 165 166 168 public String toString() 169 { 170 return getStatementExecutionPlanText(0); 171 } 172 public java.util.Vector getChildren(){ 173 java.util.Vector children = new java.util.Vector (); 174 children.addElement(childResultSetStatistics); 175 return children; 176 } 177 181 public String getNodeName(){ 182 return MessageService.getTextMessage(SQLState.RTS_SORT); 183 } 184 } 185 | Popular Tags |