You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2018/04/26 07:02:00 UTC
[jira] [Commented] (CALCITE-2283) aggregate over empty set , throw
java.lang.NullPointerException
[ https://issues.apache.org/jira/browse/CALCITE-2283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16453590#comment-16453590 ]
Julian Hyde commented on CALCITE-2283:
--------------------------------------
I can reproduce this on the built-in data sets: with patch {noformat}diff --git a/core/src/test/resources/sql/misc.iq b/core/src/test/resources/sql/misc.iq
index 0aeb99d97..26cf4fed0 100644
--- a/core/src/test/resources/sql/misc.iq
+++ b/core/src/test/resources/sql/misc.iq
@@ -1327,6 +1327,12 @@ from "scott".emp;
!ok
+#
+select count(distinct(deptno)), count(sal)
+from "scott".emp
+where 1 = 2;
+!ok
+
# Explicit ROW
select deptno, row (empno, deptno) as r
from "scott".emp;
{noformat}run CoreQuidemTest sql/misc.iq.
> aggregate over empty set , throw java.lang.NullPointerException
> ---------------------------------------------------------------
>
> Key: CALCITE-2283
> URL: https://issues.apache.org/jira/browse/CALCITE-2283
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.16.0
> Reporter: foxes
> Assignee: Julian Hyde
> Priority: Major
>
> {code:java}
> //代码
> String sql =
> "select " +
> " count(distinct(bill_id)) as FULLY_REPAY_BILLS2_LST6 ," +
> " count(last_month) . as FULLY_REPAY_MONTHS_LST6 " +
> "from " +
> " cardBill " +
> "WHERE " +
> " 1=2 ";
> ResultSet result = st.executeQuery(sql.toUpperCase());
> result.next();// this throw NullPointerException
> {code}
> {code:java}
>
> Exception in thread "main" java.lang.NullPointerException
> at Baz$4$1.current(Unknown Source)
> at org.apache.calcite.linq4j.Linq4j$EnumeratorIterator.next(Linq4j.java:688)
> at org.apache.calcite.avatica.util.IteratorCursor.next(IteratorCursor.java:46)
> at org.apache.calcite.avatica.AvaticaResultSet.next(AvaticaResultSet.java:207)
> at com.terry.netease.calcite.test.test.TestMemoryQuery.main(TestMemoryQuery.java:84)
> 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:147){code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)