You are viewing a plain text version of this content. The canonical link for it is here.
Posted to codereview@trafodion.apache.org by traflm <gi...@git.apache.org> on 2016/12/11 09:05:01 UTC

[GitHub] incubator-trafodion pull request #875: [TRAFODION-2379] update sql reference...

GitHub user traflm opened a pull request:

    https://github.com/apache/incubator-trafodion/pull/875

    [TRAFODION-2379] update sql reference manual about group_concat function

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/traflm/incubator-trafodion TRAFODION-2379

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-trafodion/pull/875.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #875
    
----
commit b82c05b2ea9ca454c5abcccb6c4efa81b5221d52
Author: Liu Ming <ov...@sina.com>
Date:   2016-12-11T09:01:09Z

    [TRAFODION-2379] update sql reference manual about group_concat function

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request #875: [TRAFODION-2379] update sql reference...

Posted by traflm <gi...@git.apache.org>.
Github user traflm commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/875#discussion_r92414734
  
    --- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
    @@ -3584,6 +3586,47 @@ Start/Date Time/Shipped               (EXPR)
     ```
     
     <<<
    +[[group_concat_function]]
    +== GROUP_CONCAT Function
    +
    +This function returns a string result with the concatenated non-NULL values from a group. 
    +It returns NULL if there are no non-NULL values. 
    +The syntax is as follows:
    +
    +```
    +GROUP_CONCAT([DISTINCT] expr [,expr ...]
    +             [ORDER BY {unsigned_integer | col_name | expr}
    +                 [ASC | DESC] [,col_name ...]]
    +             [SEPARATOR str_val])
    +```
    +
    +Get the concatenated values of expression combinations. To eliminate duplicate values, 
    +use the DISTINCT clause. 
    +To sort values in the result, use the ORDER BY clause. To sort in reverse order, add 
    +the DESC (descending) keyword to the name of the column you are sorting by in the 
    +ORDER BY clause. The default is ascending order; this may be specified explicitly using
    +the ASC keyword. The default separator between values in a group is comma (,). To specify 
    +a separator explicitly, use SEPARATOR followed by the string literal value that should be 
    +inserted between group values. To eliminate the separator altogether, specify SEPARATOR ''.
    +
    +[[examples_of_group_concat]]
    +=== Examples of GROUP_CONCAT
    +
    +The following example returns concatenated strings for column test_score for each student.
    +
    +```
    +>> SELECT student_name,
    +         GROUP_CONCAT(DISTINCT test_score
    +                   ORDER BY test_score DESC SEPARATOR ' ')
    +         FROM student
    +         GROUP BY student_name;
    +STUDENT_NAME     (EXPR)
    +--------------  --------------
    +scott            80 90 91 56
    +tom              77 43 91
    --- End diff --
    
    Thanks Dave, it should be ordered, I will update the text.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request #875: [TRAFODION-2379] update sql reference...

Posted by DaveBirdsall <gi...@git.apache.org>.
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/875#discussion_r92278930
  
    --- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
    @@ -3584,6 +3586,47 @@ Start/Date Time/Shipped               (EXPR)
     ```
     
     <<<
    +[[group_concat_function]]
    +== GROUP_CONCAT Function
    +
    +This function returns a string result with the concatenated non-NULL values from a group. 
    +It returns NULL if there are no non-NULL values. 
    +The syntax is as follows:
    +
    +```
    +GROUP_CONCAT([DISTINCT] expr [,expr ...]
    +             [ORDER BY {unsigned_integer | col_name | expr}
    +                 [ASC | DESC] [,col_name ...]]
    +             [SEPARATOR str_val])
    +```
    +
    +Get the concatenated values of expression combinations. To eliminate duplicate values, 
    +use the DISTINCT clause. 
    +To sort values in the result, use the ORDER BY clause. To sort in reverse order, add 
    +the DESC (descending) keyword to the name of the column you are sorting by in the 
    +ORDER BY clause. The default is ascending order; this may be specified explicitly using
    +the ASC keyword. The default separator between values in a group is comma (,). To specify 
    +a separator explicitly, use SEPARATOR followed by the string literal value that should be 
    +inserted between group values. To eliminate the separator altogether, specify SEPARATOR ''.
    +
    +[[examples_of_group_concat]]
    +=== Examples of GROUP_CONCAT
    +
    +The following example returns concatenated strings for column test_score for each student.
    +
    +```
    +>> SELECT student_name,
    +         GROUP_CONCAT(DISTINCT test_score
    +                   ORDER BY test_score DESC SEPARATOR ' ')
    +         FROM student
    +         GROUP BY student_name;
    +STUDENT_NAME     (EXPR)
    +--------------  --------------
    +scott            80 90 91 56
    +tom              77 43 91
    --- End diff --
    
    The test scores aren't in order. When I tried this example, I got "91 90 80 56" for scott's test scores, and "91 77 43" for tom's. So the code seems to work. Just this text seems to be wrong.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request #875: [TRAFODION-2379] update sql reference...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-trafodion/pull/875


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---