Issue Details (XML | Word | Printable)

Key: JDO-310
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Erik Bengtson
Reporter: Michael Bouschen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JDO

JPOX fails test VariableInResult.testDistinctNoNavigation with JDODataStoreException from Derby

Created: 18/Feb/06 04:39 AM   Updated: 21/Mar/06 07:57 AM
Return to search
Component/s: tck2
Affects Version/s: None
Fix Version/s: JDO 2 final

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works variables.patch 2006-03-19 08:39 AM Craig Russell 2 kB

Resolution Date: 21/Mar/06 07:57 AM


 Description  « Hide
Test methods testDistinctNoNavigation and testNoNavigation of org.apache.jdo.tck.query.result.VariableInResult fail throwing a JDODataStoreException. The error messages says: "ERROR 42972: An ON clause associated with a JOIN operator is not valid.".

Here is the stacktace for method testDistinctNoNavigation, the other stacktrace is the same:
1) testDistinctNoNavigation(org.apache.jdo.tck.query.result.VariableInResult)javax.jdo.JDODataStoreException: Error executing JDOQL query "SELECT DISTINCT UNBOUND_P.PROJID FROM applicationidentity0.PERSONS THIS,applicationidentity0.PROJECTS UNBOUND_P WHERE EXISTS (SELECT 1 FROM applicationidentity0.PROJECT_MEMBER THIS_PROJECTS_P LEFT OUTER JOIN applicationidentity0.PROJECTS UNBOUND_P_NAME ON UNBOUND_P.PROJID = UNBOUND_P_NAME.PROJID WHERE THIS_PROJECTS_P."MEMBER" = THIS.PERSONID AND THIS_PROJECTS_P."MEMBER" = THIS.PERSONID AND UNBOUND_P.PROJID = THIS_PROJECTS_P.PROJID AND UNBOUND_P_NAME."NAME" = ? AND (THIS.DISCRIMINATOR = ? OR THIS.DISCRIMINATOR = ? OR THIS.DISCRIMINATOR = ?))" : An ON clause associated with a JOIN operator is not valid.
ERROR 42972: An ON clause associated with a JOIN operator is not valid.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.impl.sql.compile.JoinNode.deferredBindExpressions(Unknown Source)
at org.apache.derby.impl.sql.compile.JoinNode.bindResultColumns(Unknown Source)
at org.apache.derby.impl.sql.compile.FromList.bindResultColumns(Unknown Source)
at org.apache.derby.impl.sql.compile.SelectNode.bindResultColumns(Unknown Source)
at org.apache.derby.impl.sql.compile.SubqueryNode.bindExpression(Unknown Source)
at org.apache.derby.impl.sql.compile.SelectNode.bindExpressions(Unknown Source)
at org.apache.derby.impl.sql.compile.DMLStatementNode.bindExpressions(Unknown Source)
at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source)
at org.apache.derby.impl.sql.compile.ReadCursorNode.bind(Unknown Source)
at org.apache.derby.impl.sql.compile.CursorNode.bind(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
at com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:241)
at org.jpox.store.rdbms.RDBMSManager.getStatement(RDBMSManager.java:355)
at org.jpox.store.StatementText.prepareStatement(StatementText.java:204)
at org.jpox.store.query.Query.getStatement(Query.java:797)
at org.jpox.store.query.JDOQLQuery.performExecute(JDOQLQuery.java:516)
at org.jpox.store.query.Query.executeWithMap(Query.java:1113)
at org.jpox.store.query.Query.executeWithArray(Query.java:1086)
at org.jpox.store.query.Query.execute(Query.java:1009)
at org.apache.jdo.tck.query.QueryTest.execute(QueryTest.java:1192)
at org.apache.jdo.tck.query.QueryTest.execute(QueryTest.java:1070)
at org.apache.jdo.tck.query.QueryTest.executeAPIQuery(QueryTest.java:1007)
at org.apache.jdo.tck.query.QueryTest.executeAPIQuery(QueryTest.java:987)
at org.apache.jdo.tck.query.result.VariableInResult.testDistinctNoNavigation(VariableInResult.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:204)
at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:120)
at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:95)
.
at org.jpox.store.query.JDOQLQuery.performExecute(JDOQLQuery.java:570)
at org.jpox.store.query.Query.executeWithMap(Query.java:1113)
at org.jpox.store.query.Query.executeWithArray(Query.java:1086)
at org.jpox.store.query.Query.execute(Query.java:1009)
at org.apache.jdo.tck.query.QueryTest.execute(QueryTest.java:1192)
at org.apache.jdo.tck.query.QueryTest.execute(QueryTest.java:1070)
at org.apache.jdo.tck.query.QueryTest.executeAPIQuery(QueryTest.java:1007)
at org.apache.jdo.tck.query.QueryTest.executeAPIQuery(QueryTest.java:987)
at org.apache.jdo.tck.query.result.VariableInResult.testDistinctNoNavigation(VariableInResult.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:204)
at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:120)
at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:95)

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Erik Bengtson added a comment - 18/Feb/06 04:45 AM
JPOX generates a valid SQL. At least I tested in MSSQL and DB2 and it worked, so a problem in Derby. I raised in derby users list but does not seem they will fix it soon. I will work in JPOX to generate a different SQL supported by Derby

Michelle Caisse added a comment - 18/Feb/06 05:30 AM
The Derby JIRA issue is DERBY-39.

Erik Bengtson added a comment - 15/Mar/06 08:46 AM
should be fixed in JPOX CVS

Craig Russell added a comment - 19/Mar/06 08:39 AM
Please review this patch.

I propose to change the queries as in the attached patch. Instead of projecting projects from Employee, it projects employees from Department.

The test fails but not because of a Derby issue.


Michael Bouschen added a comment - 20/Mar/06 02:41 AM
The patch looks good. What is the failure when uinsg the patch?

Craig Russell added a comment - 20/Mar/06 07:04 AM
Runnning with this patch, the tests fail but not because of Derby. It appears that JPOX is not constructing the right SQL for this query.

    [echo] Starting configuration="clr.conf" with database="derby" identitytype="datastoreidentity" mapping="".
    [java] RUN VariableInResult.testDistinctNoNavigation FAILURE
    [java] RUN VariableInResult.testNoNavigation FAILURE
    [java] RUN VariableInResult.testDistinctNavigation
    [java] RUN VariableInResult.testNavigation
    [java] Description: Special Test
    [java] Time: 026
    [java] There were 2 failures:
    [java] 1) testDistinctNoNavigation(org.apache.jdo.tck.query.result.VariableInResult)junit.framework.AssertionFailedError: Assertion A14.6.9-3 (VariableInResult) failed:
    [java] Wrong query result:
    [java] query: SELECT distinct e FROM org.apache.jdo.tck.pc.company.Department WHERE deptid==2 & employees.contains(e) VARIABLES Employee e
    [java] expected: [PartTimeEmployee(4, emp4Last, emp4First, born 5/Sep/1973, phone {work=124456-3, home=3343}, hired 14/Apr/2001, weeklyhours 0.0, $13.0), FullTimeEmployee(5, emp5Last, emp5First, born 4/Jul/1962, phone {work=126456-3, home=3363}, hired 14/Aug/1998, weeklyhours 0.0, $45000.0)]
    [java] got: [FullTimeEmployee(1, emp1Last, emp1First, born 9/Jun/1970, phone {work=123456-1,home=1111}, hired 31/Dec/1998, weeklyhours 40.0, $20000.0), FullTimeEmployee(5, emp5Last, emp5First, born 4/Jul/1962, phone {work=126456-3,home=3363}, hired 14/Aug/1998, weeklyhours 0.0, $45000.0), PartTimeEmployee(3, emp3Last, emp3First, born 4/Sep/1972, phone {work=123456-3,home=3333}, hired 14/Aug/2002, weeklyhours 19.0, $15.0), FullTimeEmployee(2, emp2Last, emp2First, born 21/Dec/1975, phone {work=123456-2,home=2222}, hired 30/Jun/2003, weeklyhours 40.0, $10000.0), PartTimeEmployee(4, emp4Last, emp4First, born 5/Sep/1973, phone {work=124456-3,home=3343}, hired 14/Apr/2001, weeklyhours 0.0, $13.0)]
    [java] at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java:583)
    [java] at org.apache.jdo.tck.query.QueryTest.queryFailed(QueryTest.java:508)
    [java] at org.apache.jdo.tck.query.QueryTest.checkQueryResultWithoutOrder(QueryTest.java:536)
    [java] at org.apache.jdo.tck.query.QueryTest.execute(QueryTest.java:1230)
    [java] at org.apache.jdo.tck.query.QueryTest.execute(QueryTest.java:1070)
    [java] at org.apache.jdo.tck.query.QueryTest.executeAPIQuery(QueryTest.java:1007)
    [java] at org.apache.jdo.tck.query.QueryTest.executeAPIQuery(QueryTest.java:987)
    [java] at org.apache.jdo.tck.query.result.VariableInResult.testDistinctNoNavigation(VariableInResult.java:141)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [java] at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:232)
    [java] at org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:105)
    [java] at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:143)
    [java] at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:118)
    [java] 2) testNoNavigation(org.apache.jdo.tck.query.result.VariableInResult)junit.framework.AssertionFailedError: Assertion A14.6.9-3 (VariableInResult) failed:
    [java] Wrong query result:
    [java] query: SELECT e FROM org.apache.jdo.tck.pc.company.Department WHERE deptid==2 & employees.contains(e) VARIABLES Employee e
    [java] expected: [PartTimeEmployee(4, emp4Last, emp4First, born 5/Sep/1973, phone {work=124456-3, home=3343}, hired 14/Apr/2001, weeklyhours 0.0, $13.0), FullTimeEmployee(5, emp5Last, emp5First, born 4/Jul/1962, phone {work=126456-3, home=3363}, hired 14/Aug/1998, weeklyhours 0.0, $45000.0)]
    [java] got: [FullTimeEmployee(1, emp1Last, emp1First, born 9/Jun/1970, phone {work=123456-1,home=1111}, hired 31/Dec/1998, weeklyhours 40.0, $20000.0), FullTimeEmployee(5, emp5Last, emp5First, born 4/Jul/1962, phone {work=126456-3,home=3363}, hired 14/Aug/1998, weeklyhours 0.0, $45000.0), PartTimeEmployee(3, emp3Last, emp3First, born 4/Sep/1972, phone {work=123456-3,home=3333}, hired 14/Aug/2002, weeklyhours 19.0, $15.0), FullTimeEmployee(2, emp2Last, emp2First, born 21/Dec/1975, phone {work=123456-2,home=2222}, hired 30/Jun/2003, weeklyhours 40.0, $10000.0), PartTimeEmployee(4, emp4Last, emp4First, born 5/Sep/1973, phone {work=124456-3,home=3343}, hired 14/Apr/2001, weeklyhours 0.0, $13.0)]
    [java] at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java:583)
    [java] at org.apache.jdo.tck.query.QueryTest.queryFailed(QueryTest.java:508)
    [java] at org.apache.jdo.tck.query.QueryTest.checkQueryResultWithoutOrder(QueryTest.java:536)
    [java] at org.apache.jdo.tck.query.QueryTest.execute(QueryTest.java:1230)
    [java] at org.apache.jdo.tck.query.QueryTest.execute(QueryTest.java:1070)
    [java] at org.apache.jdo.tck.query.QueryTest.executeAPIQuery(QueryTest.java:1007)
    [java] at org.apache.jdo.tck.query.QueryTest.executeAPIQuery(QueryTest.java:987)
    [java] at org.apache.jdo.tck.query.result.VariableInResult.testNoNavigation(VariableInResult.java:150)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [java] at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:232)
    [java] at org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:105)
    [java] at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:143)
    [java] at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:118)
    [java] FAILURES!!!
    [java] derby-dsid-clr-junit.txt:
    [java] ** Tests run: 004, Time: 026 seconds. Failures: 2, Errors: 0
    [java] Excluded tests: [org.apache.jdo.tck.enhancement.FieldAccessModified, org.apache.jdo.tck.enhancement.ImplementsPersistenceCapable]
    [java] [ERROR] Java Result: 1
    [echo] Finished configuration="clr.conf" with database="derby" identitytype="datastoreidentity" mapping="".

Craig Russell added a comment - 20/Mar/06 12:21 PM
From the JPOX log, the query:

SELECT distinct e FROM org.apache.jdo.tck.pc.company.Department WHERE deptid==2 & employees.contains(e) VARIABLES Employee e

generates this SQL:

SELECT DISTINCT UNBOUND_E.DATASTORE_IDENTITY FROM datastoreidentity0.DEPARTMENTS THIS,datastoreidentity0.PERSONS UNBOUND_E WHERE EXISTS (SELECT 1 FROM datastoreidentity0.PERSONS THIS_EMPLOYEES_E WHERE THIS_EMPLOYEES_E.DEPARTMENT = THIS.DATASTORE_IDENTITY AND THIS_EMPLOYEES_E.DEPARTMENT = THIS.DATASTORE_IDENTITY AND THIS.ID = <2>

[The subselect doesn't use the same variables so it's not a correlated query.The UNBOUND_E doesn't correlate with THIS_EMPLOYEES_E in the subquery]

followed by two queries loading the state each of the instances found

SELECT THIS.BIRTHDATE,THIS.FIRSTNAME,THIS.LASTNAME,THIS.PERSONID,THIS.HIREDATE,THIS.WEEKLYHOURS,THIS.WAGE FROM datastoreidentity0.PERSONS THIS WHERE (THIS.DATASTORE_IDENTITY=<15235>
SELECT "TYPE",PHONENO FROM datastoreidentity0.EMPLOYEE_PHONENO_TYPE WHERE EMPID = <15235> AND "TYPE" IS NOT NULL -- 1 PS parameters

Craig Russell added a comment - 21/Mar/06 07:57 AM
This change works around the Derby bug.

svn commit src/java/org/apache/jdo/tck/query/result/VariableInResult.java
Sending src/java/org/apache/jdo/tck/query/result/VariableInResult.java
Transmitting file data .
Committed revision 387351.