• Sergei Petrunia's avatar
    MDEV-15178: Filesort::make_sortorder: Assertion `pos->field != __null | · f18c2b6c
    Sergei Petrunia authored
    (Initial patch by Varun Gupta. Amended and added comments).
    
    When the query has both
    1. Aggregate functions that require sorting data by group, and
    2. Window functions
    
    we need to use two temporary tables. The first temp.table will hold the
    join output.  Then it is passed to filesort(). Reading it in sorted
    order allows to compute the aggregate functions.
    
    Then, we need to write their values into the second temp. table. Then,
    Window Function computation step can pass that to filesort() and read
    them in the order it needs.
    
    Failure to create the second temp. table would cause an assertion
    failure: window function could would not find where to get the values
    of the aggregate functions.
    f18c2b6c
item_sum.h 61.8 KB