Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-16842

Extended SELECT list contains unusable Item_func_sum when GROUP BY handler is used

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not a Bug
    • 10.2.15
    • N/A
    • Optimizer
    • None

    Description

      Given a query

      select sum(i)+1 from cs1;
      

      There are two elements in the extended SELECT that GROUP BY handler receives: Item_sum for sum(i) and Item_func_sum for sum(i)+1. Item_func_sum has Item_ref as its first argument. In the moment of the query execution this Item_ref references Item_temptable_field. Item_temptable_field corresponds with Item_sum in the SELECT list. This Item_temptable_field has a name attribute = "sum(i)" if the server code is built w/o DBUG_OFF. If DBUG_OFF is present there is no way to correlate this Item_temptable_field with Item_sum that is used by Columnstore semantic parser. Here is the place in sql_select.cc that populates the name attribute in a debug build. Columnstore symantic parser needs a way to correlate this two fields while parsing a query. My suggestion is to remove preprocessor condition if this is cheap in terms of processing overhead.

      Attachments

        Issue Links

          Activity

            It is not a bug, it is how split_sum_func work, it add hidden fields and put reference on them.

            sanja Oleksandr Byelkin added a comment - It is not a bug, it is how split_sum_func work, it add hidden fields and put reference on them.

            Please reopen if you still think that something is wrong, but than I need more explanations what is wrong,

            sanja Oleksandr Byelkin added a comment - Please reopen if you still think that something is wrong, but than I need more explanations what is wrong,
            drrtuy Roman added a comment -

            Please tell me how to find a corresponding Item_func_sum in an extended SELECT list for the mentioned query select sum+1?

            drrtuy Roman added a comment - Please tell me how to find a corresponding Item_func_sum in an extended SELECT list for the mentioned query select sum +1?
            drrtuy Roman added a comment -

            Got an explanation how to correlate Item_field that represents aggregate function with an actual field in an extended SELECT list.

            drrtuy Roman added a comment - Got an explanation how to correlate Item_field that represents aggregate function with an actual field in an extended SELECT list.

            People

              sanja Oleksandr Byelkin
              drrtuy Roman
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.