Issue Details (XML | Word | Printable)

Key: NUCCORE-490
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Andy Jefferson
Votes: 0
Watchers: 0
Operations

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

In-memory evaluation of queries : doesn't handle correlated subqueries

Created: 16/Mar/10 05:23 PM   Updated: 01/Dec/10 07:56 PM
Component/s: Queries
Affects Version/s: 2.0.0.release, 2.0.1, 2.0.2
Fix Version/s: None


 Description  « Hide
See JDO2 TCK tests

CorrelatedSubqueries.testPositive
CorrelatedSubqueriesWithParameters.testPositive

query: SELECT FROM org.apache.jdo.tck.pc.company.Employee WHERE this.weeklyhours > (SELECT AVG(e.weeklyhours) FROM this.department.employees e)
    [java] expected: java.util.ArrayList of size 6
    [java] [FullTimeEmployee(1, emp1Last, emp1First, born 10/Jun/1970, phone {}, hired 1/Jan/1999, weeklyhours 40.0, $30000.0), FullTimeEmployee(2, emp2Last, emp2First, born 22/Dec/1975, phone {}, hired 1/Jul/2003, weeklyhours 40.0, $20000.0), FullTimeEmployee(4, emp4Last, emp4First, born 6/Sep/1973, phone {}, hired 15/Apr/2001, weeklyhours 40.0, $25000.0), FullTimeEmployee(6, emp6Last, emp6First, born 10/Jun/1969, phone {}, hired 1/Jun/2002, weeklyhours 40.0, $22000.0), FullTimeEmployee(7, emp7Last, emp7First, born 10/Jun/1970, phone {}, hired 1/Jan/2000, weeklyhours 40.0, $40000.0), FullTimeEmployee(10, emp10Last, emp10First, born 5/Sep/1972, phone {}, hired 1/Oct/2002, weeklyhours 40.0, $24000.0)]
    [java] got: java.util.ArrayList of size 7
    [java] [FullTimeEmployee(1, emp1Last, emp1First, born 10/Jun/1970, phone {}, hired 1/Jan/1999, weeklyhours 40.0, $30000.0), FullTimeEmployee(2, emp2Last, emp2First, born 22/Dec/1975, phone {}, hired 1/Jul/2003, weeklyhours 40.0, $20000.0), FullTimeEmployee(7, emp7Last, emp7First, born 10/Jun/1970, phone {}, hired 1/Jan/2000, weeklyhours 40.0, $40000.0), FullTimeEmployee(10, emp10Last, emp10First, born 5/Sep/1972, phone {}, hired 1/Oct/2002, weeklyhours 40.0, $24000.0), FullTimeEmployee(4, emp4Last, emp4First, born 6/Sep/1973, phone {}, hired 15/Apr/2001, weeklyhours 40.0, $25000.0), PartTimeEmployee(5, emp5Last, emp5First, born 5/Jul/1962, phone {}, hired 1/Nov/2002, weeklyhours 35.0, $18000.0), FullTimeEmployee(6, emp6Last, emp6First, born 10/Jun/1969, phone {}, hired 1/Jun/2002, weeklyhours 40.0, $22000.0)]
    [java] at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java:682)
    [java] at org.apache.jdo.tck.query.QueryTest.queryFailed(QueryTest.java:518)
    [java] at org.apache.jdo.tck.query.QueryTest.checkQueryResultWithoutOrder(QueryTest.java:548)
    [java] at org.apache.jdo.tck.query.QueryTest.execute(QueryTest.java:1293)
    [java] at org.apache.jdo.tck.query.QueryTest.executeJDOQuery(QueryTest.java:1161)
    [java] at org.apache.jdo.tck.query.jdoql.subqueries.CorrelatedSubqueries.testPositive(CorrelatedSubqueries.java:83)

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 11/May/10 10:27 AM
A problem is that the candidates of the subquery will need retrieval and input before evaluation.
* If the candidates of the subquery are of a different class to the candidate of the outer query then we need to retrieve them first.
* If the candidates of the subquery relate to the outer query then this isn't necessary and we can nest the subquery evaluation in the outer query evaluation.