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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.12.0
    • 1.13.0
    • druid-adapter
    • 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

              bslim Slim Bouguerra
              bslim Slim Bouguerra
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: