Nishant Bangarwa created CALCITE-1687:
-----------------------------------------

             Summary: NPE in AggregateNode.getAccumulator
                 Key: CALCITE-1687
                 URL: https://issues.apache.org/jira/browse/CALCITE-1687
             Project: Calcite
          Issue Type: Bug
            Reporter: Nishant Bangarwa
            Assignee: Julian Hyde


Faced this while working on https://issues.apache.org/jira/browse/CALCITE-1683
Stack Trace - 
java.lang.RuntimeException: exception while executing [select count(*) as c
from "foodmart"
where extract(year from "timestamp") = 1997
and extract(month from "timestamp") in (4, 6)
]

        at 
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1245)
        at 
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1224)
        at 
org.apache.calcite.test.CalciteAssert$AssertQuery.returnsUnordered(CalciteAssert.java:1251)
        at 
org.apache.calcite.test.DruidAdapterIT.testFilterTimestamp(DruidAdapterIT.java:1349)
        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:498)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)
        at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
        at 
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
        at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
        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:498)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.lang.RuntimeException: With materializationsEnabled=false, 
limit=0
        at 
org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:524)
        at 
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1241)
        ... 30 more
Caused by: java.sql.SQLException: Error while executing SQL "select count(*) as 
c
from "foodmart"
where extract(year from "timestamp") = 1997
and extract(month from "timestamp") in (4, 6)
": null
        at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
        at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
        at 
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
        at 
org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218)
        at 
org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:492)
        ... 31 more
Caused by: java.lang.NullPointerException
        at 
org.apache.calcite.interpreter.AggregateNode.getAccumulator(AggregateNode.java:144)
        at 
org.apache.calcite.interpreter.AggregateNode.<init>(AggregateNode.java:86)
        at 
org.apache.calcite.interpreter.Nodes$CoreCompiler.visit(Nodes.java:47)
        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:498)
        at 
org.apache.calcite.util.ReflectUtil.invokeVisitorInternal(ReflectUtil.java:257)
        at 
org.apache.calcite.util.ReflectUtil.invokeVisitor(ReflectUtil.java:214)
        at 
org.apache.calcite.util.ReflectUtil$1.invokeVisitor(ReflectUtil.java:465)
        at 
org.apache.calcite.interpreter.Interpreter$Compiler.visit(Interpreter.java:479)
        at 
org.apache.calcite.interpreter.Interpreter$Compiler.visitRoot(Interpreter.java:436)
        at 
org.apache.calcite.interpreter.Interpreter.<init>(Interpreter.java:78)
        at Baz.bind(Unknown Source)
        at 
org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:327)
        at 
org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:294)
        at 
org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:553)
        at 
org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:544)
        at 
org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:193)
        at 
org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:67)
        at 
org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:44)
        at 
org.apache.calcite.avatica.AvaticaConnection$1.execute(AvaticaConnection.java:607)
        at 
org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:600)
        at 
org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:615)
        at 
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:148)
        ... 33 more



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to