Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-15678

Optimize producing primary key without row number in special Top 1

    XMLWordPrintableJSON

Details

    Description

      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
      

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            lzljs3620320 Jingsong Lee
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: