Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / derby-10.3.2.1 / java / engine / org / apache / derby / impl / sql / execute / rts / RealNestedLoopLeftOuterJoinStatistics.java
diff --git a/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/impl/sql/execute/rts/RealNestedLoopLeftOuterJoinStatistics.java b/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/impl/sql/execute/rts/RealNestedLoopLeftOuterJoinStatistics.java
new file mode 100644 (file)
index 0000000..42350b1
--- /dev/null
@@ -0,0 +1,174 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.impl.sql.execute.rts.RealNestedLoopLeftOuterJoinStatistics\r
+\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to you under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.impl.sql.execute.rts;\r
+\r
+import org.apache.derby.iapi.services.io.StoredFormatIds;\r
+\r
+import org.apache.derby.iapi.services.i18n.MessageService;\r
+import org.apache.derby.iapi.reference.SQLState;\r
+\r
+import org.apache.derby.iapi.services.io.FormatableHashtable;\r
+\r
+import java.io.ObjectOutput;\r
+import java.io.ObjectInput;\r
+import java.io.IOException;\r
+\r
+/**\r
+  ResultSetStatistics implemenation for NestedLoopLeftOuterJoinResultSet.\r
+\r
+\r
+*/\r
+public class RealNestedLoopLeftOuterJoinStatistics \r
+       extends RealNestedLoopJoinStatistics\r
+{\r
+\r
+       /* Leave these fields public for object inspectors */\r
+       public int emptyRightRowsReturned;\r
+\r
+       // CONSTRUCTORS\r
+\r
+       /**\r
+        * \r
+        *\r
+        */\r
+    public     RealNestedLoopLeftOuterJoinStatistics(\r
+                                                               int numOpens,\r
+                                                               int rowsSeen,\r
+                                                               int rowsFiltered,\r
+                                                               long constructorTime,\r
+                                                               long openTime,\r
+                                                               long nextTime,\r
+                                                               long closeTime,\r
+                                                               int resultSetNumber,\r
+                                                               int rowsSeenLeft,\r
+                                                               int rowsSeenRight,\r
+                                                               int rowsReturned,\r
+                                                               long restrictionTime,\r
+                                                               double optimizerEstimatedRowCount,\r
+                                                               double optimizerEstimatedCost,\r
+                                                               String userSuppliedOptimizerOverrides,\r
+                                                               ResultSetStatistics leftResultSetStatistics,\r
+                                                               ResultSetStatistics rightResultSetStatistics,\r
+                                                               int emptyRightRowsReturned\r
+                                                               )\r
+       {\r
+               super(\r
+                       numOpens,\r
+                       rowsSeen,\r
+                       rowsFiltered,\r
+                       constructorTime,\r
+                       openTime,\r
+                       nextTime,\r
+                       closeTime,\r
+                       resultSetNumber,\r
+                       rowsSeenLeft,\r
+                       rowsSeenRight,\r
+                       rowsReturned,\r
+                       restrictionTime,\r
+                       false,          // We never do an EXISTS join for an outer join\r
+                       optimizerEstimatedRowCount,\r
+                       optimizerEstimatedCost,\r
+                       userSuppliedOptimizerOverrides,\r
+                       leftResultSetStatistics,\r
+                       rightResultSetStatistics\r
+                       );\r
+               this.emptyRightRowsReturned = emptyRightRowsReturned;\r
+       }\r
+\r
+       // ResultSetStatistics methods\r
+\r
+       /**\r
+        * Return the statement execution plan as a String.\r
+        *\r
+        * @param depth Indentation level.\r
+        *\r
+        * @return String       The statement execution plan as a String.\r
+        */\r
+       public String getStatementExecutionPlanText(int depth)\r
+       {\r
+               initFormatInfo(depth);\r
+\r
+               return\r
+                       indent + resultSetName + ":" + "\n" + \r
+                       indent + MessageService.getTextMessage(SQLState.RTS_NUM_OPENS) +\r
+                                       " = " + numOpens + "\n" +\r
+                       indent + MessageService.getTextMessage(\r
+                                                                                               SQLState.RTS_ROWS_SEEN_LEFT) +\r
+                                       " = " + rowsSeenLeft + "\n" +\r
+                       indent + MessageService.getTextMessage(\r
+                                                                                               SQLState.RTS_ROWS_SEEN_RIGHT) +\r
+                                       " = " + rowsSeenRight + "\n" +\r
+                       indent + MessageService.getTextMessage(\r
+                                                                                               SQLState.RTS_EMPTY_RIGHT_ROWS) +\r
+                                       " = " + emptyRightRowsReturned + "\n" +\r
+                       indent + MessageService.getTextMessage(\r
+                                                                                               SQLState.RTS_ROWS_FILTERED) +\r
+                                       " = " + rowsFiltered + "\n" +\r
+                       indent + MessageService.getTextMessage(\r
+                                                                                               SQLState.RTS_ROWS_RETURNED) +\r
+                                       " = " + rowsReturned + "\n" +\r
+                       dumpTimeStats(indent, subIndent) + "\n" +\r
+                       dumpEstimatedCosts(subIndent) + "\n" +\r
+                       indent + MessageService.getTextMessage(\r
+                                                                                               SQLState.RTS_LEFT_RS) +\r
+                                       ":\n" +\r
+                       leftResultSetStatistics.getStatementExecutionPlanText(sourceDepth) +\r
+                                       "\n" +\r
+                       indent + MessageService.getTextMessage(\r
+                                                                                               SQLState.RTS_RIGHT_RS) +\r
+                                       ":\n" +\r
+                       rightResultSetStatistics.getStatementExecutionPlanText(\r
+                                                                                                                       sourceDepth) +\r
+                                       "\n";\r
+       }\r
+\r
+       /**\r
+        * Return information on the scan nodes from the statement execution \r
+        * plan as a String.\r
+        *\r
+        * @param depth Indentation level.\r
+        * @param tableName if not NULL then print information for this table only\r
+        *\r
+        * @return String       The information on the scan nodes from the \r
+        *                                      statement execution plan as a String.\r
+        */\r
+       public String getScanStatisticsText(String tableName, int depth)\r
+       {\r
+               return leftResultSetStatistics.getScanStatisticsText(tableName, depth)\r
+                       + rightResultSetStatistics.getScanStatisticsText(tableName, depth);\r
+       }\r
+\r
+       // Class implementation\r
+       \r
+       public String toString()\r
+       {\r
+               return getStatementExecutionPlanText(0);\r
+       }\r
+\r
+       protected void setNames()\r
+       {\r
+               nodeName = MessageService.getTextMessage(\r
+                                                                                       SQLState.RTS_NESTED_LOOP_LEFT_OJ);\r
+               resultSetName = MessageService.getTextMessage(\r
+                                                                               SQLState.RTS_NESTED_LOOP_LEFT_OJ_RS);\r
+       }\r
+}\r