Skip to content

add support for more MySQL aggregate functions and improve their handling.#1188

Open
abdala-elgendy wants to merge 3 commits into
sqlancer:mainfrom
abdala-elgendy:mysql-aggregat-supp
Open

add support for more MySQL aggregate functions and improve their handling.#1188
abdala-elgendy wants to merge 3 commits into
sqlancer:mainfrom
abdala-elgendy:mysql-aggregat-supp

Conversation

@abdala-elgendy

@abdala-elgendy abdala-elgendy commented Mar 26, 2025

Copy link
Copy Markdown

I've made to improve the handling of aggregate functions in MySQL queries:

  1. Added support for window functions:
    Added a new generateWindowSpecification() method that creates window function specifications
    Window specifications can include:
    PARTITION BY clause
    ORDER BY clause
    Frame clause (ROWS or RANGE based)

  2. Enhanced aggregate function handling:
    Added tracking of whether a window function has been generated
    Randomly decides whether to add a window specification to aggregate functions

  3. Improved query generation:
    Better handling of GROUP BY clauses when aggregates are present
    Proper tracking of columns for grouping
    Support for HAVING clauses with aggregate conditions

Example for generated queries now
Query with Both Aggregates and Window Functions

SELECT columnn1, COUNT(DISTINCT column2), GROUP_CONCAT(column3) OVER (PARTITION BY column4), MAX(column5) OVER (ORDER BY column6 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM table1 GROUP BY column7, column8 HAVING SUM(column9) > 1000 ORDER BY column10 ASC LIMIT 20;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant