You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Feng Zhu (JIRA)" <ji...@apache.org> on 2019/07/03 06:52:00 UTC
[jira] [Commented] (CALCITE-3164) Averaging an all-nulls values
after grouping produce NaN instead of NULL
[ https://issues.apache.org/jira/browse/CALCITE-3164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16877529#comment-16877529 ]
Feng Zhu commented on CALCITE-3164:
-----------------------------------
Hi, [~mgelbana], I cannot reproduce the issue in current master branch. Could you provide more information?
{code:java}
@Test public void testNaNValues() {
CalciteAssert.that()
.query("select \"C1\", avg(\"C2\") "
+ "from (values ('X', cast(nullif(1,1) as integer))) as \"T\" (\"C1\", \"C2\") "
+ "group by \"C1\"")
.returns("C1=X; EXPR$1=null\n");
}
{code}
> Averaging an all-nulls values after grouping produce NaN instead of NULL
> ------------------------------------------------------------------------
>
> Key: CALCITE-3164
> URL: https://issues.apache.org/jira/browse/CALCITE-3164
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.20.0
> Reporter: Muhammad Gelbana
> Priority: Major
>
> {code:sql}
> -- Values are a single tuple
> SELECT C1, avg(C2)
> FROM (VALUES('X', NULL::INT)) T (C1, C2)
> GROUP BY C1
> -- Values are more than a single tuple
> SELECT C1, avg(C2)
> FROM (VALUES('X', NULL::INT), ('X', NULL::INT)) T (C1, C2)
> GROUP BY C1
> {code}
> Those queries return {{NaN}} while it's expected to return {{NULL}}.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)