db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From banda...@apache.org
Subject svn commit: r369599 - /db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
Date Mon, 16 Jan 2006 23:06:54 GMT
Author: bandaram
Date: Mon Jan 16 15:06:51 2006
New Revision: 369599

URL: http://svn.apache.org/viewcvs?rev=369599&view=rev
Log:
DERBY-808: Make searchClauseTransitiveClosure handle case of Parameters, as well as Constants
while considering transitive closure optimizations.

Submitted by Satheesh Bandaram (satheesh@sourcery.org)

Modified:
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java?rev=369599&r1=369598&r2=369599&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
(original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
Mon Jan 16 15:06:51 2006
@@ -2126,7 +2126,10 @@
 				ValueNode left = bcon.getLeftOperand();
 				ValueNode right = bcon.getRightOperand();
 
-				if (left instanceof ColumnReference && right instanceof ConstantNode)
+				// Consider using variant type of the expression, instead of ConstantNode
+				// or ParameterNode while porting this fix to trunk.
+				if (left instanceof ColumnReference && 
+					  (right instanceof ConstantNode || right instanceof ParameterNode))
 				{
 					searchClauses.addElement(predicate);
 				}
@@ -2166,8 +2169,14 @@
 			else
 			{
 				searchCR = (ColumnReference) ((BinaryComparisonOperatorNode) ro).getLeftOperand();
-				ConstantNode currCN = (ConstantNode) ((BinaryComparisonOperatorNode) ro).getRightOperand();
-				searchODV = (DataValueDescriptor) currCN.getValue();
+
+				// Don't get value for parameterNode since not known yet.
+				if (((BinaryComparisonOperatorNode) ro).getRightOperand() instanceof ConstantNode)
+				{
+					ConstantNode currCN = (ConstantNode) ((BinaryComparisonOperatorNode) ro).getRightOperand();
+					searchODV = (DataValueDescriptor) currCN.getValue();
+				}
+				else searchODV = null;
 			}
 			// Cache the table and column numbers of searchCR
 			int tableNumber = searchCR.getTableNumber();
@@ -2241,8 +2250,12 @@
 					else
 					{
 						searchCR2 = (ColumnReference) ((BinaryComparisonOperatorNode) ro2).getLeftOperand();
-						ConstantNode currCN = (ConstantNode) ((BinaryComparisonOperatorNode) ro2).getRightOperand();
-						currODV = (DataValueDescriptor) currCN.getValue();
+						if (((BinaryComparisonOperatorNode) ro2).getRightOperand() instanceof ConstantNode)
+						{
+							ConstantNode currCN = (ConstantNode) ((BinaryComparisonOperatorNode) ro2).getRightOperand();
+							currODV = (DataValueDescriptor) currCN.getValue();
+						}
+						else currODV = null;
 					}
 
 					/* Is this a match? A match is a search clause with



Mime
View raw message