[ https://issues.apache.org/jira/browse/FLINK-34366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17814898#comment-17814898 ]
Jeyhun Karimov commented on FLINK-34366: ---------------------------------------- Hi [~martijnvisser] I worked on this issue. Could you please check the PR? > Add support to group rows by column ordinals > -------------------------------------------- > > Key: FLINK-34366 > URL: https://issues.apache.org/jira/browse/FLINK-34366 > Project: Flink > Issue Type: New Feature > Components: Table SQL / API > Reporter: Martijn Visser > Priority: Major > Labels: pull-request-available > > Reference: BigQuery > https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#group_by_col_ordinals > The GROUP BY clause can refer to expression names in the SELECT list. The > GROUP BY clause also allows ordinal references to expressions in the SELECT > list, using integer values. 1 refers to the first value in the SELECT list, 2 > the second, and so forth. The value list can combine ordinals and value > names. The following queries are equivalent: > {code:sql} > WITH PlayerStats AS ( > SELECT 'Adams' as LastName, 'Noam' as FirstName, 3 as PointsScored UNION ALL > SELECT 'Buchanan', 'Jie', 0 UNION ALL > SELECT 'Coolidge', 'Kiran', 1 UNION ALL > SELECT 'Adams', 'Noam', 4 UNION ALL > SELECT 'Buchanan', 'Jie', 13) > SELECT SUM(PointsScored) AS total_points, LastName, FirstName > FROM PlayerStats > GROUP BY LastName, FirstName; > /*--------------+----------+-----------+ > | total_points | LastName | FirstName | > +--------------+----------+-----------+ > | 7 | Adams | Noam | > | 13 | Buchanan | Jie | > | 1 | Coolidge | Kiran | > +--------------+----------+-----------*/ > {code} > {code:sql} > WITH PlayerStats AS ( > SELECT 'Adams' as LastName, 'Noam' as FirstName, 3 as PointsScored UNION ALL > SELECT 'Buchanan', 'Jie', 0 UNION ALL > SELECT 'Coolidge', 'Kiran', 1 UNION ALL > SELECT 'Adams', 'Noam', 4 UNION ALL > SELECT 'Buchanan', 'Jie', 13) > SELECT SUM(PointsScored) AS total_points, LastName, FirstName > FROM PlayerStats > GROUP BY 2, 3; > /*--------------+----------+-----------+ > | total_points | LastName | FirstName | > +--------------+----------+-----------+ > | 7 | Adams | Noam | > | 13 | Buchanan | Jie | > | 1 | Coolidge | Kiran | > +--------------+----------+-----------*/ > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)