Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-50

bad sql pushdown, cast changes datatype

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.9.7
    • query
    • None
    • Windows xp, db2, derby

    Description

      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) ]

      Attachments

        1. failureEntities.jar
          7 kB
          George Hongell

        Activity

          People

            Unassigned Unassigned
            ghongell George Hongell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: