[ 
https://issues.apache.org/jira/browse/KYLIN-1377?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shaofeng SHI updated KYLIN-1377:
--------------------------------
    Description: 
TopN should support not only SUM, but also MAX, MIN as the expression.

A possible case is, find out the sellers which sold the top expensive items:

select seller_id, max(price) from sals_records where region = 'US' and year = 
'2015' order by max(price) desc limit 100;

In the future, more parameter should be supported

1) the expression (default SUM); 2) the soring order (default Desc). 3) the 
encoding method:

A sample is:

{code}
{
    "name" : "TOP_SELLER",
    "function" : {
      "expression" : "TOP_N",
      "parameter" : {
        "id": 0,
        "type" : "column",
        "value" : "PRICE",
        "next_parameter" : {
          "id": 1,
          "type" : "column",
          "value" : "SELLER_ID",
          "next_parameter" : {
             "id": 2,
            "type" : "",
            "value" : "SUM",
            "next_parameter" : {
              "id": 3,
              "type" : "",
              "value" : "DESC"
                "next_parameter" : {
                 "id": 4,
                "type" : "",
                "value" : "dict"
            }
            }
        }
      },
      "returntype" : "topn(100)"
    },

{code}

  was:
TopN should support not only SUM, but also MAX, MIN as the expression.

A possible case is, find out the sellers which sold the top expensive items:

select seller_id, max(price) from sals_records where region = 'US' and year = 
'2015' order by max(price) desc limit 100;


> TopN measure should support more expressions
> --------------------------------------------
>
>                 Key: KYLIN-1377
>                 URL: https://issues.apache.org/jira/browse/KYLIN-1377
>             Project: Kylin
>          Issue Type: New Feature
>    Affects Versions: v2.0
>            Reporter: Shaofeng SHI
>            Assignee: Shaofeng SHI
>             Fix For: Backlog
>
>
> TopN should support not only SUM, but also MAX, MIN as the expression.
> A possible case is, find out the sellers which sold the top expensive items:
> select seller_id, max(price) from sals_records where region = 'US' and year = 
> '2015' order by max(price) desc limit 100;
> In the future, more parameter should be supported
> 1) the expression (default SUM); 2) the soring order (default Desc). 3) the 
> encoding method:
> A sample is:
> {code}
> {
>     "name" : "TOP_SELLER",
>     "function" : {
>       "expression" : "TOP_N",
>       "parameter" : {
>         "id": 0,
>         "type" : "column",
>         "value" : "PRICE",
>         "next_parameter" : {
>           "id": 1,
>           "type" : "column",
>           "value" : "SELLER_ID",
>           "next_parameter" : {
>              "id": 2,
>             "type" : "",
>             "value" : "SUM",
>             "next_parameter" : {
>               "id": 3,
>               "type" : "",
>               "value" : "DESC"
>                 "next_parameter" : {
>                  "id": 4,
>                 "type" : "",
>                 "value" : "dict"
>             }
>             }
>         }
>       },
>       "returntype" : "topn(100)"
>     },
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to