[
https://issues.apache.org/jira/browse/FLINK-20794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17722352#comment-17722352
]
Vishaal Selvaraj edited comment on FLINK-20794 at 5/13/23 9:45 AM:
-------------------------------------------------------------------
As for the table API equivalency, I can see that we have a method in the Table
interface to perform distinct operations.
{code:java}
/**
* Removes duplicate values and returns only distinct (different) values.
*
* <p>Example:
*
* <pre>{@code
* tab.select($("key"), $("value")).distinct();
* }</pre>
*/
Table distinct();
{code}
was (Author: JIRAUSER300105):
As for the table API equivalency, I can see that we have a method in the Table
interface to perform distinct operations.
{color:#8391a0}/**
{color}{color:#8391a0} * Removes duplicate values and returns only distinct
(different) values.
{color}{color:#8391a0} *
{color}{color:#8391a0} * {color}{color:#59626f}<p>{color}{color:#8391a0}Example:
{color}{color:#8391a0} *
{color}{color:#8391a0} *
{color}{color:#59626f}<pre>{color}{color:#8391a0}{{color}{color:#c792ea}@code
{color}{color:#c792ea} {color}{color:#8391a0}* tab.select($("key"),
$("value")).distinct();
{color}{color:#8391a0} * }{color}{color:#59626f}</pre>
{color}{color:#59626f} {color}{color:#8391a0}*/
{color}{color:#92d69e}Table
{color}{color:#62bffc}distinct{color}{color:#a6b2c0}();{color}
> 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)