Re: Row pattern recognition

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: assam258(at)gmail(dot)com, zsolt(dot)parragi(at)percona(dot)com, sjjang112233(at)gmail(dot)com, vik(at)postgresfriends(dot)org, er(at)xs4all(dot)nl, jacob(dot)champion(at)enterprisedb(dot)com, david(dot)g(dot)johnston(at)gmail(dot)com, peter(at)eisentraut(dot)org, li(dot)evan(dot)chao(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Row pattern recognition
Date: 2026-10-21 13:33:12
Message-ID: CACJufxFEwTRc4JEbRoYVWPYE-KM6B=7qWYtg6SpsZHfA2U3fWw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

based on https://github.com/assam258-5892/postgres/tree/RPR-20260930
I have made some non-trivial refactoring in nodeWindowAgg.c, see attached.

The attached patch commit message is as follows:
================
Separate resolving the reduced frame from consuming it

ExecWindowAgg() resolves the reduced frame for every row it emits,
by calling
ensure_reduced_frame() before any window function or aggregate
runs; that is the
only place the match is driven. Everything after it should only
consumes the
recorded match through get_reduced_frame_status(), which reports how any row
position relates to it.

row_is_in_reduced_frame should be removed.

row_is_in_reduced_frame() blurred that division: it re-ran
ensure_reduced_frame() and then get_reduced_frame_status() again,
so consumers
looked as if they might resolve the match themselves.

While at it, I found the change to WinGetFuncArgInFrame() hard to
review: the
new WinGetSlotInFrame() mixes RPR logic into the existing frame
code. IGNORE
NULLS already it's own function: ignorenulls_getfuncarginframe().
Similarly we
can left WinGetFuncArgInFrame() unchanged (same as the master
branch) and moved the RPR logic into a
dedicated function, WinGetFuncArgInReducedFrame(). That
duplicates some code,
but the result is much cleaner, and I think the duplication is worth it.

================

--
jian
https://www.enterprisedb.com/

Attachment Content-Type Size
v55-0001-Separate-resolving-the-reduced-frame-from-consuming-it.txt text/plain 30.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mario González 2026-10-21 13:35:39 Re: pg_get_*_ddl() needs a redesign
Previous Message Harrison Booth 2026-10-21 13:24:12 Re: meson: pass OpenSSL/ICU include dirs to extensions