[jira] [Created] (FLINK-15678) Optimize producing primary key without row number in special Top 1

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-15678) Optimize producing primary key without row number in special Top 1

Shang Yuanchun (Jira)
Jingsong Lee created FLINK-15678:
------------------------------------

             Summary: Optimize producing primary key without row number in special Top 1
                 Key: FLINK-15678
                 URL: https://issues.apache.org/jira/browse/FLINK-15678
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
            Reporter: Jingsong Lee
             Fix For: 1.11.0


{code:java}
SELECT c1, c2, c3, c4
FROM (
  SELECT *,ROW_NUMBER() OVER (PARTITION BY c1, c2, c3 ORDER BY c4 DESC) AS rownum
  FROM t
) WHERE rownum <= 1
{code}
This SQL is Top 1, Top N produce stream with primary keys contains row number, but your sql didn't select row number, so there is not primary key.

But for Top 1, we can produce primary key, because row number is always 1.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)