title: druid syntax to group by time (second/minute/hour/day/month/year)
body: <p>I am new to druid and I just ingested some data that has the following columns:</p>
  <pre><code>COLUMN      TYPE
  ======================
  __time      TIMESTAMP
  bId         VARCHAR
  count       BIGINT
  lId         VARCHAR
  sum__v      BIGINT
  sum_c       DOUBLE
  sum_cId     BIGINT
  sum_tc      BIGINT
  sum_td      BIGINT
  sum_ts      BIGINT
  sum_vi      DOUBLE
  sum_vs      DOUBLE
  </code></pre>
  <p>I want to get the average on a few columns grouped by minute.  I can't seem to get the correct syntax since it seems each of these queries is causing errors:</p>
  <pre><code>SELECT AVG(sum_ts), AVG(sum_vi) FROM graph GROUP BY MINUTE;
  
  Error: Unknown exception
  
  Encountered &quot;MINUTE ;&quot; at line 3, column 10. Was expecting one of: &quot;ARRAY&quot; ... &quot;CASE&quot; ... &quot;CUBE&quot; ... &quot;CURRENT&quot; ... &quot;CURRENT_CATALOG&quot; ... &quot;CURRENT_DATE&quot; ... &quot;CURRENT_DEFAULT_TRANSFORM_GROUP&quot; ... &quot;CURRENT_PATH&quot; ... &quot;CURRENT_ROLE&quot; ... &quot;CURRENT_SCHEMA&quot; ... &quot;CURRENT_TIME&quot; ... &quot;CURRENT_TIMESTAMP&quot; ... &quot;CURRENT_USER&quot; ... &quot;DATE&quot; ... &quot;EXISTS&quot; ... &quot;FALSE&quot; ... &quot;INTERVAL&quot; ... &quot;LOCALTIME&quot; ... &quot;LOCALTIMESTAMP&quot; ... &quot;MULTISET&quot; ... &quot;NEW&quot; ... &quot;NEXT&quot; ... &quot;NOT&quot; ... &quot;NULL&quot; ... &quot;PERIOD&quot; ... &quot;ROLLUP&quot; ... &quot;SESSION_USER&quot; ... &quot;SYSTEM_USER&quot; ... &quot;TIME&quot; ... &quot;TIMESTAMP&quot; ... &quot;TRUE&quot; ... &quot;UNKNOWN&quot; ... &quot;USER&quot; ... &lt;UNSIGNED_INTEGER_LITERAL&gt; ... &lt;APPROX_NUMERIC_LITERAL&gt; ... &lt;DECIMAL_NUMERIC_LITERAL&gt; ... &lt;BINARY_STRING_LITERAL&gt; ... &lt;QUOTED_STRING&gt; ... &lt;PREFIXED_STRING_LITERAL&gt; ... &lt;UNICODE_STRING_LITERAL&gt; ... &lt;LBRACE_D&gt; ... &lt;LBRACE_T&gt; ... &lt;LBRACE_TS&gt; ... &lt;LBRACE_FN&gt; ... &quot;?&quot; ... &quot;+&quot; ... &quot;-&quot; ... &lt;BRACKET_QUOTED_IDENTIFIER&gt; ... &lt;QUOTED_IDENTIFIER&gt; ... &lt;BACK_QUOTED_IDENTIFIER&gt; ... &lt;IDENTIFIER&gt; ... &lt;UNICODE_QUOTED_IDENTIFIER&gt; ... &quot;GROUPING&quot; ... &quot;(&quot; ... &quot;CAST&quot; ... &quot;EXTRACT&quot; ... &quot;POSITION&quot; ... &quot;CONVERT&quot; ... &quot;TRANSLATE&quot; ... &quot;OVERLAY&quot; ... &quot;FLOOR&quot; ... &quot;CEIL&quot; ... &quot;CEILING&quot; ... &quot;SUBSTRING&quot; ... &quot;TRIM&quot; ... &quot;CLASSIFIER&quot; ... &quot;MATCH_NUMBER&quot; ... &quot;RUNNING&quot; ... &quot;PREV&quot; ... &quot;JSON_EXISTS&quot; ... &quot;JSON_VALUE&quot; ... &quot;JSON_QUERY&quot; ... &quot;JSON_OBJECT&quot; ... &quot;JSON_OBJECTAGG&quot; ... &quot;JSON_ARRAY&quot; ... &quot;JSON_ARRAYAGG&quot; ... &quot;SPECIFIC&quot; ... &quot;ABS&quot; ... &quot;AVG&quot; ... &quot;CARDINALITY&quot; ... &quot;CHAR_LENGTH&quot; ... &quot;CHARACTER_LENGTH&quot; ... &quot;COALESCE&quot; ... &quot;COLLECT&quot; ... &quot;COVAR_POP&quot; ... &quot;COVAR_SAMP&quot; ... &quot;CUME_DIST&quot; ... &quot;COUNT&quot; ... &quot;DENSE_RANK&quot; ... &quot;ELEMENT&quot; ... &quot;EXP&quot; ... &quot;FIRST_VALUE&quot; ... &quot;FUSION&quot; ... &quot;HOUR&quot; ... &quot;LAG&quot; ... &quot;LEAD&quot; ... &quot;LEFT&quot; ... &quot;LAST_VALUE&quot; ... &quot;LN&quot; ... &quot;LOWER&quot; ... &quot;MAX&quot; ... &quot;MIN&quot; ... &quot;MINUTE&quot; ... &quot;MINUTE&quot; &quot;(&quot; ...
  
  org.apache.calcite.sql.parser.SqlParseException
  </code></pre>
  <pre><code>SELECT AVG(sum_ts), AVG(sum_vi) FROM graph GROUP BY MINUTE(__time);
  
  Error: Unknown exception
  
  Encountered &quot;;&quot; at line 3, column 24. Was expecting one of: &lt;EOF&gt; &quot;EXCEPT&quot; ... &quot;FETCH&quot; ... &quot;FILTER&quot; ... &quot;HAVING&quot; ... &quot;INTERSECT&quot; ... &quot;LIMIT&quot; ... &quot;OFFSET&quot; ... &quot;ORDER&quot; ... &quot;OVER&quot; ... &quot;MINUS&quot; ... &quot;UNION&quot; ... &quot;WINDOW&quot; ... &quot;WITHIN&quot; ... &quot;,&quot; ... &quot;.&quot; ... &quot;NOT&quot; ... &quot;IN&quot; ... &quot;&lt;&quot; ... &quot;&lt;=&quot; ... &quot;&gt;&quot; ... &quot;&gt;=&quot; ... &quot;=&quot; ... &quot;&lt;&gt;&quot; ... &quot;!=&quot; ... &quot;BETWEEN&quot; ... &quot;LIKE&quot; ... &quot;SIMILAR&quot; ... &quot;+&quot; ... &quot;-&quot; ... &quot;*&quot; ... &quot;/&quot; ... &quot;%&quot; ... &quot;||&quot; ... &quot;AND&quot; ... &quot;OR&quot; ... &quot;IS&quot; ... &quot;MEMBER&quot; ... &quot;SUBMULTISET&quot; ... &quot;CONTAINS&quot; ... &quot;OVERLAPS&quot; ... &quot;EQUALS&quot; ... &quot;PRECEDES&quot; ... &quot;SUCCEEDS&quot; ... &quot;IMMEDIATELY&quot; ... &quot;MULTISET&quot; ... &quot;[&quot; ... &quot;FORMAT&quot; ... &quot;IGNORE&quot; ... &quot;RESPECT&quot; ...
  
  org.apache.calcite.sql.parser.SqlParseException
  </code></pre>
  <p>What is the correct syntax to group by the minute? (or hour, or day, or month, or year?)</p>