Issue Details (XML | Word | Printable)

Key: OPENJPA-50
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: George Hongell
Votes: 0
Watchers: 0
Operations

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

bad sql pushdown, cast changes datatype

Created: 19/Sep/06 01:08 AM   Updated: 01/Mar/07 02:20 AM
Return to search
Component/s: query
Affects Version/s: None
Fix Version/s: 0.9.7

Time Tracking:
Not Specified

File Attachments:
  Size
Java Archive File failureEntities.jar 2006-09-19 11:50 PM George Hongell 7 kB
Environment: Windows xp, db2, derby

Resolution Date: 01/Mar/07 02:20 AM


 Description  « Hide
444 - bad sql pushdown, cast changes datatype
 TEST444; select e from EmpBean e where e.salary > 5 and abs(e.salary) > 12
28203 TRACE [main] openjpa.jdbc.SQL - <t 1094861122, conn 295440796> [0 ms] executing prepstmnt 1712481810 SELECT t0.empid, t0.bonus, t1.deptno, t1.budget, t1.name, t0.execLevel, t0.hireDate, t0.hireTime, t0.hireTimestamp, t2.street, t2.city, t2.state, t2.zip, t0.isManager, t0.name, t0.salary, t3.street, t3.city, t3.state, t3.zip FROM EmpBean t0 LEFT OUTER JOIN DeptBean t1 ON t0.dept_deptno = t1.deptno LEFT OUTER JOIN AddressBean t2 ON t0.home_street = t2.street LEFT OUTER JOIN AddressBean t3 ON t0.work_street = t3.street WHERE (CAST(t0.salary AS DOUBLE) > CAST(? AS DOUBLE) AND CAST(ABS(t0.salary) AS BIGINT) > CAST(? AS BIGINT)) [params=(long) 5, (long) 12]
select t0.empid, t0.salary FROM EmpBean t0 LEFT OUTER JOIN DeptBean t1 ON t0.dept_deptno = t1.deptno WHERE (CAST(t0.salary AS DOUBLE) > ?) AND (CAST(ABS(t0.salary) AS BIGINT) > ?) {long 5, long 12}

why CAST(ABS(t0.salary) AS BIGINT)?????????
select t0.empid, t0.salary FROM EmpBean t0 WHERE (CAST(t0.salary AS DOUBLE) > ?) AND (CAST(ABS(t0.salary) AS BIGINT) > ?) {long 5, long 12}
s/b
select t0.empid, t0.salary FROM EmpBean t0 LEFT OUTER JOIN DeptBean t1 ON t0.dept_deptno = t1.deptno WHERE (CAST(t0.salary AS DOUBLE) > ?) AND (CAST(ABS(t0.salary) AS DOUBLE) > ?) {long 5, long 12}

  [ FAILED 444- bucket = fvtfull, query = select e from EmpBean e where e.salary > 5 and abs(e.salary) > 12 :
   EXPECTED(
 TEST444; select e from EmpBean e where e.salary > 5 and abs(e.salary) > 12
EmpBean
~~~~~~~
  [1]
  [2]
  [3]
 TEST444; 3 tuples)
   ACTUAL(
 TEST444; select e from EmpBean e where e.salary > 5 and abs(e.salary) > 12
EmpBean
~~~~~~~
  [2]
  [3]
 TEST444; 2 tuples) ]




 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
No work has yet been logged on this issue.