KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > sql > execute > rts > RealDistinctScalarAggregateStatistics


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.execute.rts.RealDistinctScalarAggregateStatistics
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

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 /**
28   ResultSetStatistics implemenation for DistinctScalarAggregateResultSet.
29
30   @author jerry
31
32 */

33 public class RealDistinctScalarAggregateStatistics
34     extends RealScalarAggregateStatistics
35 {
36
37     /* Leave these fields public for object inspectors */
38     public int rowsInput;
39
40     // CONSTRUCTORS
41

42     /**
43      *
44      *
45      */

46     public RealDistinctScalarAggregateStatistics(
47                         int numOpens,
48                         int rowsSeen,
49                         int rowsFiltered,
50                         long constructorTime,
51                         long openTime,
52                         long nextTime,
53                         long closeTime,
54                         int resultSetNumber,
55                         int rowsInput,
56                         double optimizerEstimatedRowCount,
57                         double optimizerEstimatedCost,
58                         ResultSetStatistics childResultSetStatistics
59                         )
60     {
61         super(
62             numOpens,
63             rowsSeen,
64             rowsFiltered,
65             constructorTime,
66             openTime,
67             nextTime,
68             closeTime,
69             resultSetNumber,
70             false, // No min optimization when a distinct aggregate exits
71
rowsInput,
72             optimizerEstimatedRowCount,
73             optimizerEstimatedCost,
74             childResultSetStatistics
75             );
76     }
77
78     // ResultSetStatistics methods
79

80     /**
81      * Return the statement execution plan as a String.
82      *
83      * @param depth Indentation level.
84      *
85      * @return String The statement execution plan as a String.
86      */

87     public String JavaDoc getStatementExecutionPlanText(int depth)
88     {
89         initFormatInfo(depth);
90
91         return
92             indent + MessageService.getTextMessage(SQLState.RTS_DSARS) +
93                 ":\n" +
94             indent + MessageService.getTextMessage(SQLState.RTS_NUM_OPENS) +
95                 " = " + numOpens + "\n" +
96             indent + MessageService.getTextMessage(SQLState.RTS_ROWS_INPUT) +
97                 " = " + rowsInput + "\n" +
98             dumpTimeStats(indent, subIndent) + "\n" +
99             dumpEstimatedCosts(subIndent) + "\n" +
100             indent + MessageService.getTextMessage(SQLState.RTS_SOURCE_RS) +
101                 ":\n" +
102             childResultSetStatistics.getStatementExecutionPlanText(sourceDepth) + "\n";
103     }
104
105     /**
106      * Return information on the scan nodes from the statement execution
107      * plan as a String.
108      *
109      * @param depth Indentation level.
110      * @param tableName if not NULL then print information for this table only
111      *
112      * @return String The information on the scan nodes from the
113      * statement execution plan as a String.
114      */

115     public String JavaDoc getScanStatisticsText(String JavaDoc tableName, int depth)
116     {
117         return childResultSetStatistics.getScanStatisticsText(tableName, depth);
118     }
119
120
121
122     // Class implementation
123

124     public String JavaDoc toString()
125     {
126         return getStatementExecutionPlanText(0);
127     }
128   public java.util.Vector JavaDoc getChildren(){
129     java.util.Vector JavaDoc children = new java.util.Vector JavaDoc();
130     children.addElement(childResultSetStatistics);
131     return children;
132   }
133     /**
134    * Format for display, a name for this node.
135      *
136      */

137   public String JavaDoc getNodeName(){
138     return MessageService.getTextMessage(SQLState.RTS_DISTINCT_SCALAR_AGG);
139   }
140 }
141
Popular Tags