Re: Monotonic WindowFunc support for ntile(), percent_rank() and cume_dist() - Mailing list pgsql-hackers

From David Rowley
Subject Re: Monotonic WindowFunc support for ntile(), percent_rank() and cume_dist()
Date
Msg-id CAApHDvo1Ti9S7PXAxrHH_9UtQKy+ZC_N__osfVBtmRQUC4e2zw@mail.gmail.com
Whole thread Raw
In response to Re: Monotonic WindowFunc support for ntile(), percent_rank() and cume_dist()  (Melanie Plageman <melanieplageman@gmail.com>)
Responses Re: Monotonic WindowFunc support for ntile(), percent_rank() and cume_dist()
List pgsql-hackers
Thanks for having a look at this.

On Tue, 24 Jan 2023 at 13:26, Melanie Plageman
<melanieplageman@gmail.com> wrote:
> Silly question, but was there any reason these were omitted in the first
> commit?

Good question, it's just that I didn't think of it at the time and
nobody else did or if they did, they didn't mention it.

> Since all three cases are exactly the same code, maybe you could
> macro-ize it and add a single comment?

Hmm, I kinda like that it's being spelt out explicitly. To me, it
seems clean and easy to read. I know we could have fewer lines of code
with something else, but for me, being able to quickly see what the
properties of the WindowFunc are without having to look at some other
function is more important than saving some space in windowfuncs.c

I'd likely feel differently if the code in question didn't all fit on
my screen at once, but it does and I can see at a quick glance that
the function is unconditionally monotonically increasing. Functions
such as COUNT(*) are conditionally monotonically
increasing/decreasing, depending on the frame options.

If you feel strongly about that, then feel free to show me what you
have in mind in more detail so I can think harder about it.

David



pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: Fix GetWALAvailability function code comments for WALAVAIL_REMOVED return value
Next
From: Justin Pryzby
Date:
Subject: Re: Improve logging when using Huge Pages