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

Aggregate and Window functions can't co-exist

    XMLWordPrintable

Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Won't Fix
    • 1.1.6, 1.2.5
    • 1.4
    • ExeMgr
    • None
    • 2019-06, 2020-1

    Description

      A simple query containing both a window function and an aggregate will cause an eroneous syntax err:

      MariaDB [dhall]> select avg(comm_total) as wk_comm_avg, max(trade_date) over () as max_week from book_entry_cs1;
      ERROR 1815 (HY000): Internal error: IDB-2021: 'trade_date' is not in GROUP BY clause. All non-aggregate columns in the SELECT and ORDER BY clause must be included in the GROUP BY clause.
      MariaDB [dhall]>

      The error is thrown by tupleaggregatestep.cpp prep2PhasesAggregate() (for this case) during setup. It checks for window functions, but the items inside the window function are erroneously marked as not in a group by. They don't need to be because they're in a window function.

      It uses jobInfo.windowSet to look for window functions. These are entered into the set by WindowFunctionStep::checkWindowFunction(). The parts of the window function are not added.

      Investigation needs to made on whether they should just be added to the windowSet, or should something else be done.

      These queries work in InnoDB.

      Attachments

        Activity

          People

            David.Hall David Hall (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.