title: There's a count difference between Druid Native Query and Druid SQL when using query
body: <p>I have a problem with Druid Query.</p>
  <p>I wanted to get data count with hour granularity.</p>
  <p>So, I used Druid SQL like this.</p>
  <pre><code>SELECT TIME_FLOOR(__time, 'PT1H') AS t, count(1) AS cnt FROM mydatasource GROUP BY 1
  </code></pre>
  <p>then I got response like this.</p>
  <pre><code>[
    {
      &quot;t&quot;: &quot;2022-08-31T09:00:00.000Z&quot;,
      &quot;cnt&quot;: 12427
    },
    {
      &quot;t&quot;: &quot;2022-08-31T10:00:00.000Z&quot;,
      &quot;cnt&quot;: 16693
    },
    {
      &quot;t&quot;: &quot;2022-08-31T11:00:00.000Z&quot;,
      &quot;cnt&quot;: 16694
    },
    ...
  </code></pre>
  <p>But, When using native query like this,</p>
  <pre><code>{
    &quot;queryType&quot;: &quot;timeseries&quot;,
    &quot;dataSource&quot;: &quot;mydatasource&quot;,
    &quot;intervals&quot;: &quot;2022-08-31T07:01Z/2022-09-01T07:01Z&quot;,
    &quot;granularity&quot;: {
      &quot;type&quot;: &quot;period&quot;,
      &quot;period&quot;: &quot;PT1H&quot;,
      &quot;timeZone&quot;: &quot;Etc/UTC&quot;
    },
    &quot;aggregations&quot;: [
      {
        &quot;name&quot;: &quot;count&quot;,
        &quot;type&quot;: &quot;longSum&quot;,
        &quot;fieldName&quot;: &quot;count&quot;
      }
    ],
    &quot;context&quot;: {
      &quot;skipEmptyBuckets&quot;: &quot;true&quot;
    }
  }
  </code></pre>
  <p>There's a difference result.</p>
  <pre><code>[
    {
      &quot;timestamp&quot;: &quot;2022-08-31T09:00:00.000Z&quot;,
      &quot;result&quot;: {
          &quot;count&quot;: 1288965
      }
    },
    {
      &quot;timestamp&quot;: &quot;2022-08-31T10:00:00.000Z&quot;,
      &quot;result&quot;: {
          &quot;count&quot;: 1431215
      }
    },
    {
      &quot;timestamp&quot;: &quot;2022-08-31T11:00:00.000Z&quot;,
      &quot;result&quot;: {
          &quot;count&quot;: 1545258
      }
    },
    ...
  </code></pre>
  <p>I want to use the result of Native Query.</p>
  <p>What's the problem in my Druid SQL query??</p>
  <p>How do I create a query to get native query results?</p>
  <hr />
  <p>I found what's difference.</p>
  <p>when using longSum type aggregation, I get result like native query.</p>
  <p>So, I want to know how to query aggregate like below using sql.</p>
  <pre><code>&quot;aggregations&quot;: [
    {
      &quot;type&quot;: &quot;longSum&quot;,
      &quot;name&quot;: &quot;count&quot;,
      &quot;fieldName&quot;: &quot;count&quot;
    }
  ]
  </code></pre>