chenzhifa created CALCITE-1097:
----------------------------------

             Summary: exception met when executing query with too  many 
aggregation columns
                 Key: CALCITE-1097
                 URL: https://issues.apache.org/jira/browse/CALCITE-1097
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.7.0
            Reporter: chenzhifa
            Assignee: Julian Hyde


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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to