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

Bettle commented on FLINK-40344:
--------------------------------

Hi, I’d like to work on this issue as my first contribution to Apache Flink. I 
plan to add a focused Table API test for computed grouping expressions and 
investigate mapping the selected grouping expression to the corresponding 
aggregate output field. Could a committer please confirm the approach and 
assign the issue to me? Thanks!

> Computed grouping expressions cannot be selected in Table API aggregations
> --------------------------------------------------------------------------
>
>                 Key: FLINK-40344
>                 URL: https://issues.apache.org/jira/browse/FLINK-40344
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>    Affects Versions: 1.10.0
>            Reporter: Liu Liu
>            Priority: Minor
>
> Selecting a computed grouping expression from a grouped Table fails even when 
> the same expression is used as the grouping key.
> For example:
> {code:java}
> import org.apache.flink.table.api.Expression;
> import org.apache.flink.table.api.Table;
> import static org.apache.flink.table.api.Expressions.$;
> Expression key = $("v").isGreater(10);
> Table result =
>         table.groupBy(key)
>                 .select(key, $("v").count().as("n"));
> {code}
> This raises a ValidationException because field "v" cannot be resolved after 
> aggregation. The query should succeed and return the computed Boolean 
> grouping key followed by the count. The equivalent SQL query works correctly.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to