• Vicențiu Ciorbaru's avatar
    MDEV-10859: Wrong result of aggregate window function in query with HAVING and no ORDER BY · 9fe9fb68
    Vicențiu Ciorbaru authored
    Window functions need to be computed after applying the HAVING clause.
    An optimization that we have for regular, non-window function, cases is
    to apply having only during sending of the rows to the client. This
    allows rows that should be filtered from the temporary table used to
    store aggregation results to be stored there.
    
    This behaviour is undesireable for window functions, as we have to
    compute window functions on the result-set after HAVING is applied.
    Storing extra rows in the table leads to wrong values as the frame
    bounds might capture those -to be filtered afterwards- rows.
    9fe9fb68
win.result 57.6 KB