julianhyde commented on code in PR #3946:
URL: https://github.com/apache/calcite/pull/3946#discussion_r1744180721


##########
core/src/test/resources/sql/measure.iq:
##########
@@ -26,6 +26,136 @@ from emp;
 
 !update
 
+create view empm_comm as
+select *, avg(sal) as measure avg_sal, avg(comm) as measure avg_comm
+from emp;
+(0 rows modified)
+
+!update
+
+# AGGREGATE with GROUP BY of a column that includes NULLs
+select mgr, avg_comm from empm_comm
+group by mgr;
++------+----------+
+| MGR  | AVG_COMM |
++------+----------+
+| 7566 |          |
+| 7698 |   550.00 |
+| 7782 |          |
+| 7788 |          |
+| 7839 |          |
+| 7902 |          |
+|      |          |
++------+----------+
+(7 rows)
+
+!ok
+
+# AGGREGATE with GROUP BY of an expression
+SELECT (job || '_yo') as job_yo, avg_sal FROM empm
+GROUP BY (job || '_yo');
++--------------+---------+
+| JOB_YO       | AVG_SAL |
++--------------+---------+
+| ANALYST_yo   | 3000.00 |
+| CLERK_yo     | 1037.50 |
+| MANAGER_yo   | 2758.33 |
+| PRESIDENT_yo | 5000.00 |
+| SALESMAN_yo  | 1400.00 |
++--------------+---------+
+(5 rows)
+
+!ok
+
+# single GROUPING SETS group with AS MEASURE reference
+SELECT job, year(hiredate) as hire_year, avg_sal FROM empm

Review Comment:
   if you're going to take 4 lines for GROUP BY, at least put FROM on its own 
line. (I find queries much more readable if clauses are on separate lines.)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to