Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1097

Exception when executing query with too many aggregation columns

Rank to TopRank to BottomBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersConvert to sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.0
    • 1.7.0
    • core
    • None

    Description

      When executing a query like the following:
      select s."cust_id", sum(s."prod_id"), sum(s."prod_id_1"), ......, sum(s."prod_id_194"), sum(s."prod_id_195"), sum(s."prod_id_196"), sum(s."prod_id_197"), sum(s."prod_id_198"), sum(s."prod_id_199")
      from "foodmart"."table" as s group by s."cust_id"

      Calcite reports exception as followed:
      Exception in thread "main" java.sql.SQLException: Error while executing SQL
      Error while compiling generated Java code:
      public static class Record200_0 implements java.io.Serializable {
      .....
      Caused by: org.codehaus.janino.JaninoRuntimeException: Baz$2.apply(): Operand stack overflow at offset 1195
      at org.codehaus.janino.CodeContext.flowAnalysis(CodeContext.java:490)

      Tracking down the error in EnumerableAggregate, I found that this is because Calcite generates a class with a constructor which has as many parameters as the aggregated fields, and the auto-generated java code causes error while being compiled.
      There is not a certain number of constructor number, since it seems the longest length of constructor parameter also relates to the java type of the parameters.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            julianhyde Julian Hyde
            chenzhifa@mininglamp.com chenzhifa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment