You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "slim bouguerra (JIRA)" <ji...@apache.org> on 2017/05/26 05:07:04 UTC
[jira] [Commented] (CALCITE-1805) Druid adapter incorrectly pushes
down "COUNT(c)"; Druid only supports "COUNT(*)"
[ https://issues.apache.org/jira/browse/CALCITE-1805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16025810#comment-16025810 ]
slim bouguerra commented on CALCITE-1805:
-----------------------------------------
The example you gave yes but not an arbitrary one like the example below. Your example can be written a count of number of rows returned by group by countryName where countryName not null.
{code}
select sum(case when "countryName" is null then -1 else 1 end) from "wikiticker"
{code}
> Druid adapter incorrectly pushes down "COUNT(c)"; Druid only supports "COUNT(*)"
> --------------------------------------------------------------------------------
>
> Key: CALCITE-1805
> URL: https://issues.apache.org/jira/browse/CALCITE-1805
> Project: Calcite
> Issue Type: Bug
> Components: druid
> Affects Versions: 1.12.0
> Reporter: slim bouguerra
> Assignee: Julian Hyde
>
> Currently queries like
> {code}select count(column) from table{code} is pushed to druid as timeseries with an aggregator {code} {"type":"count","name":"EXPR$0","fieldName":"countryName"} {code}
> Such an aggregator does not exist in druid. The count aggregator does only work as {code} count(*) {code}.
> here is a test case that summarize the issue.
> {code} @Test public void testCount() {
> final String sql = "SELECT count(\"countryName\") FROM (SELECT \"countryName\" FROM \"wikiticker\" WHERE \"countryName\" IS NOT NULL) as a"; // correct count
> sql(sql, WIKI_AUTO2).returnsUnordered("EXPR$0=3799");
> final String sql2 = "SELECT count(\"countryName\") FROM (SELECT \"countryName\" FROM \"wikiticker\") as a";
> sql(sql2, WIKI_AUTO2).returnsUnordered("EXPR$0=3799"); // it will fail
> }{code} First test will pass while the second will not.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)