4 Replies Latest reply: Feb 22, 2012 9:56 PM by Ganesh Kumar RSS

    Assertion Error when Order By is used with Group By

    Ganesh Kumar Newbie

      Hi all


      I am executing the query similar to the following:


      SELECT DB.Address, DB.City, count(*) as Count FROM "Emp"."persons" as DB

      GROUP BY DB.Address, DB.City

      ORDER BY DB.City


      This query is executed for a table in DB2. When I ran the query I get the exception:


      java.lang.AssertionError: Assertion failed.

                  at org.teiid.core.util.Assertion.failed(Assertion.java:73)

                  at org.teiid.core.util.Assertion.assertTrue(Assertion.java:68)

                  at org.teiid.core.util.Assertion.assertTrue(Assertion.java:60)

                  at org.teiid.query.processor.relational.SortUtility.<init>(SortUtility.java:145)



      I debugged Teiid. To do sorting, Teiid is checking if the column name to be sorted is existing in the set of columns in the query. For some reason, it is not finding the column name in the list of columns.


      Below was the list of columns Teiid found in the query:

      [DB.Address As Address, DB.City As City, count(*) as Count]


      Teiid was looking for the column ‘anon_grp0.gcol0 AS City’. It could not find this column in the above list and it threw Assertion error.


      Can you tell me why Teiid is throwing this error for DB2?


      Teiid version used 7.7.0 CR1

      Jboss version: 5.1.0 GA

      JDK version: 1.7.0_02