Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1805

Druid adapter incorrectly pushes down "COUNT(c)"; Druid only supports "COUNT(*)"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.12.0
    • Fix Version/s: 1.13.0
    • Component/s: druid
    • Labels:
      None

      Description

      Currently queries like

      select count(column) from table

      is pushed to druid as timeseries with an aggregator

       {"type":"count","name":"EXPR$0","fieldName":"countryName"} 

      Such an aggregator does not exist in druid. The count aggregator does only work as

       count(*) 

      .
      here is a test case that summarize the issue.

        @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
        }

      First test will pass while the second will not.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bslim slim bouguerra
                Reporter:
                bslim slim bouguerra
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: