Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-5731

Cannot use aggregation expression in orderBy

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.0.1.Final
    • 8.0.0.Final
    • None
    • None

      The following query

      public void testSumOrderBy() {
          QueryFactory qf = getQueryFactory();
          Query q = qf.from(getModelFactory().getUserImplClass())
                  .select(Expression.sum("age"))
                  .orderBy(Expression.sum("age"))
                  .build();
      }
      

      in the context of QueryDslConditionsTest test class fails with

      org.antlr.runtime.tree.RewriteEmptyStreamException: rule propertyReferencePath
      	at org.antlr.runtime.tree.RewriteRuleElementStream._next(RewriteRuleElementStream.java:157)
      	at org.antlr.runtime.tree.RewriteRuleElementStream.nextTree(RewriteRuleElementStream.java:144)
      	at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.valueExpressionPrimary(GeneratedHQLResolver.java:8036)
      	at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.valueExpression(GeneratedHQLResolver.java:7538)
      	at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.sortSpecification(GeneratedHQLResolver.java:4563)
      	at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.orderByClause(GeneratedHQLResolver.java:4469)
      	at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.queryStatement(GeneratedHQLResolver.java:1766)
      	at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.queryStatementSet(GeneratedHQLResolver.java:1658)
      	at org.hibernate.hql.ast.origin.hql.resolve.GeneratedHQLResolver.statement(GeneratedHQLResolver.java:654)
      	at org.hibernate.hql.ast.spi.QueryResolverProcessor.process(QueryResolverProcessor.java:52)
      	at org.hibernate.hql.QueryParser.parseQuery(QueryParser.java:82)
      	at org.infinispan.objectfilter.impl.BaseMatcher.parse(BaseMatcher.java:125)
      	at org.infinispan.query.dsl.embedded.impl.QueryEngine.parse(QueryEngine.java:398)
      	at org.infinispan.query.dsl.embedded.impl.QueryEngine.buildQuery(QueryEngine.java:86)
      	at org.infinispan.query.dsl.embedded.impl.DelegatingQuery.createQuery(DelegatingQuery.java:38)
      	at org.infinispan.query.dsl.embedded.impl.DelegatingQuery.list(DelegatingQuery.java:45)
      	at org.infinispan.query.dsl.embedded.QueryDslConditionsTest.testSumOrderBy(QueryDslConditionsTest.java:1976)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
      	at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
      	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
      	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
      	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
      	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      	at org.testng.TestRunner.privateRun(TestRunner.java:767)
      	at org.testng.TestRunner.run(TestRunner.java:617)
      	at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
      	at org.testng.SuiteRunner.access$000(SuiteRunner.java:38)
      	at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:382)
      	at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      

              anistor Adrian Nistor (Inactive)
              jmarkos Jakub Markos (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: