KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.execute.rts.RealNestedLoopLeftOuterJoinStatistics
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.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
31 import java.io.ObjectOutput JavaDoc;
32 import java.io.ObjectInput JavaDoc;
33 import java.io.IOException JavaDoc;
34
35 /**
36   ResultSetStatistics implemenation for NestedLoopLeftOuterJoinResultSet.
37
38   @author jerry
39
40 */

41 public class RealNestedLoopLeftOuterJoinStatistics
42     extends RealNestedLoopJoinStatistics
43 {
44
45     /* Leave these fields public for object inspectors */
46     public int emptyRightRowsReturned;
47
48     // CONSTRUCTORS
49

50     /**
51      *
52      *
53      */

54     public RealNestedLoopLeftOuterJoinStatistics(
55                                 int numOpens,
56                                 int rowsSeen,
57                                 int rowsFiltered,
58                                 long constructorTime,
59                                 long openTime,
60                                 long nextTime,
61                                 long closeTime,
62                                 int resultSetNumber,
63                                 int rowsSeenLeft,
64                                 int rowsSeenRight,
65                                 int rowsReturned,
66                                 long restrictionTime,
67                                 double optimizerEstimatedRowCount,
68                                 double optimizerEstimatedCost,
69                                 String JavaDoc userSuppliedOptimizerOverrides,
70                                 ResultSetStatistics leftResultSetStatistics,
71                                 ResultSetStatistics rightResultSetStatistics,
72                                 int emptyRightRowsReturned
73                                 )
74     {
75         super(
76             numOpens,
77             rowsSeen,
78             rowsFiltered,
79             constructorTime,
80             openTime,
81             nextTime,
82             closeTime,
83             resultSetNumber,
84             rowsSeenLeft,
85             rowsSeenRight,
86             rowsReturned,
87             restrictionTime,
88             false, // We never do an EXISTS join for an outer join
89
optimizerEstimatedRowCount,
90             optimizerEstimatedCost,
91             userSuppliedOptimizerOverrides,
92             leftResultSetStatistics,
93             rightResultSetStatistics
94             );
95         this.emptyRightRowsReturned = emptyRightRowsReturned;
96     }
97
98     // ResultSetStatistics methods
99

100     /**
101      * Return the statement execution plan as a String.
102      *
103      * @param depth Indentation level.
104      *
105      * @return String The statement execution plan as a String.
106      */

107     public String JavaDoc getStatementExecutionPlanText(int depth)
108     {
109         initFormatInfo(depth);
110
111         return
112             indent + resultSetName + ":" + "\n" +
113             indent + MessageService.getTextMessage(SQLState.RTS_NUM_OPENS) +
114                     " = " + numOpens + "\n" +
115             indent + MessageService.getTextMessage(
116                                                 SQLState.RTS_ROWS_SEEN_LEFT) +
117                     " = " + rowsSeenLeft + "\n" +
118             indent + MessageService.getTextMessage(
119                                                 SQLState.RTS_ROWS_SEEN_RIGHT) +
120                     " = " + rowsSeenRight + "\n" +
121             indent + MessageService.getTextMessage(
122                                                 SQLState.RTS_EMPTY_RIGHT_ROWS) +
123                     " = " + emptyRightRowsReturned + "\n" +
124             indent + MessageService.getTextMessage(
125                                                 SQLState.RTS_ROWS_FILTERED) +
126                     " = " + rowsFiltered + "\n" +
127             indent + MessageService.getTextMessage(
128                                                 SQLState.RTS_ROWS_RETURNED) +
129                     " = " + rowsReturned + "\n" +
130             dumpTimeStats(indent, subIndent) + "\n" +
131             dumpEstimatedCosts(subIndent) + "\n" +
132             indent + MessageService.getTextMessage(
133                                                 SQLState.RTS_LEFT_RS) +
134                     ":\n" +
135             leftResultSetStatistics.getStatementExecutionPlanText(sourceDepth) +
136                     "\n" +
137             indent + MessageService.getTextMessage(
138                                                 SQLState.RTS_RIGHT_RS) +
139                     ":\n" +
140             rightResultSetStatistics.getStatementExecutionPlanText(
141                                                             sourceDepth) +
142                     "\n";
143     }
144
145     /**
146      * Return information on the scan nodes from the statement execution
147      * plan as a String.
148      *
149      * @param depth Indentation level.
150      * @param tableName if not NULL then print information for this table only
151      *
152      * @return String The information on the scan nodes from the
153      * statement execution plan as a String.
154      */

155     public String JavaDoc getScanStatisticsText(String JavaDoc tableName, int depth)
156     {
157         return leftResultSetStatistics.getScanStatisticsText(tableName, depth)
158             + rightResultSetStatistics.getScanStatisticsText(tableName, depth);
159     }
160
161     // Class implementation
162

163     public String JavaDoc toString()
164     {
165         return getStatementExecutionPlanText(0);
166     }
167
168     protected void setNames()
169     {
170         nodeName = MessageService.getTextMessage(
171                                             SQLState.RTS_NESTED_LOOP_LEFT_OJ);
172         resultSetName = MessageService.getTextMessage(
173                                         SQLState.RTS_NESTED_LOOP_LEFT_OJ_RS);
174     }
175 }
176
Popular Tags