[
https://issues.apache.org/jira/browse/CALCITE-878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16416068#comment-16416068
]
Julian Hyde commented on CALCITE-878:
-------------------------------------
Since {{ORDER BY}} within {{COLLECT}} is an Oracle-specific extension it would
make more sense to support {{WITHIN GROUP}}, as follows:
{code}SELECT deptno, COLLECT(emp_type(ename, sal)) WITHIN GROUP (ORDER BY sal
DESC) emps
FROM emp
GROUP BY deptno{code}
> Allow ORDER BY within COLLECT (an Oracle extension)
> ---------------------------------------------------
>
> Key: CALCITE-878
> URL: https://issues.apache.org/jira/browse/CALCITE-878
> Project: Calcite
> Issue Type: Bug
> Reporter: Julian Hyde
> Assignee: Julian Hyde
> Priority: Major
>
> Oracle allows ORDER BY within the COLLECT aggregate function, e.g.
> {code}SELECT deptno, COLLECT(emp_type(ename, sal) ORDER BY sal DESC) emps
> FROM emp
> GROUP BY deptno{code}
> This is an Oracle-specific extension to SQL:2011 but nevertheless useful and
> worth considering.
> Note that Calcite already supports DISTINCT within COLLECT.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)