db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From banda...@apache.org
Subject svn commit: r369619 [1/4] - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/reference/ engine/org/apache/derby/iapi/sql/compile/ engine/org/apache/derby/iapi/sql/execute/ engine/org/apache/derby/impl/sql/compile/ engine/org/apache/derby/impl...
Date Tue, 17 Jan 2006 01:11:11 GMT
Author: bandaram
Date: Mon Jan 16 17:10:52 2006
New Revision: 369619

URL: http://svn.apache.org/viewcvs?rev=369619&view=rev
Log:
DERBY-573: Enhance RUNSTAT output to show user specified optimizer hints are bing used.

Here is the checkin message from the contributor:

I have attached a patch named Derby573OptimizerOverridesAndRunTimeStatistics011206.txt to JIRA Derby573 Provide support for optimizer overrides in Derby. This patch enables users to see the optimizer overrides specified in the sql as part of runtime statistics info. This is achieved by changing the 
generator so that these properties get passed from compile time to execute time. This change in generate phase can be found in FromBaseTable,
BaseJoinStrategy and JoinNode. The changes in the other classes is for returning the correct number of arguments to the scan. That change is in 
getScanArgs method. 

In addition, I have changed the existing lang/optimizerOverrides.sql to test this patch. derbyall suite has run fine on my Windows XP m/c with Sun's jdk14.

Submitted by Mamta Satoor (msatoor@google.com)

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/SQLState.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/Optimizable.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseJoinStrategy.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HalfOuterJoinNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HashJoinStrategy.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NestedLoopJoinStrategy.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BulkTableScanResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DependentResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DistinctScanResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashJoinResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashLeftOuterJoinResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashScanResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JoinResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/LastIndexKeyResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MergeJoinResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NestedLoopJoinResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NestedLoopLeftOuterJoinResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RealResultSetStatisticsFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashJoinStatistics.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashLeftOuterJoinStatistics.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealJoinResultSetStatistics.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealNestedLoopJoinStatistics.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealNestedLoopLeftOuterJoinStatistics.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealTableScanStatistics.java
    db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/optimizerOverrides.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/optimizerOverrides.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/optimizerOverrides.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/optimizerOverrides.sql

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/SQLState.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/SQLState.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/SQLState.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/SQLState.java Mon Jan 16 17:10:52 2006
@@ -1153,6 +1153,8 @@
 	String RTS_REFACTION_DEPENDENT									   = "43Y53.U";
 	String RTS_BEGIN_DEPENDENT_NUMBER								   = "43Y54.U";	
 	String RTS_END_DEPENDENT_NUMBER									   = "43Y55.U";	
+	String RTS_USER_SUPPLIED_OPTIMIZER_OVERRIDES_FOR_TABLE			   = "43Y56.U";	
+	String RTS_USER_SUPPLIED_OPTIMIZER_OVERRIDES_FOR_JOIN			   = "43Y57.U";	
 
 	// org.apache.derby.catalog.types
 	String TI_SQL_TYPE_NAME			= "44X00.U";

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/Optimizable.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/Optimizable.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/Optimizable.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/Optimizable.java Mon Jan 16 17:10:52 2006
@@ -182,7 +182,7 @@
 	public boolean isCoveringIndex(ConglomerateDescriptor cd) throws StandardException;
 
 	/**
-	 * Get the Properties list, if any, associated with this optimizalbe.
+	 * Get the Properties list, if any, associated with this optimizable.
 	 *
 	 * @return The Properties list, if any, associated with this optimizable.
 	 */

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ResultSetFactory.java Mon Jan 16 17:10:52 2006
@@ -739,7 +739,8 @@
 		@param loadFactor		The loadFactor for the HashTable.
 		@param maxCapacity		The maximum size for the HashTable.
 		@param hashKeyColumn	The 0-based column # for the hash key.
-		@param tableName		The full name of the table
+		@param tableName		The full name of the table 
+		@param userSuppliedOptimizerOverrides		Overrides specified by the user on the sql
 		@param indexName		The name of the index, if one used to access table.
 		@param isConstraint		If index, if used, is a backing index for a constraint.
 		@param forUpdate		True means open for update
@@ -777,6 +778,7 @@
 								int maxCapacity,
 								int hashKeyColumn,
 								String tableName,
+								String userSuppliedOptimizerOverrides,
 								String indexName,
 								boolean isConstraint,
 								boolean forUpdate,
@@ -807,6 +809,7 @@
 		@param resultSetNumber	The resultSetNumber for the ResultSet
 		@param hashKeyColumn	The 0-based column # for the hash key.
 		@param tableName		The full name of the table
+		@param userSuppliedOptimizerOverrides		Overrides specified by the user on the sql
 		@param indexName		The name of the index, if one used to access table.
 		@param isConstraint		If index, if used, is a backing index for a constraint.
 		@param colRefItem		An saved item for a bitSet of columns that
@@ -833,6 +836,7 @@
 								int resultSetNumber,
 								int hashKeyColumn,
 								String tableName,
+								String userSuppliedOptimizerOverrides,
 								String indexName,
 								boolean isConstraint,
 								int colRefItem,
@@ -886,6 +890,7 @@
 		@param qualifiers the array of Qualifiers for the scan.
 			Null or an array length of zero means there are no qualifiers.
 		@param tableName		The full name of the table
+		@param userSuppliedOptimizerOverrides		Overrides specified by the user on the sql
 		@param indexName		The name of the index, if one used to access table.
 		@param isConstraint		If index, if used, is a backing index for a constraint.
 		@param forUpdate		True means open for update
@@ -920,6 +925,7 @@
 								boolean sameStartStopPosition,
 								Qualifier[][] qualifiers,
 								String tableName,
+								String userSuppliedOptimizerOverrides,
 								String indexName,
 								boolean isConstraint,
 								boolean forUpdate,
@@ -976,6 +982,7 @@
 		@param qualifiers the array of Qualifiers for the scan.
 			Null or an array length of zero means there are no qualifiers.
 		@param tableName		The full name of the table
+		@param userSuppliedOptimizerOverrides		Overrides specified by the user on the sql
 		@param indexName		The name of the index, if one used to access table.
 		@param isConstraint		If index, if used, is a backing index for a constraint.
 		@param forUpdate		True means open for update
@@ -1011,6 +1018,7 @@
 								boolean sameStartStopPosition,
 								Qualifier[][] qualifiers,
 								String tableName,
+								String userSuppliedOptimizerOverrides,
 								String indexName,
 								boolean isConstraint,
 								boolean forUpdate,
@@ -1112,6 +1120,7 @@
 		@param optimizerEstimatedRowCount	Estimated total # of rows by
 											optimizer
 		@param optimizerEstimatedCost		Estimated total cost by optimizer
+		@param userSuppliedOptimizerOverrides		Overrides specified by the user on the sql
 		@param closeCleanup	any cleanup the activation needs to do on close.
 		@return the nested loop join operation as a result set.
 		@exception StandardException thrown when unable to create the
@@ -1128,6 +1137,7 @@
 								   boolean notExistsRightSide,
 								   double optimizerEstimatedRowCount,
 								   double optimizerEstimatedCost,
+								   String userSuppliedOptimizerOverrides,
 								   GeneratedMethod closeCleanup)
 			throws StandardException;
 
@@ -1155,6 +1165,7 @@
 		@param optimizerEstimatedRowCount	Estimated total # of rows by
 											optimizer
 		@param optimizerEstimatedCost		Estimated total cost by optimizer
+		@param userSuppliedOptimizerOverrides		Overrides specified by the user on the sql
 		@param closeCleanup	any cleanup the activation needs to do on close.
 		@return the nested loop join operation as a result set.
 		@exception StandardException thrown when unable to create the
@@ -1171,6 +1182,7 @@
 								   boolean notExistsRightSide,
 								   double optimizerEstimatedRowCount,
 								   double optimizerEstimatedCost,
+								   String userSuppliedOptimizerOverrides,
 								   GeneratedMethod closeCleanup)
 			throws StandardException;
 
@@ -1210,6 +1222,7 @@
 											optimizer
 		@param optimizerEstimatedCost		Estimated total cost by optimizer
 		@param closeCleanup	any cleanup the activation needs to do on close.
+		@param userSuppliedOptimizerOverrides		Overrides specified by the user on the sql
 		@return the nested loop join operation as a result set.
 		@exception StandardException thrown when unable to create the
 			result set
@@ -1227,6 +1240,7 @@
 								   boolean notExistsRightSide,
 								   double optimizerEstimatedRowCount,
 								   double optimizerEstimatedCost,
+								   String userSuppliedOptimizerOverrides,
 								   GeneratedMethod closeCleanup)
 			throws StandardException;
 
@@ -1257,6 +1271,7 @@
 		@param optimizerEstimatedRowCount	Estimated total # of rows by
 											optimizer
 		@param optimizerEstimatedCost		Estimated total cost by optimizer
+		@param userSuppliedOptimizerOverrides		Overrides specified by the user on the sql
 		@param closeCleanup	any cleanup the activation needs to do on close.
 		@return the nested loop join operation as a result set.
 		@exception StandardException thrown when unable to create the
@@ -1275,6 +1290,7 @@
 								   boolean notExistsRightSide,
 								   double optimizerEstimatedRowCount,
 								   double optimizerEstimatedCost,
+								   String userSuppliedOptimizerOverrides,
 								   GeneratedMethod closeCleanup)
 			throws StandardException;
 
@@ -1455,6 +1471,7 @@
 	 *		ExecRow rowAllocator() throws StandardException; </verbatim>
 	 * @param conglomId 		the conglomerate of the table to be scanned.
 	 * @param tableName			The full name of the table
+	 * @param userSuppliedOptimizerOverrides		Overrides specified by the user on the sql
 	 * @param indexName			The name of the index, if one used to access table.
 	 * @param colRefItem		An saved item for a bitSet of columns that
 	 *							are referenced in the underlying table.  -1 if
@@ -1481,6 +1498,7 @@
 		GeneratedMethod 	resultRowAllocator,
 		long 				conglomId,
 		String 				tableName,
+		String 				userSuppliedOptimizerOverrides,
 		String 				indexName,
 		int 				colRefItem,
 		int 				lockMode,
@@ -1530,6 +1548,7 @@
 		@param qualifiers the array of Qualifiers for the scan.
 			Null or an array length of zero means there are no qualifiers.
 		@param tableName		The full name of the table
+		@param userSuppliedOptimizerOverrides		Overrides specified by the user on the sql
 		@param indexName		The name of the index, if one used to access table.
 		@param isConstraint		If index, if used, is a backing index for a constraint.
 		@param forUpdate		True means open for update
@@ -1570,6 +1589,7 @@
 									boolean sameStartStopPosition,
 									Qualifier[][] qualifiers,
 									String tableName,
+									String userSuppliedOptimizerOverrides,
 									String indexName,
 									boolean isConstraint,
 									boolean forUpdate,

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseJoinStrategy.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseJoinStrategy.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseJoinStrategy.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseJoinStrategy.java Mon Jan 16 17:10:52 2006
@@ -47,6 +47,8 @@
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.reference.ClassName;
 
+import org.apache.derby.iapi.util.PropertyUtil;
+
 abstract public class BaseJoinStrategy implements JoinStrategy {
 	public BaseJoinStrategy() {
 	}
@@ -112,6 +114,13 @@
 		throws StandardException
 	{
 		mb.push(innerTable.getBaseTableName());
+		//User may have supplied optimizer overrides in the sql
+		//Pass them onto execute phase so it can be shown in 
+		//run time statistics.
+		if (innerTable.getProperties() != null)
+			mb.push(PropertyUtil.sortProperties(innerTable.getProperties()));
+		else
+			mb.pushNull("java.lang.String");
 
 		ConglomerateDescriptor cd =
 			innerTable.getTrulyTheBestAccessPath().getConglomerateDescriptor();

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java Mon Jan 16 17:10:52 2006
@@ -3131,6 +3131,13 @@
 		resultColumns.generateHolder(acb, mb, referencedCols, (FormatableBitSet) null);
 		mb.push(cd.getConglomerateNumber());
 		mb.push(tableDescriptor.getName());
+		//User may have supplied optimizer overrides in the sql
+		//Pass them onto execute phase so it can be shown in 
+		//run time statistics.
+		if (tableProperties != null)
+			mb.push(org.apache.derby.iapi.util.PropertyUtil.sortProperties(tableProperties));
+		else
+			mb.pushNull("java.lang.String");
 		mb.push(cd.getConglomerateName());
 		mb.push(colRefItem);
 		mb.push(getTrulyTheBestAccessPath().getLockMode());
@@ -3141,7 +3148,7 @@
 		closeMethodArgument(acb, mb);
 
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getLastIndexKeyResultSet",
-					ClassName.NoPutResultSet, 13);
+					ClassName.NoPutResultSet, 14);
 
 
 	}
@@ -3218,6 +3225,13 @@
 		mb.push(getResultSetNumber());
 		mb.push(hashKeyItem);
 		mb.push(tableDescriptor.getName());
+		//User may have supplied optimizer overrides in the sql
+		//Pass them onto execute phase so it can be shown in 
+		//run time statistics.
+		if (tableProperties != null)
+			mb.push(org.apache.derby.iapi.util.PropertyUtil.sortProperties(tableProperties));
+		else
+			mb.pushNull("java.lang.String");
 		mb.push(cd.getConglomerateName());
 		mb.push(cd.isConstraint());
 		mb.push(colRefItem);
@@ -3230,7 +3244,7 @@
 
 		
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getDistinctScanResultSet",
-							ClassName.NoPutResultSet, 16);
+							ClassName.NoPutResultSet, 17);
 	}
 
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HalfOuterJoinNode.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HalfOuterJoinNode.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HalfOuterJoinNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HalfOuterJoinNode.java Mon Jan 16 17:10:52 2006
@@ -90,7 +90,8 @@
 				onClause,
 				usingClause,
 				null,
-				tableProperties);
+				tableProperties,
+				null);
 		this.rightOuterJoin = ((Boolean) rightOuterJoin).booleanValue();
 
 		/* We can only flatten an outer join
@@ -628,6 +629,7 @@
 												joinClause,
 												null,
 												resultColumns,
+												null,
 												null,
 												getContextManager());
 						ij.setTableNumber(tableNumber);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HashJoinStrategy.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HashJoinStrategy.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HashJoinStrategy.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/HashJoinStrategy.java Mon Jan 16 17:10:52 2006
@@ -309,7 +309,7 @@
 						tableLocked,
 						isolationLevel);
 
-		return 28;
+		return 29;
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JoinNode.java Mon Jan 16 17:10:52 2006
@@ -58,6 +58,7 @@
 import org.apache.derby.impl.sql.compile.ActivationClassBuilder;
 
 import org.apache.derby.iapi.util.JBitSet;
+import org.apache.derby.iapi.util.PropertyUtil;
 import org.apache.derby.iapi.services.classfile.VMOpcode;
 
 import java.util.Properties;
@@ -96,6 +97,8 @@
 	boolean	            joinClauseNormalized;
 	PredicateList		joinPredicates;
 	ResultColumnList	usingClause;
+	//User provided optimizer overrides
+	Properties joinOrderStrategyProperties;
 
 
 	/**
@@ -107,6 +110,7 @@
 	 * @param usingClause	The USING clause
 	 * @param selectList	The result column list for the join
 	 * @param tableProperties	Properties list associated with the table
+	 * @param joinOrderStrategyProperties	User provided optimizer overrides
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
@@ -116,7 +120,8 @@
 					Object onClause,
 					Object usingClause,
 					Object selectList,
-					Object tableProperties)
+					Object tableProperties,
+					Object joinOrderStrategyProperties)
 			throws StandardException
 	{
 		super.init(leftResult, rightResult, tableProperties);
@@ -124,6 +129,7 @@
 		joinClause = (ValueNode) onClause;
 		joinClauseNormalized = false;
 		this.usingClause = (ResultColumnList) usingClause;
+		this.joinOrderStrategyProperties = (Properties)joinOrderStrategyProperties;
 
 		/* JoinNodes can be generated in the parser or at the end of optimization.
 		 * Those generated in the parser do not have resultColumns yet.
@@ -1645,6 +1651,14 @@
 		// estimated cost
 		mb.push(costEstimate.getEstimatedCost());
 
+		//User may have supplied optimizer overrides in the sql
+		//Pass them onto execute phase so it can be shown in 
+		//run time statistics.
+		if (joinOrderStrategyProperties != null)
+			mb.push(PropertyUtil.sortProperties(joinOrderStrategyProperties));
+		else
+			mb.pushNull("java.lang.String");
+		
 		closeMethodArgument(acb, mb);
 
 		return numArgs;
@@ -1665,7 +1679,7 @@
 	 */
 	protected int getNumJoinArguments()
 	{
-		return 12;
+		return 13;
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NestedLoopJoinStrategy.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NestedLoopJoinStrategy.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NestedLoopJoinStrategy.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NestedLoopJoinStrategy.java Mon Jan 16 17:10:52 2006
@@ -224,11 +224,11 @@
 
 		if (bulkFetch > 1)
 		{
-			numArgs = 25;
+			numArgs = 26;
 		}
 		else
 		{
-			numArgs = 24;
+			numArgs = 25;
 		}
 
 		fillInScanArgs1(tc, mb,

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java Mon Jan 16 17:10:52 2006
@@ -1660,6 +1660,8 @@
 												null,
 												leftRCList,
 												null,
+												//user supplied optimizer overrides
+												fromList.properties,
 												getContextManager()
 												),
 							0

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj Mon Jan 16 17:10:52 2006
@@ -8563,6 +8563,7 @@
 									usingClause,
 									null,
 									null,
+									null,
 									getContextManager());
 				break;
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BulkTableScanResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BulkTableScanResultSet.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BulkTableScanResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BulkTableScanResultSet.java Mon Jan 16 17:10:52 2006
@@ -92,6 +92,7 @@
 		boolean sameStartStopPosition,
 		Qualifier[][] qualifiers,
 		String tableName,
+		String userSuppliedOptimizerOverrides,
 		String indexName,
 		boolean isConstraint,
 		boolean forUpdate,
@@ -119,6 +120,7 @@
 			sameStartStopPosition,
 			qualifiers,
 			tableName,
+			userSuppliedOptimizerOverrides,
 			indexName,
 			isConstraint,
 			forUpdate,

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DependentResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DependentResultSet.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DependentResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DependentResultSet.java Mon Jan 16 17:10:52 2006
@@ -104,6 +104,7 @@
 	protected Qualifier[][] qualifiers;
 	protected GeneratedMethod closeCleanup;
 	public String tableName;
+	public String userSuppliedOptimizerOverrides;
 	public String indexName;
 	protected boolean runTimeStatisticsOn;
 	protected FormatableBitSet accessedCols;
@@ -139,6 +140,7 @@
 		boolean sameStartStopPosition,
 		Qualifier[][] qualifiers,
 		String tableName,
+		String userSuppliedOptimizerOverrides,
 		String indexName,
 		boolean isConstraint,
 		boolean forUpdate,
@@ -191,6 +193,7 @@
 		this.sameStartStopPosition = sameStartStopPosition;
 		this.qualifiers = qualifiers;
 		this.tableName = tableName;
+		this.userSuppliedOptimizerOverrides = userSuppliedOptimizerOverrides;
 		this.indexName = "On Foreign Key";  // RESOLVE , get actual indexName;
 		this.isConstraint = isConstraint;
 		this.forUpdate = forUpdate;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DistinctScanResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DistinctScanResultSet.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DistinctScanResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DistinctScanResultSet.java Mon Jan 16 17:10:52 2006
@@ -82,6 +82,7 @@
 		int resultSetNumber,
 		int hashKeyItem,
 		String tableName,
+		String userSuppliedOptimizerOverrides,
 		String indexName,
 		boolean isConstraint,
 		int colRefItem,
@@ -102,7 +103,7 @@
 			  (Qualifier[][]) null,	  // scanQualifiers
 			  (Qualifier[][]) null,	  // nextQualifiers
 			  DEFAULT_INITIAL_CAPACITY, DEFAULT_LOADFACTOR, DEFAULT_MAX_CAPACITY,
-			  hashKeyItem, tableName, indexName, isConstraint, 
+			  hashKeyItem, tableName, userSuppliedOptimizerOverrides, indexName, isConstraint, 
 			  false,				  // forUpdate
 			  colRefItem, lockMode, tableLocked, isolationLevel,
 			  false,

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericResultSetFactory.java Mon Jan 16 17:10:52 2006
@@ -521,6 +521,7 @@
 									int maxCapacity,
 									int hashKeyColumn,
 									String tableName,
+									String userSuppliedOptimizerOverrides,
 									String indexName,
 									boolean isConstraint,
 									boolean forUpdate,
@@ -555,6 +556,7 @@
 								maxCapacity,
 								hashKeyColumn,
 								tableName,
+								userSuppliedOptimizerOverrides,
 								indexName,
 								isConstraint,
 								forUpdate,
@@ -581,6 +583,7 @@
 									int resultSetNumber,
 									int hashKeyColumn,
 									String tableName,
+									String userSuppliedOptimizerOverrides,
 									String indexName,
 									boolean isConstraint,
 									int colRefItem,
@@ -602,6 +605,7 @@
 								resultSetNumber,
 								hashKeyColumn,
 								tableName,
+								userSuppliedOptimizerOverrides,
 								indexName,
 								isConstraint,
 								colRefItem,
@@ -631,6 +635,7 @@
 									boolean sameStartStopPosition,
 									Qualifier[][] qualifiers,
 									String tableName,
+									String userSuppliedOptimizerOverrides,
 									String indexName,
 									boolean isConstraint,
 									boolean forUpdate,
@@ -660,6 +665,7 @@
 								sameStartStopPosition,
 								qualifiers,
 								tableName,
+								userSuppliedOptimizerOverrides,
 								indexName,
 								isConstraint,
 								forUpdate,
@@ -693,6 +699,7 @@
 									boolean sameStartStopPosition,
 									Qualifier[][] qualifiers,
 									String tableName,
+									String userSuppliedOptimizerOverrides,
 									String indexName,
 									boolean isConstraint,
 									boolean forUpdate,
@@ -730,6 +737,7 @@
 								sameStartStopPosition,
 								qualifiers,
 								tableName,
+								userSuppliedOptimizerOverrides,
 								indexName,
 								isConstraint,
 								forUpdate,
@@ -801,6 +809,7 @@
 								   boolean notExistsRightSide,
 								   double optimizerEstimatedRowCount,
 								   double optimizerEstimatedCost,
+								   String userSuppliedOptimizerOverrides,
 								   GeneratedMethod closeCleanup)
 			throws StandardException
 	{
@@ -812,6 +821,7 @@
 										   notExistsRightSide, 
 										   optimizerEstimatedRowCount,
 										   optimizerEstimatedCost,
+										   userSuppliedOptimizerOverrides,
 										   closeCleanup);
 	}
 
@@ -831,6 +841,7 @@
 								   boolean notExistsRightSide,
 								   double optimizerEstimatedRowCount,
 								   double optimizerEstimatedCost,
+								   String userSuppliedOptimizerOverrides,
 								   GeneratedMethod closeCleanup)
 			throws StandardException
 	{
@@ -842,6 +853,7 @@
 										   notExistsRightSide, 
 										   optimizerEstimatedRowCount,
 										   optimizerEstimatedCost,
+										   userSuppliedOptimizerOverrides,
 										   closeCleanup);
 	}
 
@@ -863,6 +875,7 @@
 								   boolean notExistsRightSide,
 								   double optimizerEstimatedRowCount,
 								   double optimizerEstimatedCost,
+								   String userSuppliedOptimizerOverrides,
 								   GeneratedMethod closeCleanup)
 			throws StandardException
 	{
@@ -876,6 +889,7 @@
 										   notExistsRightSide,
 										   optimizerEstimatedRowCount,
 										   optimizerEstimatedCost,
+										   userSuppliedOptimizerOverrides,
 										   closeCleanup);
 	}
 
@@ -897,6 +911,7 @@
 								   boolean notExistsRightSide,
 								   double optimizerEstimatedRowCount,
 								   double optimizerEstimatedCost,
+								   String userSuppliedOptimizerOverrides,
 								   GeneratedMethod closeCleanup)
 			throws StandardException
 	{
@@ -910,6 +925,7 @@
 										   notExistsRightSide,
 										   optimizerEstimatedRowCount,
 										   optimizerEstimatedCost,
+										   userSuppliedOptimizerOverrides,
 										   closeCleanup);
 	}
 
@@ -1086,6 +1102,7 @@
 	 *		ExecRow rowAllocator() throws StandardException; </verbatim>
 	 * @param conglomId 		the conglomerate of the table to be scanned.
 	 * @param tableName			The full name of the table
+	 * @param userSuppliedOptimizerOverrides		Overrides specified by the user on the sql
 	 * @param indexName			The name of the index, if one used to access table.
 	 * @param colRefItem		An saved item for a bitSet of columns that
 	 *							are referenced in the underlying table.  -1 if
@@ -1112,6 +1129,7 @@
 		GeneratedMethod 	resultRowAllocator,
 		long 				conglomId,
 		String 				tableName,
+		String 				userSuppliedOptimizerOverrides,
 		String 				indexName,
 		int 				colRefItem,
 		int 				lockMode,
@@ -1128,6 +1146,7 @@
 					resultRowAllocator,
 					conglomId,
 					tableName,
+					userSuppliedOptimizerOverrides,
 					indexName,
 					colRefItem,
 					lockMode,
@@ -1158,6 +1177,7 @@
 									boolean sameStartStopPosition,
 									Qualifier[][] qualifiers,
 									String tableName,
+									String userSuppliedOptimizerOverrides,
 									String indexName,
 									boolean isConstraint,
 									boolean forUpdate,
@@ -1191,6 +1211,7 @@
 								sameStartStopPosition,
 								qualifiers,
 								tableName,
+								userSuppliedOptimizerOverrides,
 								indexName,
 								isConstraint,
 								forUpdate,

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashJoinResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashJoinResultSet.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashJoinResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashJoinResultSet.java Mon Jan 16 17:10:52 2006
@@ -56,11 +56,12 @@
 								   boolean notExistsRightSide,
 								   double optimizerEstimatedRowCount,
 								   double optimizerEstimatedCost,
+								   String userSuppliedOptimizerOverrides,
 								   GeneratedMethod closeCleanup)
     {
 		super(leftResultSet, leftNumCols, rightResultSet, rightNumCols,
 			  activation, restriction, resultSetNumber, 
 			  oneRowRightSide, notExistsRightSide, optimizerEstimatedRowCount, 
-			  optimizerEstimatedCost, closeCleanup);
+			  optimizerEstimatedCost, userSuppliedOptimizerOverrides, closeCleanup);
     }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashLeftOuterJoinResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashLeftOuterJoinResultSet.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashLeftOuterJoinResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashLeftOuterJoinResultSet.java Mon Jan 16 17:10:52 2006
@@ -59,6 +59,7 @@
 					    boolean notExistsRightSide,
  					    double optimizerEstimatedRowCount,
 						double optimizerEstimatedCost,
+						String userSuppliedOptimizerOverrides,
 						GeneratedMethod closeCleanup)
     {
 		super(leftResultSet, leftNumCols, rightResultSet, rightNumCols,
@@ -66,6 +67,6 @@
 			  emptyRowFun, wasRightOuterJoin,
 			  oneRowRightSide, notExistsRightSide,
 			  optimizerEstimatedRowCount, optimizerEstimatedCost, 
-			  closeCleanup);
+			  userSuppliedOptimizerOverrides, closeCleanup);
     }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashScanResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashScanResultSet.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashScanResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/HashScanResultSet.java Mon Jan 16 17:10:52 2006
@@ -110,6 +110,7 @@
 	private int maxCapacity;
 	private GeneratedMethod closeCleanup;
 	public String tableName;
+	public String userSuppliedOptimizerOverrides;
 	public String indexName;
 	public boolean forUpdate;
 	private boolean runTimeStatisticsOn;
@@ -152,6 +153,7 @@
 		int maxCapacity,
 		int hashKeyItem,
 		String tableName,
+		String userSuppliedOptimizerOverrides,
 		String indexName,
 		boolean isConstraint,
 		boolean forUpdate,
@@ -195,6 +197,7 @@
 		this.loadFactor = loadFactor;
 		this.maxCapacity = maxCapacity;
         this.tableName = tableName;
+        this.userSuppliedOptimizerOverrides = userSuppliedOptimizerOverrides;
         this.indexName = indexName;
 		this.isConstraint = isConstraint;
 		this.forUpdate = forUpdate;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java Mon Jan 16 17:10:52 2006
@@ -2329,6 +2329,7 @@
 							false,
 							(Qualifier[][])null,	// qualifiers
 							"tableName",
+							(String)null,
 							(String)null,			// index name
 							false,					// is constraint
 							false,					// for update

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JoinResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JoinResultSet.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JoinResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JoinResultSet.java Mon Jan 16 17:10:52 2006
@@ -65,6 +65,8 @@
     protected GeneratedMethod closeCleanup;
 	public	  boolean oneRowRightSide;
 	public	  boolean notExistsRightSide;  //right side is NOT EXISTS
+	
+	String userSuppliedOptimizerOverrides;
 
     /*
      * class interface
@@ -81,6 +83,7 @@
 								   boolean notExistsRightSide,
 								   double optimizerEstimatedRowCount,
 								   double optimizerEstimatedCost,
+								   String userSuppliedOptimizerOverrides,
 								   GeneratedMethod closeCleanup)
     {
 		super(activation, resultSetNumber, optimizerEstimatedRowCount, 
@@ -94,6 +97,7 @@
 		this.notExistsRightSide = notExistsRightSide;
         this.closeCleanup = closeCleanup;
 		constructorTime += getElapsedMillis(beginTime);
+		this.userSuppliedOptimizerOverrides = userSuppliedOptimizerOverrides;
     }
 
 	//

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/LastIndexKeyResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/LastIndexKeyResultSet.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/LastIndexKeyResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/LastIndexKeyResultSet.java Mon Jan 16 17:10:52 2006
@@ -70,6 +70,7 @@
 	protected Qualifier[][] qualifiers;
 	protected GeneratedMethod closeCleanup;
 	public String tableName;
+	public String userSuppliedOptimizerOverrides;
 	public String indexName;
 	protected boolean runTimeStatisticsOn;
 	protected FormatableBitSet accessedCols;
@@ -95,6 +96,7 @@
 	 *		ExecRow rowAllocator() throws StandardException; </verbatim>
 	 * @param conglomId 		the conglomerate of the table to be scanned.
 	 * @param tableName			The full name of the table
+	 * @param userSuppliedOptimizerOverrides		Overrides specified by the user on the sql
 	 * @param indexName			The name of the index, if one used to access table.
 	 * @param colRefItem		An saved item for a bitSet of columns that
 	 *							are referenced in the underlying table.  -1 if
@@ -119,6 +121,7 @@
 		GeneratedMethod resultRowAllocator, 
 		long conglomId, 
 		String tableName,
+		String userSuppliedOptimizerOverrides,
 		String indexName,
 		int colRefItem,
 		int lockMode,
@@ -144,6 +147,7 @@
 
 		this.resultRowAllocator = resultRowAllocator;
 		this.tableName = tableName;
+		this.userSuppliedOptimizerOverrides = userSuppliedOptimizerOverrides;
 		this.indexName = indexName;
 		this.lockMode = lockMode;
 		if (colRefItem != -1)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MergeJoinResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MergeJoinResultSet.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MergeJoinResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/MergeJoinResultSet.java Mon Jan 16 17:10:52 2006
@@ -93,7 +93,7 @@
 		super(leftResultSet, leftNumCols, rightResultSet, rightNumCols,
 			  activation, restriction, resultSetNumber, 
 			  oneRowRightSide, notExistsRightSide, optimizerEstimatedRowCount, 
-			  optimizerEstimatedCost, closeCleanup);
+			  optimizerEstimatedCost, null, closeCleanup);
 
 		this.leftGreaterThanRight = leftGreaterThanRight;
     }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NestedLoopJoinResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NestedLoopJoinResultSet.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NestedLoopJoinResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NestedLoopJoinResultSet.java Mon Jan 16 17:10:52 2006
@@ -287,12 +287,13 @@
 								   boolean notExistsRightSide,
 								   double optimizerEstimatedRowCount,
 								   double optimizerEstimatedCost,
+								   String userSuppliedOptimizerOverrides,
 								   GeneratedMethod closeCleanup)
     {
 		super(leftResultSet, leftNumCols, rightResultSet, rightNumCols,
 			  activation, restriction, resultSetNumber, 
 			  oneRowRightSide, notExistsRightSide, optimizerEstimatedRowCount, 
-			  optimizerEstimatedCost, closeCleanup);
+			  optimizerEstimatedCost, userSuppliedOptimizerOverrides, closeCleanup);
 		if (notExistsRightSide)
 			rightTemplate = getExecutionFactory().getValueRow(rightNumCols);
     }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NestedLoopLeftOuterJoinResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NestedLoopLeftOuterJoinResultSet.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NestedLoopLeftOuterJoinResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NestedLoopLeftOuterJoinResultSet.java Mon Jan 16 17:10:52 2006
@@ -283,13 +283,14 @@
 					    boolean notExistsRightSide,
  					    double optimizerEstimatedRowCount,
 						double optimizerEstimatedCost,
+						String userSuppliedOptimizerOverrides,
 						GeneratedMethod closeCleanup)
     {
 		super(leftResultSet, leftNumCols, rightResultSet, rightNumCols,
 			  activation, restriction, resultSetNumber, 
 			  oneRowRightSide, notExistsRightSide,
 			  optimizerEstimatedRowCount, optimizerEstimatedCost, 
-			  closeCleanup);
+			  userSuppliedOptimizerOverrides, closeCleanup);
 		this.emptyRowFun = emptyRowFun;
 		this.wasRightOuterJoin = wasRightOuterJoin;
     }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RealResultSetStatisticsFactory.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RealResultSetStatisticsFactory.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RealResultSetStatisticsFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RealResultSetStatisticsFactory.java Mon Jan 16 17:10:52 2006
@@ -595,6 +595,7 @@
                     tsrs.closeTime,
                     tsrs.resultSetNumber,
                     tsrs.tableName,
+					tsrs.userSuppliedOptimizerOverrides,
                     tsrs.indexName,
                     tsrs.isConstraint,
                     tsrs.printQualifiers(tsrs.qualifiers),
@@ -688,6 +689,7 @@
 											hlojrs.restrictionTime,
 											hlojrs.optimizerEstimatedRowCount,
 											hlojrs.optimizerEstimatedCost,
+											hlojrs.userSuppliedOptimizerOverrides,
 											getResultSetStatistics(
 												hlojrs.leftResultSet),
 											getResultSetStatistics(
@@ -714,6 +716,7 @@
 											nllojrs.restrictionTime,
 											nllojrs.optimizerEstimatedRowCount,
 											nllojrs.optimizerEstimatedCost,
+											nllojrs.userSuppliedOptimizerOverrides,
 											getResultSetStatistics(
 												nllojrs.leftResultSet),
 											getResultSetStatistics(
@@ -740,6 +743,7 @@
 											hjrs.oneRowRightSide,
 											hjrs.optimizerEstimatedRowCount,
 											hjrs.optimizerEstimatedCost,
+											hjrs.userSuppliedOptimizerOverrides,
 											getResultSetStatistics(
 												hjrs.leftResultSet),
 											getResultSetStatistics(
@@ -766,6 +770,7 @@
 											nljrs.oneRowRightSide,
 											nljrs.optimizerEstimatedRowCount,
 											nljrs.optimizerEstimatedCost,
+											nljrs.userSuppliedOptimizerOverrides,
 											getResultSetStatistics(
 												nljrs.leftResultSet),
 											getResultSetStatistics(
@@ -1269,6 +1274,7 @@
                     dsrs.closeTime,
                     dsrs.resultSetNumber,
                     dsrs.tableName,
+					null,
                     dsrs.indexName,
                     dsrs.isConstraint,
                     dsrs.printQualifiers(),

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java Mon Jan 16 17:10:52 2006
@@ -95,6 +95,7 @@
 	public    Qualifier[][] qualifiers;
 	protected GeneratedMethod closeCleanup;
 	public String tableName;
+	public String userSuppliedOptimizerOverrides;
 	public String indexName;
 	protected boolean runTimeStatisticsOn;
 	protected FormatableBitSet accessedCols;
@@ -150,6 +151,7 @@
 		boolean sameStartStopPosition,
 		Qualifier[][] qualifiers,
 		String tableName,
+		String userSuppliedOptimizerOverrides,
 		String indexName,
 		boolean isConstraint,
 		boolean forUpdate,
@@ -198,6 +200,7 @@
 		this.sameStartStopPosition = sameStartStopPosition;
 		this.qualifiers = qualifiers;
 		this.tableName = tableName;
+		this.userSuppliedOptimizerOverrides = userSuppliedOptimizerOverrides;
 		this.indexName = indexName;
 		this.isConstraint = isConstraint;
 		this.forUpdate = forUpdate;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashJoinStatistics.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashJoinStatistics.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashJoinStatistics.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashJoinStatistics.java Mon Jan 16 17:10:52 2006
@@ -55,6 +55,7 @@
 								boolean oneRowRightSide,
 								double optimizerEstimatedRowCount,
 								double optimizerEstimatedCost,
+								String userSuppliedOptimizerOverrides,
 								ResultSetStatistics leftResultSetStatistics,
 								ResultSetStatistics rightResultSetStatistics
 								)
@@ -75,6 +76,7 @@
 			oneRowRightSide,
 			optimizerEstimatedRowCount,
 			optimizerEstimatedCost,
+			userSuppliedOptimizerOverrides,
 			leftResultSetStatistics,
 			rightResultSetStatistics
 			);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashLeftOuterJoinStatistics.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashLeftOuterJoinStatistics.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashLeftOuterJoinStatistics.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashLeftOuterJoinStatistics.java Mon Jan 16 17:10:52 2006
@@ -56,6 +56,7 @@
 								long restrictionTime,
 								double optimizerEstimatedRowCount,
 								double optimizerEstimatedCost,
+								String userSuppliedOptimizerOverrides,
 								ResultSetStatistics leftResultSetStatistics,
 								ResultSetStatistics rightResultSetStatistics,
 								int emptyRightRowsReturned
@@ -76,6 +77,7 @@
 			restrictionTime,
 			optimizerEstimatedRowCount,
 			optimizerEstimatedCost,
+			userSuppliedOptimizerOverrides,
 			leftResultSetStatistics,
 			rightResultSetStatistics,
 			emptyRightRowsReturned

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealJoinResultSetStatistics.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealJoinResultSetStatistics.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealJoinResultSetStatistics.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealJoinResultSetStatistics.java Mon Jan 16 17:10:52 2006
@@ -46,6 +46,7 @@
 	public int rowsSeenRight;
 	public int rowsReturned;
 	public long restrictionTime;
+	public String userSuppliedOptimizerOverrides;
 
 
 	// CONSTRUCTORS
@@ -68,7 +69,8 @@
 										int rowsReturned,
 										long restrictionTime,
 										double optimizerEstimatedRowCount,
-										double optimizerEstimatedCost
+										double optimizerEstimatedCost,
+										String userSuppliedOptimizerOverrides
 										)
 	{
 		super(
@@ -87,6 +89,7 @@
 		this.rowsSeenRight = rowsSeenRight;
 		this.rowsReturned = rowsReturned;
 		this.restrictionTime = restrictionTime;
+		this.userSuppliedOptimizerOverrides = userSuppliedOptimizerOverrides;	
 	}
 
  

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealNestedLoopJoinStatistics.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealNestedLoopJoinStatistics.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealNestedLoopJoinStatistics.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealNestedLoopJoinStatistics.java Mon Jan 16 17:10:52 2006
@@ -74,6 +74,7 @@
 								boolean oneRowRightSide,
 								double optimizerEstimatedRowCount,
 								double optimizerEstimatedCost,
+								String userSuppliedOptimizerOverrides,
 								ResultSetStatistics leftResultSetStatistics,
 								ResultSetStatistics rightResultSetStatistics
 								)
@@ -92,7 +93,8 @@
 			rowsReturned,
 			restrictionTime,
 			optimizerEstimatedRowCount,
-			optimizerEstimatedCost
+			optimizerEstimatedCost,
+			userSuppliedOptimizerOverrides
 			);
 		this.oneRowRightSide = oneRowRightSide;
 		this.leftResultSetStatistics = leftResultSetStatistics;
@@ -114,7 +116,17 @@
 	{
 		initFormatInfo(depth);
 
+		String header = "";
+		if (userSuppliedOptimizerOverrides != null)
+		{ 
+			header = 
+				indent + MessageService.getTextMessage(SQLState.RTS_USER_SUPPLIED_OPTIMIZER_OVERRIDES_FOR_JOIN,
+						userSuppliedOptimizerOverrides);
+			header = header + "\n";
+		}
+		
 		return
+		header +
 			indent + resultSetName + ":\n" +
 			indent + MessageService.getTextMessage(SQLState.RTS_NUM_OPENS) +
 				" = " + numOpens + "\n" + 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealNestedLoopLeftOuterJoinStatistics.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealNestedLoopLeftOuterJoinStatistics.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealNestedLoopLeftOuterJoinStatistics.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealNestedLoopLeftOuterJoinStatistics.java Mon Jan 16 17:10:52 2006
@@ -65,6 +65,7 @@
 								long restrictionTime,
 								double optimizerEstimatedRowCount,
 								double optimizerEstimatedCost,
+								String userSuppliedOptimizerOverrides,
 								ResultSetStatistics leftResultSetStatistics,
 								ResultSetStatistics rightResultSetStatistics,
 								int emptyRightRowsReturned
@@ -86,6 +87,7 @@
 			false,		// We never do an EXISTS join for an outer join
 			optimizerEstimatedRowCount,
 			optimizerEstimatedCost,
+			userSuppliedOptimizerOverrides,
 			leftResultSetStatistics,
 			rightResultSetStatistics
 			);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealTableScanStatistics.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealTableScanStatistics.java?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealTableScanStatistics.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealTableScanStatistics.java Mon Jan 16 17:10:52 2006
@@ -53,6 +53,7 @@
 	public int		fetchSize;
 	public String isolationLevel;
 	public String tableName;
+	public String userSuppliedOptimizerOverrides;
 	public String indexName;
 	public String lockString;
 	public String qualifiers;
@@ -75,6 +76,7 @@
 									long closeTime,
 									int resultSetNumber,
 									String tableName,
+									String userSuppliedOptimizerOverrides,
 									String indexName,
 									boolean isConstraint,
 									String qualifiers,
@@ -102,6 +104,7 @@
 			optimizerEstimatedCost
 			);
 		this.tableName = tableName;
+		this.userSuppliedOptimizerOverrides = userSuppliedOptimizerOverrides;
 		this.indexName = indexName;
 		this.isConstraint = isConstraint;
 		this.qualifiers = qualifiers;
@@ -130,14 +133,21 @@
 	 */
 	public String getStatementExecutionPlanText(int depth)
 	{
-		String header;
+		String header = "";
 		String isolationString = null;
 
 		initFormatInfo(depth);
 
+		if (userSuppliedOptimizerOverrides != null)
+		{ 
+			header = 
+				indent + MessageService.getTextMessage(SQLState.RTS_USER_SUPPLIED_OPTIMIZER_OVERRIDES_FOR_TABLE,
+						tableName, userSuppliedOptimizerOverrides);
+			header = header + "\n";
+		}
 		if (indexName != null)
 		{
-			header =
+			header = header +
 				indent + MessageService.getTextMessage(
 											SQLState.RTS_IS_RS_USING,
 											tableName,
@@ -150,7 +160,7 @@
 		}
 		else
 		{
-			header =
+			header = header +
 				indent + MessageService.getTextMessage(
 											SQLState.RTS_TS_RS_FOR,
 											tableName);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties?rev=369619&r1=369618&r2=369619&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties Mon Jan 16 17:10:52 2006
@@ -906,6 +906,8 @@
 43Y53.U=Referential Actions On Dependent Tables
 43Y54.U=Begin Referential Action On Dependent Table Number
 43Y55.U=End Referential Action On Dependent Table Number
+43Y56.U=User supplied optimizer overrides on {0} are {1}
+43Y57.U=User supplied optimizer overrides for join are {0}
 
 54004=SELECT statement has too many items in GROUP BY, ORDER BY or select list.
 54008=The CREATE INDEX statement specifies too many columns (16 is the maximum).



Mime
View raw message