Julian Hyde created CALCITE-1775: ------------------------------------ Summary: Druid adapter: "GROUP BY ()" on empty relation should return 1 row Key: CALCITE-1775 URL: https://issues.apache.org/jira/browse/CALCITE-1775 Project: Calcite Issue Type: Bug Components: druid Reporter: Julian Hyde Assignee: Julian Hyde
A "GROUP BY ()" query on an empty relation should return 1 row, but currently returns 0 rows. Test case in {{DruidAdapterIT}}: {code} @Test public void testSelectCountEmpty() { sql("select count(*) as c from \"foodmart\" where \"product_id\" < 0") .returnsUnordered("C=0"); sql("select count(*) as c from \"foodmart\" where 1 < 0") .returnsUnordered("C=0"); } {code} Both queries should return one row. The first returns 0 rows; the second query throws {noformat} java.lang.AssertionError: cannot translate filter: false at org.apache.calcite.adapter.druid.DruidQuery$Translator.translateFilter(DruidQuery.java:1067) at org.apache.calcite.adapter.druid.DruidQuery$Translator.access$000(DruidQuery.java:933) at org.apache.calcite.adapter.druid.DruidQuery.getQuery(DruidQuery.java:497) at org.apache.calcite.adapter.druid.DruidQuery.deriveQuerySpec(DruidQuery.java:470) at org.apache.calcite.adapter.druid.DruidQuery.getQuerySpec(DruidQuery.java:414) at org.apache.calcite.adapter.druid.DruidQuery.deriveRowType(DruidQuery.java:308) at org.apache.calcite.rel.AbstractRelNode.getRowType(AbstractRelNode.java:224) at org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:857) at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:883) at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:1769) at org.apache.calcite.plan.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:135) at org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:225) at org.apache.calcite.adapter.druid.DruidRules$DruidFilterRule.onMatch(DruidRules.java:228) at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:211) {noformat} -- This message was sent by Atlassian JIRA (v6.3.15#6346)