Liu Liu created FLINK-40344:
-------------------------------

             Summary: 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


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