Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-3492

Do DISTINCT in it's proper order -- after Window Functions and before UNION

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.2.5
    • 1.2.6
    • ExeMgr
    • None
    • 2019-06

    Description

      Currently, DISTINCT is implemented by creating a GROUP BY with all the non-aggregate columns. This causes DISTINCT to be executed before Window Functions, and it includes the partition and order by columns from the window function. The standard is do the uniqueness after Window Functions, just before UNION (if any). The results are similar, unless Window Functions are involved, in which case, the DISTINCT being executed before Window Functions deletes rows that should be included in the Window Function processing, resulting in the wrong answer.

      This page shows the expected order of SQL processing: https://www.eversql.com/sql-order-of-operations-sql-query-order-of-execution/

      Attachments

        Activity

          Transition Time In Source Status Execution Times
          David Hall (Inactive) made transition -
          Open Confirmed
          3m 36s 1
          David Hall (Inactive) made transition -
          Confirmed In Progress
          8s 1
          David Hall (Inactive) made transition -
          In Progress In Review
          2d 20h 38m 1
          Andrew Hutchings (Inactive) made transition -
          In Review In Testing
          3h 12m 1
          Daniel Lee (Inactive) made transition -
          In Testing Closed
          90d 26m 1

          People

            dleeyh Daniel Lee (Inactive)
            David.Hall David Hall (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.