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

Vishaal Selvaraj edited comment on FLINK-20794 at 5/13/23 8:42 AM:
-------------------------------------------------------------------

Looks like this feature is already available in master. I tried running this 
query in Flink SQL CLI and it works.

SELECT distinct name FROM (VALUES ('Bob'), ('Alice'), ('Greg'), ('Bob')) AS 
NameTable(name) GROUP BY name;

!screenshot-1.png!

[~dian.fu], should we close this?


was (Author: JIRAUSER300105):
Looks like this feature is already available in master. I tried running this 
query in Flink SQL CLI and it works.

SELECT distinct name FROM (VALUES ('Bob'), ('Alice'), ('Greg'), ('Bob')) AS 
NameTable(name) GROUP BY name;

 !screenshot-1.png! 

> Support to select distinct columns in the Table API
> ---------------------------------------------------
>
>                 Key: FLINK-20794
>                 URL: https://issues.apache.org/jira/browse/FLINK-20794
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / API
>            Reporter: Dian Fu
>            Assignee: Vishaal Selvaraj
>            Priority: Major
>             Fix For: 1.18.0
>
>         Attachments: screenshot-1.png
>
>
> Currently, there is no corresponding functionality in Table API for the 
> following SQL:
> {code:java}
> SELECT DISTINCT users FROM Orders
> {code}
> For example, for the following job:
> {code:java}
> table.select("distinct a")
> {code}
> It will thrown the following exception:
> {code:java}
> org.apache.flink.table.api.ExpressionParserException: Could not parse 
> expression at column 10: ',' expected but 'a' 
> foundorg.apache.flink.table.api.ExpressionParserException: Could not parse 
> expression at column 10: ',' expected but 'a' founddistinct a         ^
>  at 
> org.apache.flink.table.expressions.PlannerExpressionParserImpl$.throwError(PlannerExpressionParserImpl.scala:726)
>  at 
> org.apache.flink.table.expressions.PlannerExpressionParserImpl$.parseExpressionList(PlannerExpressionParserImpl.scala:710)
>  at 
> org.apache.flink.table.expressions.PlannerExpressionParserImpl.parseExpressionList(PlannerExpressionParserImpl.scala:47)
>  at 
> org.apache.flink.table.expressions.ExpressionParser.parseExpressionList(ExpressionParser.java:40)
>  at 
> org.apache.flink.table.api.internal.TableImpl.select(TableImpl.java:121){code}



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

Reply via email to