Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-13339

Sql query fails with NullPointerException caused by calling CAST in order by clause

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.8.1
    • None
    • sql
    • None
    • Docs Required, Release Notes Required

    Description

      Sql statements to reproduce:

      CREATE TABLE Person(ID INTEGER PRIMARY KEY, NAME VARCHAR(100));
      INSERT INTO Person(ID, NAME) VALUES (1, 'Ed'), (2, 'Ann'), (3, 'Emma');
      select name,id from Person order by CAST(id as long)

      Result:

      javax.cache.CacheException: class org.apache.ignite.IgniteCheckedException: null
      	at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2572)
      	at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2505)
      	at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2463)
      	at org.apache.ignite.internal.visor.query.VisorQueryUtils.lambda$scheduleQueryStart$0(VisorQueryUtils.java:409)
      	at org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:7157)
      	at org.apache.ignite.internal.processors.closure.GridClosureProcessor$1.body(GridClosureProcessor.java:826)
      	at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:119)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: class org.apache.ignite.IgniteCheckedException: null
      	at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:3050)
      	at org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2531)
      	at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2569)
      	... 9 more
      Caused by: java.lang.NullPointerException
      	at org.apache.ignite.internal.processors.query.h2.sql.GridSqlFunction.getSQL(GridSqlFunction.java:124)
      	at org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuery.getSortLimitSQL(GridSqlQuery.java:171)
      	at org.apache.ignite.internal.processors.query.h2.sql.GridSqlSelect.getSQL(GridSqlSelect.java:182)
      	at org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter.splitQuery(GridSqlQuerySplitter.java:371)
      	at org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter.split0(GridSqlQuerySplitter.java:280)
      	at org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter.split(GridSqlQuerySplitter.java:212)
      	at org.apache.ignite.internal.processors.query.h2.QueryParser.parseH2(QueryParser.java:501)
      	at org.apache.ignite.internal.processors.query.h2.QueryParser.parse0(QueryParser.java:173)
      	at org.apache.ignite.internal.processors.query.h2.QueryParser.parse(QueryParser.java:132)
      	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1115)
      	at org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2515)
      	at org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2511)
      	at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:35)
      	at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:3027)
      	... 11 more
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            tledkov-gridgain Taras Ledkov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: