flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-2115) TableAPI throws ExpressionException for "Dangling GroupBy operation"
Date Thu, 19 Nov 2015 02:51:11 GMT

    [ https://issues.apache.org/jira/browse/FLINK-2115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15012670#comment-15012670

ASF GitHub Bot commented on FLINK-2115:

Github user ChengXiangLi commented on the pull request:

    @aljoscha , it's a very interesting topic, should we add a limitation that only allow
key fields to be no aggregated function field in `select` clause?
    Oracle has this limitation while Mysql does not. Most of the time, select non-aggregation
field after groupby has no real meaning, while sometimes, if user is aware that groupby some
fielde would lead to  other fields get grouped as well, this feature would help to improve
the performance and user convenience, more described here: http://dev.mysql.com/doc/refman/5.0/en/group-by-handling.html
. Currently we keep consistent with Mysql on this feature, allow no aggregation field after
`groupBy`, with no guarantee of its return value.
    Actually, i prefer to the Mysql way, more flexible to user, what do you think?  

> TableAPI throws ExpressionException for "Dangling GroupBy operation"
> --------------------------------------------------------------------
>                 Key: FLINK-2115
>                 URL: https://issues.apache.org/jira/browse/FLINK-2115
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API
>    Affects Versions: 0.9
>            Reporter: Fabian Hueske
>            Assignee: Chengxiang Li
> The following program below throws an ExpressionException due to a "Dangling GroupBy
> However, I think the program is semantically correct and should execute.
> {code}
> public static void main(String[] args) throws Exception {
>   ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
>   DataSet<Integer> data = env.fromElements(1,2,2,3,3,3,4,4,4,4);
>   DataSet<Tuple2<Integer, Integer>> tuples = data
>       .map(new MapFunction<Integer, Tuple2<Integer, Integer>>() {
>         @Override
>         public Tuple2<Integer, Integer> map(Integer i) throws Exception {
>           return new Tuple2<Integer, Integer>(i, i*2);
>         }
>       });
>   TableEnvironment tEnv = new TableEnvironment();
>   Table t = tEnv.toTable(tuples).as("i, i2")
>       .groupBy("i, i2").select("i, i2")
>       .groupBy("i").select("i, i.count as cnt");
>   tEnv.toSet(t, Row.class).print();
> }
> {code}

This message was sent by Atlassian JIRA

View raw message