You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2018/03/27 18:44:00 UTC

[jira] [Commented] (CALCITE-878) Allow ORDER BY within COLLECT (an Oracle extension)

    [ 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)