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

    XMLWordPrintable

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

          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.