Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-6027

ORDER BY a cast expression gives NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 10.2.1.6, 10.2.2.0, 10.3.1.4, 10.3.2.1, 10.3.3.0, 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0, 10.6.1.0, 10.6.2.1, 10.7.1.1, 10.8.1.2, 10.8.2.2, 10.9.1.0
    • 10.10.1.1
    • SQL
    • Wrong query result

    Description

      The following gives a NPE:

      ij> values 1,2 order by int(1);

      or

      ij> select * from sysibm.sysdummy1 order by int(1);

      The NPE happens when pulling up the order by expression seemingly due to a compiler phase problem:

      Caused by: java.lang.NullPointerException
      at org.apache.derby.impl.sql.compile.CastNode.getConstantValueAsObject(CastNode.java:851)
      at org.apache.derby.impl.sql.compile.OrderByColumn.isReferedColByNum(OrderByColumn.java:466)
      at org.apache.derby.impl.sql.compile.OrderByColumn.pullUpOrderByColumn(OrderByColumn.java:403)
      at org.apache.derby.impl.sql.compile.OrderByList.pullUpOrderByColumns(OrderByList.java:195)
      at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(CursorNode.java:254)

      The variable sourceCTI is (still) null; being set by CastNode# bindCastNodeOnly, which presumably hasn't yet been run.

      Attachments

        1. derby-6027b.stat
          0.2 kB
          Dag H. Wanvik
        2. derby-6027b.diff
          3 kB
          Dag H. Wanvik
        3. derby-6027.stat
          0.2 kB
          Dag H. Wanvik
        4. derby-6027.diff
          3 kB
          Dag H. Wanvik

        Issue Links

          Activity

            People

              dagw Dag H. Wanvik
              dagw Dag H. Wanvik
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: