You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Jayaram Subramanian <rs...@gmail.com> on 2011/04/14 05:20:15 UTC

Re: (DERBY-5010) [patch] bad equivalence check

Hi Knut,
Sorry for the delay.. It was hectic for me for the past 2 months..
When i placed thread.dumpstack and ran the lang.__suite, the log shows
a lot of references to isEquivalent method..  Just attaching one of
the example. Could you please guide me how to proceed from here

With Regards
Jayaram

java.lang.Throwable
	at java.lang.Thread.dumpStack(Thread.java:417)
	at org.apache.derby.impl.sql.compile.BaseColumnNode.isEquivalent(BaseColumnNode.java:180)
	at org.apache.derby.impl.sql.compile.SubstituteExpressionVisitor.visit(SubstituteExpressionVisitor.java:62)
	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:718)
	at org.apache.derby.impl.sql.compile.ResultColumn.acceptChildren(ResultColumn.java:1550)
	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
	at org.apache.derby.impl.sql.compile.QueryTreeNodeVector.acceptChildren(QueryTreeNodeVector.java:141)
	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
	at org.apache.derby.impl.sql.compile.ResultSetNode.acceptChildren(ResultSetNode.java:1611)
	at org.apache.derby.impl.sql.compile.FromBaseTable.acceptChildren(FromBaseTable.java:4621)
	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
	at org.apache.derby.impl.sql.compile.SingleChildResultSetNode.acceptChildren(SingleChildResultSetNode.java:611)
	at org.apache.derby.impl.sql.compile.ProjectRestrictNode.acceptChildren(ProjectRestrictNode.java:1843)
	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
	at org.apache.derby.impl.sql.compile.SingleChildResultSetNode.acceptChildren(SingleChildResultSetNode.java:611)
	at org.apache.derby.impl.sql.compile.ProjectRestrictNode.acceptChildren(ProjectRestrictNode.java:1843)
	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
	at org.apache.derby.impl.sql.compile.SingleChildResultSetNode.acceptChildren(SingleChildResultSetNode.java:611)
	at org.apache.derby.impl.sql.compile.ProjectRestrictNode.acceptChildren(ProjectRestrictNode.java:1843)
	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
	at org.apache.derby.impl.sql.compile.SubqueryNode.acceptChildren(SubqueryNode.java:2300)
	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
	at org.apache.derby.impl.sql.compile.UnaryOperatorNode.acceptChildren(UnaryOperatorNode.java:759)
	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
	at org.apache.derby.impl.sql.compile.BinaryOperatorNode.acceptChildren(BinaryOperatorNode.java:855)
	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
	at org.apache.derby.impl.sql.compile.GroupByNode.addNewColumnsForAggregation(GroupByNode.java:566)
	at org.apache.derby.impl.sql.compile.GroupByNode.addAggregates(GroupByNode.java:245)
	at org.apache.derby.impl.sql.compile.GroupByNode.init(GroupByNode.java:184)
	at org.apache.derby.iapi.sql.compile.NodeFactory.getNode(NodeFactory.java:273)
	at org.apache.derby.impl.sql.compile.SelectNode.genProjectRestrict(SelectNode.java:1483)
	at org.apache.derby.impl.sql.compile.SelectNode.modifyAccessPaths(SelectNode.java:2123)
	at org.apache.derby.impl.sql.compile.SingleChildResultSetNode.modifyAccessPaths(SingleChildResultSetNode.java:439)
	at org.apache.derby.impl.sql.compile.SubqueryNode.modifyAccessPaths(SubqueryNode.java:1873)
	at org.apache.derby.impl.sql.compile.SubqueryList.modifyAccessPaths(SubqueryList.java:116)
	at org.apache.derby.impl.sql.compile.SelectNode.modifyAccessPaths(SelectNode.java:2051)
	at org.apache.derby.impl.sql.compile.SingleChildResultSetNode.modifyAccessPaths(SingleChildResultSetNode.java:439)
	at org.apache.derby.impl.sql.compile.SubqueryNode.modifyAccessPaths(SubqueryNode.java:1873)
	at org.apache.derby.impl.sql.compile.SubqueryList.modifyAccessPaths(SubqueryList.java:116)
	at org.apache.derby.impl.sql.compile.SelectNode.modifyAccessPaths(SelectNode.java:2051)
	at org.apache.derby.impl.sql.compile.DMLStatementNode.optimizeStatement(DMLStatementNode.java:317)
	at org.apache.derby.impl.sql.compile.CursorNode.optimizeStatement(CursorNode.java:587)


On Tue, Feb 8, 2011 at 4:48 PM, Knut Anders Hatlen
<kn...@oracle.com> wrote:
>>> Knut Anders Hatlen commented on DERBY-5010:
>>> -------------------------------------------
>>>
>>> The current code looks wrong and the suggested fix looks right.
>>>
>>> None of our regression tests seem to exercise this code path,
>>> though. It would be good if someone could come up with a statement
>>> that caused this code to be executed so that we can verify that it
>>> behaves as expected after the proposed changes.
>
> Jayaram Subramanian <rs...@gmail.com> writes:
>
>> Hi Knut,
>> I am interested in taking up this task.  Let me know your views on the same.
>
> Hi Jayaram,
>
> Thanks for volunteering to look into this. I think a good first step
> would be to find a query that actually ends up calling
> BaseColumnNode.isEquivalent(). I saw from some old test coverage reports
> that the method was called, but the parts of it that were touched by the
> patch were never executed. For example, you can add a call to
> Thread.dumpStack() in that method, run the lang test suite
> (org.apache.derbyTesting.functionTests.tests.lang._Suite), and see where
> it's called from.
>
> The method was added as part of DERBY-883, so I'd expect that queries
> that use it typically have aggregates and GROUP BY clauses.
>
> --
> Knut Anders
>

Re: (DERBY-5010) [patch] bad equivalence check

Posted by Bryan Pendleton <bp...@gmail.com>.
On 04/15/2011 04:46 AM, Jayaram Subramanian wrote:
> Hi,
> Modified the isEquivalent method to throw an exception like this.. is
> it correct..
>

That seems like a fine way to inject an exception for testing. I don't
think you need the "if (1 == 1)" but it doesn't hurt...

>
> Also  all of a sudden i started getting
> 1) TriggerTests:embeddedjava.sql.SQLException: No suitable driver

I'm confused; you get this *after* you starting forcing exceptions,
or you're getting this even before you inserted the artificial exception?

If you are getting this *after* you introduced the exception, then it's
probably just a side effect of the unexpected exception, and you'll
want to be looking in your derby.log to try to get the full stack trace.

The real goal, of course, is to find out what queries are calling the
isEquivalent API. The exception is just a tool to try to help figuring
that out.

thanks,

bryan



Re: (DERBY-5010) [patch] bad equivalence check

Posted by Jayaram Subramanian <rs...@gmail.com>.
Hi,
Modified the isEquivalent method to throw an exception like this.. is
it correct..

protected boolean isEquivalent(ValueNode o) throws StandardException
	{
		//Thread.dumpStck();
		
		
		if (isSameNodeType(o))
		{
			BaseColumnNode other = (BaseColumnNode)o;
			return other.tableName.equals(other.tableName)
			&& other.columnName.equals(columnName);
		}
		if (1==1) {	
			throw StandardException.newException("Exception in equivalent for test");
		}
		return false;
	}
}

Also  all of a sudden i started getting
1) TriggerTests:embeddedjava.sql.SQLException: No suitable driver
	at java.sql.DriverManager.getConnection(DriverManager.java:330)
	at java.sql.DriverManager.getConnection(DriverManager.java:297)
	at org.apache.derbyTesting.junit.DriverManagerConnector.openConnection(DriverManagerConnector.java:81)
	at org.apache.derbyTesting.junit.DriverManagerConnector.openConnection(DriverManagerConnector.java:43)
	at org.apache.derbyTesting.junit.TestConfiguration.openDefaultConnection(TestConfiguration.java:1538)

With Regards
Jayaram

On Thu, Apr 14, 2011 at 4:57 AM, Knut Anders Hatlen
<kn...@oracle.com> wrote:
> Jayaram Subramanian <rs...@gmail.com> writes:
>
>> Hi Knut,
>> Sorry for the delay.. It was hectic for me for the past 2 months..
>> When i placed thread.dumpstack and ran the lang.__suite, the log shows
>> a lot of references to isEquivalent method..  Just attaching one of
>> the example. Could you please guide me how to proceed from here
>
> Hi Jayaram,
>
> This sounds like good progress. Now you know which tests that call this
> method. I think the next step would be to find out what the queries look
> like. Can you see that from the test logs? If not, maybe you can make
> the method throw an exception so that the test stops once the method is
> called. If we know what the queries look like, we may find a way to
> tweak them so that they trigger the bug.
>
> --
> Knut Anders
>

Re: (DERBY-5010) [patch] bad equivalence check

Posted by Knut Anders Hatlen <kn...@oracle.com>.
Jayaram Subramanian <rs...@gmail.com> writes:

> Hi Knut,
> Sorry for the delay.. It was hectic for me for the past 2 months..
> When i placed thread.dumpstack and ran the lang.__suite, the log shows
> a lot of references to isEquivalent method..  Just attaching one of
> the example. Could you please guide me how to proceed from here

Hi Jayaram,

This sounds like good progress. Now you know which tests that call this
method. I think the next step would be to find out what the queries look
like. Can you see that from the test logs? If not, maybe you can make
the method throw an exception so that the test stops once the method is
called. If we know what the queries look like, we may find a way to
tweak them so that they trigger the bug.

-- 
Knut Anders

Re: (DERBY-5010) [patch] bad equivalence check

Posted by Jayaram Subramanian <rs...@gmail.com>.
Hi all,
In continuation of below email,  i tried to something like
System.out.println(sqlIn.toString());

in the scripttestcase.java's runtest method  expecting that sql
statements would be sent to logs... But i couldnt see any sql
statements in the logs..

with regards
Jayaram

On Sat, Apr 16, 2011 at 9:41 PM, Jayaram Subramanian
<rs...@gmail.com> wrote:
> Thanks all,
> When i see the logs i am seeing that the test which calls isequivalent method is
>
> org.apache.derbyTesting.functionTests.util.ScriptTestCase.runTest(ScriptTestCase.java:188)
>
> The line 188 in scripttestcase has
> org.apache.derby.tools.ij.runScript(
>                                conn,
>                                sqlIn,
>                                inputEncoding,
>                getOutputStream(),
>                                outputEnc,
>                useSystemProperties);
>
>
> i will try to direct the sqlin to the logs and try to find out the sql
> which gets executed
>
> With Regards
> Jayaram
>
>
> On Fri, Apr 15, 2011 at 10:19 AM, Kathey Marsden
> <km...@sbcglobal.net> wrote:
>> On 4/13/2011 8:20 PM, Jayaram Subramanian wrote:
>>>
>>> Hi Knut,
>>> Sorry for the delay.. It was hectic for me for the past 2 months..
>>> When i placed thread.dumpstack and ran the lang.__suite, the log shows
>>> a lot of references to isEquivalent method..  Just attaching one of
>>> the example. Could you please guide me how to proceed from here
>>>
>>> With Regards
>>> Jayaram
>>>
>>> java.lang.Throwable
>>>        at java.lang.Thread.dumpStack(Thread.java:417)
>>>        at
>>> org.apache.derby.impl.sql.compile.BaseColumnNode.isEquivalent(BaseColumnNode.java:180)
>>>        at
>>> org.apache.derby.impl.sql.compile.SubstituteExpressionVisitor.visit(SubstituteExpressionVisitor.java:62)
>>>        at
>>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:718)
>>>        at
>>> org.apache.derby.impl.sql.compile.ResultColumn.acceptChildren(ResultColumn.java:1550)
>>>        at
>>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>>        at
>>> org.apache.derby.impl.sql.compile.QueryTreeNodeVector.acceptChildren(QueryTreeNodeVector.java:141)
>>>        at
>>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>>        at
>>> org.apache.derby.impl.sql.compile.ResultSetNode.acceptChildren(ResultSetNode.java:1611)
>>>        at
>>> org.apache.derby.impl.sql.compile.FromBaseTable.acceptChildren(FromBaseTable.java:4621)
>>>        at
>>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>>        at
>>> org.apache.derby.impl.sql.compile.SingleChildResultSetNode.acceptChildren(SingleChildResultSetNode.java:611)
>>>        at
>>> org.apache.derby.impl.sql.compile.ProjectRestrictNode.acceptChildren(ProjectRestrictNode.java:1843)
>>>        at
>>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>>        at
>>> org.apache.derby.impl.sql.compile.SingleChildResultSetNode.acceptChildren(SingleChildResultSetNode.java:611)
>>>        at
>>> org.apache.derby.impl.sql.compile.ProjectRestrictNode.acceptChildren(ProjectRestrictNode.java:1843)
>>>        at
>>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>>        at
>>> org.apache.derby.impl.sql.compile.SingleChildResultSetNode.acceptChildren(SingleChildResultSetNode.java:611)
>>>        at
>>> org.apache.derby.impl.sql.compile.ProjectRestrictNode.acceptChildren(ProjectRestrictNode.java:1843)
>>>        at
>>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>>        at
>>> org.apache.derby.impl.sql.compile.SubqueryNode.acceptChildren(SubqueryNode.java:2300)
>>>        at
>>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>>        at
>>> org.apache.derby.impl.sql.compile.UnaryOperatorNode.acceptChildren(UnaryOperatorNode.java:759)
>>>        at
>>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>>        at
>>> org.apache.derby.impl.sql.compile.BinaryOperatorNode.acceptChildren(BinaryOperatorNode.java:855)
>>>        at
>>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>>        at
>>> org.apache.derby.impl.sql.compile.GroupByNode.addNewColumnsForAggregation(GroupByNode.java:566)
>>>        at
>>> org.apache.derby.impl.sql.compile.GroupByNode.addAggregates(GroupByNode.java:245)
>>>        at
>>> org.apache.derby.impl.sql.compile.GroupByNode.init(GroupByNode.java:184)
>>>        at
>>> org.apache.derby.iapi.sql.compile.NodeFactory.getNode(NodeFactory.java:273)
>>>        at
>>> org.apache.derby.impl.sql.compile.SelectNode.genProjectRestrict(SelectNode.java:1483)
>>>        at
>>> org.apache.derby.impl.sql.compile.SelectNode.modifyAccessPaths(SelectNode.java:2123)
>>>        at
>>> org.apache.derby.impl.sql.compile.SingleChildResultSetNode.modifyAccessPaths(SingleChildResultSetNode.java:439)
>>>        at
>>> org.apache.derby.impl.sql.compile.SubqueryNode.modifyAccessPaths(SubqueryNode.java:1873)
>>>        at
>>> org.apache.derby.impl.sql.compile.SubqueryList.modifyAccessPaths(SubqueryList.java:116)
>>>        at
>>> org.apache.derby.impl.sql.compile.SelectNode.modifyAccessPaths(SelectNode.java:2051)
>>>        at
>>> org.apache.derby.impl.sql.compile.SingleChildResultSetNode.modifyAccessPaths(SingleChildResultSetNode.java:439)
>>>        at
>>> org.apache.derby.impl.sql.compile.SubqueryNode.modifyAccessPaths(SubqueryNode.java:1873)
>>>        at
>>> org.apache.derby.impl.sql.compile.SubqueryList.modifyAccessPaths(SubqueryList.java:116)
>>>        at
>>> org.apache.derby.impl.sql.compile.SelectNode.modifyAccessPaths(SelectNode.java:2051)
>>>        at
>>> org.apache.derby.impl.sql.compile.DMLStatementNode.optimizeStatement(DMLStatementNode.java:317)
>>>        at
>>> org.apache.derby.impl.sql.compile.CursorNode.optimizeStatement(CursorNode.java:587)
>>>
>>>
>> Do any of the the full stack traces have a reference to the test compiling
>> the statement. I think they should for the embedded tests. e.g, you will see
>> something in the thread dump like:
>>
>> at org.apache.derbyTesting.functionTests.tests.lang.<Name of Test>.<fixture>
>> (Name of Test:  line number)
>> e.g.
>>    at
>> org.apache.derbyTesting.functionTests.tests.lang.NullsTest.testInsert(NullsTest.java:206)
>>
>> Then you can look at that test file and that line number and it will show us
>> which query is giving the problem.
>> If there are thread dumps like that then you don't need to throw the
>> exception as you mentioned in later to find the query that exercises this
>> code.
>>
>>
>> Thanks
>>
>> Kathey
>>
>>
>

Re: (DERBY-5010) [patch] bad equivalence check

Posted by Bryan Pendleton <bp...@gmail.com>.
On 04/18/2011 08:06 PM, Jayaram Subramanian wrote:
> java -Dderby.tests.trace=true junit.textui.TestRunner
> org.apache.derbyTesting.functionTests.tests.lang._Suite>
> runoutputApril17.out 2>&1
>
> I get
> .F
> Time: 0.004
> There was 1 failure:
> 1) warning(junit.framework.TestSuite$1)junit.framework.AssertionFailedError:
> No tests found in
> org.apache.derbyTesting.functionTests.util.ScriptTestCase
>
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
>
> Am i missing something here ?

I'm not sure. When I run that command, I get many pages of output, and many tests run.

So it sounds like you have either a build problem or
an environment problem (i.e., CLASSPATH not set up quite right?)

This was my command, followed by the first little bit of the output...

java -Dderby.tests.trace=true junit.textui.TestRunner org.apache.derbyTesting.functionTests.tests.lang._Suite
.
test1InsertAfterTrigger used 0 ms .
test1InsertAfterTriggerStoredProc used 0 ms .
test1DeleteAfterTrigger used 0 ms .
test1DeleteAfterTriggerStoredProc used 0 ms .
test1UpdateAfterTrigger used 0 ms .
test1UpdateAfterTriggerStoredProc used 0 ms .
test1InsertBeforeTrigger used 0 ms .
test1InsertBeforeTriggerStoredProc used 0 ms .

thanks,

bryan


Re: (DERBY-5010) [patch] bad equivalence check

Posted by Knut Anders Hatlen <kn...@oracle.com>.
Jayaram Subramanian <rs...@gmail.com> writes:

> Hi,
> When i tried doing something like
>
> java -Dderby.tests.trace=true junit.textui.TestRunner
> org.apache.derbyTesting.functionTests.tests.lang._Suite >
> runoutputApril17.out 2>&1
>
> I get
> .F
> Time: 0.004
> There was 1 failure:
> 1) warning(junit.framework.TestSuite$1)junit.framework.AssertionFailedError:
> No tests found in
> org.apache.derbyTesting.functionTests.util.ScriptTestCase
>
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
>
> Am i missing something here ?

Hi Jayaram,

I'm guessing you ran ScriptTestCase directly when you saw this failure,
and not lang._Suite? ScriptTestCase doesn't contain any tests itself, so
you need to run one of its sub-classes. For example:

java -Dderby.tests.trace=true junit.textui.TestRunner org.apache.derbyTesting.functionTests.tests.lang.LangScripts

-- 
Knut Anders

Re: (DERBY-5010) [patch] bad equivalence check

Posted by Jayaram Subramanian <rs...@gmail.com>.
Hi,
When i tried doing something like

java -Dderby.tests.trace=true junit.textui.TestRunner
org.apache.derbyTesting.functionTests.tests.lang._Suite >
runoutputApril17.out 2>&1

I get
.F
Time: 0.004
There was 1 failure:
1) warning(junit.framework.TestSuite$1)junit.framework.AssertionFailedError:
No tests found in
org.apache.derbyTesting.functionTests.util.ScriptTestCase

FAILURES!!!
Tests run: 1,  Failures: 1,  Errors: 0

Am i missing something here ?

With Regards
Jayaram


On Sun, Apr 17, 2011 at 12:47 PM, Knut Anders Hatlen
<kn...@oracle.com> wrote:
> Jayaram Subramanian <rs...@gmail.com> writes:
>
>> Thanks all,
>> When i see the logs i am seeing that the test which calls isequivalent method is
>>
>> org.apache.derbyTesting.functionTests.util.ScriptTestCase.runTest(ScriptTestCase.java:188)
>>
>> The line 188 in scripttestcase has
>> org.apache.derby.tools.ij.runScript(
>>                               conn,
>>                               sqlIn,
>>                               inputEncoding,
>>                 getOutputStream(),
>>                               outputEnc,
>>                 useSystemProperties);
>>
>>
>> i will try to direct the sqlin to the logs and try to find out the sql
>> which gets executed
>
> I think running with -Dderby.tests.trace=true should make ScriptTestCase
> print the name of the script it's running. Then perhaps you could run
> that script manually in ij and see which statement it executed right
> before the stack was printed.
>
> --
> Knut Anders
>

Re: (DERBY-5010) [patch] bad equivalence check

Posted by Knut Anders Hatlen <kn...@oracle.com>.
Jayaram Subramanian <rs...@gmail.com> writes:

> Thanks all,
> When i see the logs i am seeing that the test which calls isequivalent method is
>
> org.apache.derbyTesting.functionTests.util.ScriptTestCase.runTest(ScriptTestCase.java:188)
>
> The line 188 in scripttestcase has
> org.apache.derby.tools.ij.runScript(
> 				conn,
> 				sqlIn,
> 				inputEncoding,
>                 getOutputStream(),
> 				outputEnc,
>                 useSystemProperties);
>
>
> i will try to direct the sqlin to the logs and try to find out the sql
> which gets executed

I think running with -Dderby.tests.trace=true should make ScriptTestCase
print the name of the script it's running. Then perhaps you could run
that script manually in ij and see which statement it executed right
before the stack was printed.

-- 
Knut Anders

Re: (DERBY-5010) [patch] bad equivalence check

Posted by Jayaram Subramanian <rs...@gmail.com>.
Thanks all,
When i see the logs i am seeing that the test which calls isequivalent method is

org.apache.derbyTesting.functionTests.util.ScriptTestCase.runTest(ScriptTestCase.java:188)

The line 188 in scripttestcase has
org.apache.derby.tools.ij.runScript(
				conn,
				sqlIn,
				inputEncoding,
                getOutputStream(),
				outputEnc,
                useSystemProperties);


i will try to direct the sqlin to the logs and try to find out the sql
which gets executed

With Regards
Jayaram


On Fri, Apr 15, 2011 at 10:19 AM, Kathey Marsden
<km...@sbcglobal.net> wrote:
> On 4/13/2011 8:20 PM, Jayaram Subramanian wrote:
>>
>> Hi Knut,
>> Sorry for the delay.. It was hectic for me for the past 2 months..
>> When i placed thread.dumpstack and ran the lang.__suite, the log shows
>> a lot of references to isEquivalent method..  Just attaching one of
>> the example. Could you please guide me how to proceed from here
>>
>> With Regards
>> Jayaram
>>
>> java.lang.Throwable
>>        at java.lang.Thread.dumpStack(Thread.java:417)
>>        at
>> org.apache.derby.impl.sql.compile.BaseColumnNode.isEquivalent(BaseColumnNode.java:180)
>>        at
>> org.apache.derby.impl.sql.compile.SubstituteExpressionVisitor.visit(SubstituteExpressionVisitor.java:62)
>>        at
>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:718)
>>        at
>> org.apache.derby.impl.sql.compile.ResultColumn.acceptChildren(ResultColumn.java:1550)
>>        at
>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>        at
>> org.apache.derby.impl.sql.compile.QueryTreeNodeVector.acceptChildren(QueryTreeNodeVector.java:141)
>>        at
>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>        at
>> org.apache.derby.impl.sql.compile.ResultSetNode.acceptChildren(ResultSetNode.java:1611)
>>        at
>> org.apache.derby.impl.sql.compile.FromBaseTable.acceptChildren(FromBaseTable.java:4621)
>>        at
>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>        at
>> org.apache.derby.impl.sql.compile.SingleChildResultSetNode.acceptChildren(SingleChildResultSetNode.java:611)
>>        at
>> org.apache.derby.impl.sql.compile.ProjectRestrictNode.acceptChildren(ProjectRestrictNode.java:1843)
>>        at
>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>        at
>> org.apache.derby.impl.sql.compile.SingleChildResultSetNode.acceptChildren(SingleChildResultSetNode.java:611)
>>        at
>> org.apache.derby.impl.sql.compile.ProjectRestrictNode.acceptChildren(ProjectRestrictNode.java:1843)
>>        at
>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>        at
>> org.apache.derby.impl.sql.compile.SingleChildResultSetNode.acceptChildren(SingleChildResultSetNode.java:611)
>>        at
>> org.apache.derby.impl.sql.compile.ProjectRestrictNode.acceptChildren(ProjectRestrictNode.java:1843)
>>        at
>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>        at
>> org.apache.derby.impl.sql.compile.SubqueryNode.acceptChildren(SubqueryNode.java:2300)
>>        at
>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>        at
>> org.apache.derby.impl.sql.compile.UnaryOperatorNode.acceptChildren(UnaryOperatorNode.java:759)
>>        at
>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>        at
>> org.apache.derby.impl.sql.compile.BinaryOperatorNode.acceptChildren(BinaryOperatorNode.java:855)
>>        at
>> org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
>>        at
>> org.apache.derby.impl.sql.compile.GroupByNode.addNewColumnsForAggregation(GroupByNode.java:566)
>>        at
>> org.apache.derby.impl.sql.compile.GroupByNode.addAggregates(GroupByNode.java:245)
>>        at
>> org.apache.derby.impl.sql.compile.GroupByNode.init(GroupByNode.java:184)
>>        at
>> org.apache.derby.iapi.sql.compile.NodeFactory.getNode(NodeFactory.java:273)
>>        at
>> org.apache.derby.impl.sql.compile.SelectNode.genProjectRestrict(SelectNode.java:1483)
>>        at
>> org.apache.derby.impl.sql.compile.SelectNode.modifyAccessPaths(SelectNode.java:2123)
>>        at
>> org.apache.derby.impl.sql.compile.SingleChildResultSetNode.modifyAccessPaths(SingleChildResultSetNode.java:439)
>>        at
>> org.apache.derby.impl.sql.compile.SubqueryNode.modifyAccessPaths(SubqueryNode.java:1873)
>>        at
>> org.apache.derby.impl.sql.compile.SubqueryList.modifyAccessPaths(SubqueryList.java:116)
>>        at
>> org.apache.derby.impl.sql.compile.SelectNode.modifyAccessPaths(SelectNode.java:2051)
>>        at
>> org.apache.derby.impl.sql.compile.SingleChildResultSetNode.modifyAccessPaths(SingleChildResultSetNode.java:439)
>>        at
>> org.apache.derby.impl.sql.compile.SubqueryNode.modifyAccessPaths(SubqueryNode.java:1873)
>>        at
>> org.apache.derby.impl.sql.compile.SubqueryList.modifyAccessPaths(SubqueryList.java:116)
>>        at
>> org.apache.derby.impl.sql.compile.SelectNode.modifyAccessPaths(SelectNode.java:2051)
>>        at
>> org.apache.derby.impl.sql.compile.DMLStatementNode.optimizeStatement(DMLStatementNode.java:317)
>>        at
>> org.apache.derby.impl.sql.compile.CursorNode.optimizeStatement(CursorNode.java:587)
>>
>>
> Do any of the the full stack traces have a reference to the test compiling
> the statement. I think they should for the embedded tests. e.g, you will see
> something in the thread dump like:
>
> at org.apache.derbyTesting.functionTests.tests.lang.<Name of Test>.<fixture>
> (Name of Test:  line number)
> e.g.
>    at
> org.apache.derbyTesting.functionTests.tests.lang.NullsTest.testInsert(NullsTest.java:206)
>
> Then you can look at that test file and that line number and it will show us
> which query is giving the problem.
> If there are thread dumps like that then you don't need to throw the
> exception as you mentioned in later to find the query that exercises this
> code.
>
>
> Thanks
>
> Kathey
>
>

Re: (DERBY-5010) [patch] bad equivalence check

Posted by Kathey Marsden <km...@sbcglobal.net>.
On 4/13/2011 8:20 PM, Jayaram Subramanian wrote:
> Hi Knut,
> Sorry for the delay.. It was hectic for me for the past 2 months..
> When i placed thread.dumpstack and ran the lang.__suite, the log shows
> a lot of references to isEquivalent method..  Just attaching one of
> the example. Could you please guide me how to proceed from here
>
> With Regards
> Jayaram
>
> java.lang.Throwable
> 	at java.lang.Thread.dumpStack(Thread.java:417)
> 	at org.apache.derby.impl.sql.compile.BaseColumnNode.isEquivalent(BaseColumnNode.java:180)
> 	at org.apache.derby.impl.sql.compile.SubstituteExpressionVisitor.visit(SubstituteExpressionVisitor.java:62)
> 	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:718)
> 	at org.apache.derby.impl.sql.compile.ResultColumn.acceptChildren(ResultColumn.java:1550)
> 	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
> 	at org.apache.derby.impl.sql.compile.QueryTreeNodeVector.acceptChildren(QueryTreeNodeVector.java:141)
> 	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
> 	at org.apache.derby.impl.sql.compile.ResultSetNode.acceptChildren(ResultSetNode.java:1611)
> 	at org.apache.derby.impl.sql.compile.FromBaseTable.acceptChildren(FromBaseTable.java:4621)
> 	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
> 	at org.apache.derby.impl.sql.compile.SingleChildResultSetNode.acceptChildren(SingleChildResultSetNode.java:611)
> 	at org.apache.derby.impl.sql.compile.ProjectRestrictNode.acceptChildren(ProjectRestrictNode.java:1843)
> 	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
> 	at org.apache.derby.impl.sql.compile.SingleChildResultSetNode.acceptChildren(SingleChildResultSetNode.java:611)
> 	at org.apache.derby.impl.sql.compile.ProjectRestrictNode.acceptChildren(ProjectRestrictNode.java:1843)
> 	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
> 	at org.apache.derby.impl.sql.compile.SingleChildResultSetNode.acceptChildren(SingleChildResultSetNode.java:611)
> 	at org.apache.derby.impl.sql.compile.ProjectRestrictNode.acceptChildren(ProjectRestrictNode.java:1843)
> 	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
> 	at org.apache.derby.impl.sql.compile.SubqueryNode.acceptChildren(SubqueryNode.java:2300)
> 	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
> 	at org.apache.derby.impl.sql.compile.UnaryOperatorNode.acceptChildren(UnaryOperatorNode.java:759)
> 	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
> 	at org.apache.derby.impl.sql.compile.BinaryOperatorNode.acceptChildren(BinaryOperatorNode.java:855)
> 	at org.apache.derby.impl.sql.compile.QueryTreeNode.accept(QueryTreeNode.java:721)
> 	at org.apache.derby.impl.sql.compile.GroupByNode.addNewColumnsForAggregation(GroupByNode.java:566)
> 	at org.apache.derby.impl.sql.compile.GroupByNode.addAggregates(GroupByNode.java:245)
> 	at org.apache.derby.impl.sql.compile.GroupByNode.init(GroupByNode.java:184)
> 	at org.apache.derby.iapi.sql.compile.NodeFactory.getNode(NodeFactory.java:273)
> 	at org.apache.derby.impl.sql.compile.SelectNode.genProjectRestrict(SelectNode.java:1483)
> 	at org.apache.derby.impl.sql.compile.SelectNode.modifyAccessPaths(SelectNode.java:2123)
> 	at org.apache.derby.impl.sql.compile.SingleChildResultSetNode.modifyAccessPaths(SingleChildResultSetNode.java:439)
> 	at org.apache.derby.impl.sql.compile.SubqueryNode.modifyAccessPaths(SubqueryNode.java:1873)
> 	at org.apache.derby.impl.sql.compile.SubqueryList.modifyAccessPaths(SubqueryList.java:116)
> 	at org.apache.derby.impl.sql.compile.SelectNode.modifyAccessPaths(SelectNode.java:2051)
> 	at org.apache.derby.impl.sql.compile.SingleChildResultSetNode.modifyAccessPaths(SingleChildResultSetNode.java:439)
> 	at org.apache.derby.impl.sql.compile.SubqueryNode.modifyAccessPaths(SubqueryNode.java:1873)
> 	at org.apache.derby.impl.sql.compile.SubqueryList.modifyAccessPaths(SubqueryList.java:116)
> 	at org.apache.derby.impl.sql.compile.SelectNode.modifyAccessPaths(SelectNode.java:2051)
> 	at org.apache.derby.impl.sql.compile.DMLStatementNode.optimizeStatement(DMLStatementNode.java:317)
> 	at org.apache.derby.impl.sql.compile.CursorNode.optimizeStatement(CursorNode.java:587)
>
>
Do any of the the full stack traces have a reference to the test 
compiling the statement. I think they should for the embedded tests. 
e.g, you will see something in the thread dump like:

at org.apache.derbyTesting.functionTests.tests.lang.<Name of 
Test>.<fixture> (Name of Test:  line number)
e.g.
     at 
org.apache.derbyTesting.functionTests.tests.lang.NullsTest.testInsert(NullsTest.java:206)

Then you can look at that test file and that line number and it will 
show us which query is giving the problem.
If there are thread dumps like that then you don't need to throw the 
exception as you mentioned in later to find the query that exercises 
this code.


Thanks

Kathey