You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Marcel Kornacker (JIRA)" <ji...@apache.org> on 2017/03/16 23:41:41 UTC

[jira] [Commented] (IMPALA-5083) add ORDER BY clause to GROUP_CONCAT()

    [ https://issues.apache.org/jira/browse/IMPALA-5083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15929166#comment-15929166 ] 

Marcel Kornacker commented on IMPALA-5083:
------------------------------------------

We currently have the separator as parameter 2, so let's make the syntax with the ORDER BY like so:

GROUP_CONCAT([DISTINCT] expr [, expr...] [ORDER BY...] [, str_val])

> add ORDER BY clause to GROUP_CONCAT()
> -------------------------------------
>
>                 Key: IMPALA-5083
>                 URL: https://issues.apache.org/jira/browse/IMPALA-5083
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Backend, Frontend
>            Reporter: Greg Rahn
>              Labels: ramp-up
>
> Currently GROUP_CONCAT() does not allow one to return an ordered result.  The MySQL version does support this:
> {noformat}
> GROUP_CONCAT([DISTINCT] expr [,expr ...]
>              [ORDER BY {unsigned_integer | col_name | expr}
>                  [ASC | DESC] [,col_name ...]]
>              [SEPARATOR str_val])
> {noformat}
> https://dev.mysql.com/doc/refman/8.0/en/group-by-functions.html#function_group-concat
> For example:
> {noformat}
> mysql> SELECT student_name,
>     ->     GROUP_CONCAT(DISTINCT test_score
>     ->               ORDER BY test_score DESC SEPARATOR ' ')
>     ->     FROM student
>     ->     GROUP BY student_name;
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)