[PR #6500] Allow internal functions to be overridden. #10008

Closed
opened 2026-01-22 16:06:08 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/6500

State: closed
Merged: Yes


Background

This came about because we're writing a driver for PrestoDB and wanted to implement windowing for the aggregate functions. This is fine for anything new, but we struggled when trying to add windowing support for count, avg, etc ...

All Aggregate Functions can be used as window functions by adding the OVER clause. The aggregate function is computed for each row over the rows within the current row’s window frame.

Source: 6.15. Window Functions — Presto 0.178 Documentation

Solution

Obvious solution for us was to have the ability to override the internal aggregate functions. We moved the internal aggregate functions into the $_NUMERIC_FUNCTIONS property so they can be overridden; They were handled as a special case before.

The only part we weren't sure of was the dctrn alias used: https://github.com/SamKnows/doctrine2/pull/1/files#diff-0c8825d1265a66bb8b20f3d99c276961

If that doesn't matter and we can go with sclr, then this is another path that can be removed.

Thoughts?

PS. First big PR for the Doctrine internals 👍

**Original Pull Request:** https://github.com/doctrine/orm/pull/6500 **State:** closed **Merged:** Yes --- Background ------------ This came about because we're writing a driver for [PrestoDB](https://prestodb.io) and wanted to implement windowing for the aggregate functions. This is fine for anything new, but we struggled when trying to add windowing support for count, avg, etc ... > All Aggregate Functions can be used as window functions by adding the OVER clause. The aggregate function is computed for each row over the rows within the current row’s window frame. Source: [6.15. Window Functions — Presto 0.178 Documentation](https://prestodb.io/docs/current/functions/window.html) Solution -------- Obvious solution for us was to have the ability to override the internal aggregate functions. We moved the internal aggregate functions into the `$_NUMERIC_FUNCTIONS` property so they can be overridden; They were handled as a special case before. The only part we weren't sure of was the `dctrn` alias used: https://github.com/SamKnows/doctrine2/pull/1/files#diff-0c8825d1265a66bb8b20f3d99c276961 If that doesn't matter and we can go with `sclr`, then this is another path that can be removed. Thoughts? PS. First big PR for the Doctrine internals 👍
admin added the pull-request label 2026-01-22 16:06:08 +01:00
admin closed this issue 2026-01-22 16:06:08 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#10008