[MDEV-11263] Aggregate Window Functions Created: 2016-11-09 Updated: 2021-03-19 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Optimizer - Window functions, Stored routines |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor |
| Reporter: | Varun Gupta (Inactive) | Assignee: | Sergei Petrunia |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | gsoc18, gsoc19, gsoc20 | ||
| Issue Links: |
|
||||||||
| Sprint: | 10.2.4-4 | ||||||||
| Description |
|
With a few exceptions, most native aggregate functions are supported as window functions. In An example of a creating a custom aggregate function is given below:
This functions can be used in the following query:
After this task is complete the following must also work:
|
| Comments |
| Comment by Harman Wadhwa [ 2019-03-04 ] | ||||||||||
|
Hi Varun, | ||||||||||
| Comment by Varun Gupta (Inactive) [ 2019-03-05 ] | ||||||||||
|
Hi Harman, An example would be 1) create an aggregate function (this is already done)
2) Execute the aggregate function as a window function [This needs to be done]
| ||||||||||
| Comment by Harman Wadhwa [ 2019-03-05 ] | ||||||||||
|
Hi Varun, | ||||||||||
| Comment by Varun Gupta (Inactive) [ 2019-03-05 ] | ||||||||||
|
Here is the list of aggregate functions that work as window function One can implement any aggregate function using STORED AGGREGATE FUNTIONS, for example the above example agg_sum is created to behave like the SUM aggregate function. This motivation for this project is to execute any STORED AGGREGATE FUNCTION like agg_sum as a WINDOW FUNCTION. | ||||||||||
| Comment by KHAMAR ALI SHAIKH [ 2019-03-24 ] | ||||||||||
|
Hi Varun Gupta ,i am a student from RV college of Engineering Banglore. I m interested to take this user story as my task for GSOC 2019. Please guide me with further proceedings. | ||||||||||
| Comment by Vicențiu Ciorbaru [ 2019-03-25 ] | ||||||||||
|
Hi khamar It's good that you are interested in GSoC projects! varun has provided some hints above. I suggest you get comfortable with our regular stored user defined aggregate functions, like the one Varun posted in a previous comment. There are plenty of places in the code that this project will touch upon. I can recommend you start looking into the Item_sum class and particularly subclasses of it like Item_sum_sum. These classes represent aggregate functions stored internally within the server. For example:
for the sum() function, an Item_sum_sum will be created. These classes support the "add" method, which is used to pass values to an accumulator. I recommend you set up a debugger for MariaDB, follow the steps here to get started: https://mariadb.org/get-involved/getting-started-for-developers/get-code-build-test/ Then run the queries above and put a breakpoint into Item_sum_sum::add. This will get you started with stepping into our regular aggregate functions. After you see the flow for this bit of code, you need to also test with Item_sum_sp::add method. You can do this by: Create a custom aggregate function like the one Varun showed above. There's quite a bit of code there, but if you manage to get to this point, then we can discuss more. Feel free to ask any questions if you get stuck in the meantime. | ||||||||||
| Comment by Arhant Jain [ 2019-03-26 ] | ||||||||||
|
Thanks Vicentiu Please clarify me. | ||||||||||
| Comment by Vicențiu Ciorbaru [ 2019-03-29 ] | ||||||||||
|
Hi Arhant You can find the classes using your IDE's search feature or a regular expression search tool like grep, ack, etc. I suggested in my previous post to investigate the add() method and try to figure out how it is used inside the server. Did you manage to set up a breakpoint and have the debugger stop at it when a query to the server is issued? What did you try to do so far? Providing more details as to what actually got you stuck will help in getting a more coherent reply | ||||||||||
| Comment by Tavneet Singh [ 2020-03-22 ] | ||||||||||
|
Hi Varun and Vincent, was any progress made on this issue during the last iteration ? I have built the project and will start looking at the window and aggregate functions touch points in the code. I will also pick up a recent beginner friendly task to get familiar with the codebase. | ||||||||||
| Comment by Vicențiu Ciorbaru [ 2020-03-23 ] | ||||||||||
|
tavneet No progress has been done since last GSoC. Feel free to have a look and ask any questions you might have. I recommend sending an email to maria-developers mailing list. You stand a much higher chance of getting a reply there, rather than though JIRA only. | ||||||||||
| Comment by Tavneet Singh [ 2020-03-28 ] | ||||||||||
|
Hi @Vicențiu Ciorbaru @Varun, I have set up the debugger and have some idea about the code flow for the regular aggregate function (sum) and the custom aggregate function posted by Varun. I had a couple of queries which I have asked on the email and I am also posting here.
|