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.iapi.util.PropertyUtil; 28 29 import java.util.Enumeration ; 30 import java.util.Properties ; 31 32 38 public class RealGroupedAggregateStatistics 39 extends RealNoPutResultSetStatistics 40 { 41 42 43 public int rowsInput; 44 public boolean hasDistinctAggregate; 45 public boolean inSortedOrder; 46 public ResultSetStatistics childResultSetStatistics; 47 public Properties sortProperties; 48 49 51 55 public RealGroupedAggregateStatistics( 56 int numOpens, 57 int rowsSeen, 58 int rowsFiltered, 59 long constructorTime, 60 long openTime, 61 long nextTime, 62 long closeTime, 63 int resultSetNumber, 64 int rowsInput, 65 boolean hasDistinctAggregate, 66 boolean inSortedOrder, 67 Properties sortProperties, 68 double optimizerEstimatedRowCount, 69 double optimizerEstimatedCost, 70 ResultSetStatistics childResultSetStatistics 71 ) 72 { 73 super( 74 numOpens, 75 rowsSeen, 76 rowsFiltered, 77 constructorTime, 78 openTime, 79 nextTime, 80 closeTime, 81 resultSetNumber, 82 optimizerEstimatedRowCount, 83 optimizerEstimatedCost 84 ); 85 this.rowsInput = rowsInput; 86 this.hasDistinctAggregate = hasDistinctAggregate; 87 this.inSortedOrder = inSortedOrder; 88 this.childResultSetStatistics = childResultSetStatistics; 89 this.sortProperties = new Properties (); 90 for (Enumeration e = sortProperties.keys(); e.hasMoreElements(); ) 91 { 92 String key = (String )e.nextElement(); 93 this.sortProperties.put(key, sortProperties.get(key)); 94 } 95 } 96 97 99 106 public String getStatementExecutionPlanText(int depth) 107 { 108 initFormatInfo(depth); 109 110 String sortInfo = (inSortedOrder) ? "" : 111 indent + MessageService.getTextMessage(SQLState.RTS_SORT_INFO) + 112 ": \n" + PropertyUtil.sortProperties(sortProperties, subIndent); 113 114 return 115 indent + MessageService.getTextMessage( 116 SQLState.RTS_GROUPED_AGG_RS) + 117 ":\n" + 118 indent + MessageService.getTextMessage(SQLState.RTS_NUM_OPENS) + 119 " = " + numOpens + "\n" + 120 indent + MessageService.getTextMessage( 121 SQLState.RTS_ROWS_INPUT) + 122 " = " + rowsInput + "\n" + 123 indent + MessageService.getTextMessage( 124 SQLState.RTS_HAS_DISTINCT_AGG) + 125 " = " + hasDistinctAggregate + "\n" + 126 indent + MessageService.getTextMessage( 127 SQLState.RTS_IN_SORTED_ORDER) + 128 " = " + inSortedOrder + "\n" + 129 sortInfo + 130 dumpTimeStats(indent, subIndent) + "\n" + 131 dumpEstimatedCosts(subIndent) + "\n" + 132 indent + MessageService.getTextMessage(SQLState.RTS_SOURCE_RS) + 133 ":\n" + 134 childResultSetStatistics.getStatementExecutionPlanText(sourceDepth) + "\n"; 135 } 136 137 146 public String getScanStatisticsText(String tableName, int depth) 147 { 148 return childResultSetStatistics.getScanStatisticsText(tableName, depth); 149 } 150 151 152 153 155 public String toString() 156 { 157 return getStatementExecutionPlanText(0); 158 } 159 public java.util.Vector getChildren(){ 160 java.util.Vector children = new java.util.Vector (); 161 children.addElement(childResultSetStatistics); 162 return children; 163 } 164 168 public String getNodeName(){ 169 return MessageService.getTextMessage(SQLState.RTS_GROUPED_AGG); 170 } 171 } 172 | Popular Tags |