On Fri, Jul 3, 2026 at 8:36 AM jian he <[email protected]> wrote:
>
> Hi.
>
> ``The actual mark is set to: min(lookback_mark, lookahead_mark).``
> in README.rpr need update?
>
> The attached patch is still based on
> https://github.com/assam258-5892/postgres/commits/RPR.
>
> v50-0001-Refactor-visit_nav_plan.partial
> v50-0002-Refactor-visit_nav_exec.partial
> v50-0003-no-need-compile-and-evaluate-offset-in-expression-evaluation.partial
> v50-0004-misc.partial
> v50-0001-Evaluate-navigation-offset-once-at-one-place.nocfbot
>
> The ".partial" patch, when combined, contains the same content as the
> single patch (v50-0001-Evaluate-navigation-offset-once-at-one-place.nocfbot).
> (I first created separated patches, but then I felt the whole change
> focuses on one main topic, so merging them made sense to me).
>
> The commit message for the main patch
> (v50-0001-Evaluate-navigation-offset-once-at-one-place.nocfbot) is
> below:
> ------------------------------------------------
Hi.

While at it, I found nav_traversal_walker is a little bit of
complicated (overkill).
So the attached patch is removing nav_traversal_walker.

Two files are attached:
v50-0001-Evaluate-navigation-offset-once-at-one-place.nocfbot
v50-0002-Drop-the-shared-nav_traversal_walker-for-RPR-DEFINE.nocfbot

v50-0001 is the same as posted in [1].
v50-0002 is built on top of v50-0001. Even without v50-0001,
I think the changes in v50-0002 still make sense, as they improve readability.

The commit message for v50-0002 is below:
------------------------------------------------
Subject: [PATCH v50 2/2] Drop the shared nav_traversal_walker for RPR DEFINE

Both visit_nav_exec() and visit_nav_plan() assert:

    Assert(nav->arg == NULL || !IsA(nav->arg, RPRNavExpr));
    Assert(nav->offset_arg == NULL || !IsA(nav->offset_arg, RPRNavExpr));
    Assert(nav->compound_offset_arg == NULL ||
           !IsA(nav->compound_offset_arg, RPRNavExpr));

so an RPRNavExpr is never nested inside another RPRNavExpr, and the expressions
that contain RPRNavExpr nodes are not complicated.  For that, the generic
nav_traversal_walker() -- a NavTraversal struct carrying a function pointer and
a void* context, shared between the planner and the executor is kind of
complicated.

Replace it with static RPRNavExpr_walker() in each site.  RPRNavExpr_walker will
finds RPRNavExpr nodes, and acts on them the way it wants.  Having a small
duplicated static walker in the two files is fine here, nodeWindowAgg.c no
longer need to include "optimizer/rpr.h".

rename visit_nav_plan to compute_matchStartDependent,
rename visit_nav_exec to compute_nav_offsets.
------------------------------------------------
[1]: 
https://www.postgresql.org/message-id/CACJufxFfMJAMc0R6g4f7Bwr47QDY%2BOBr2vzqqMRbCzjdD9vR2g%40mail.gmail.com



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

Attachment: v50-0002-Drop-the-shared-nav_traversal_walker-for-RPR-DEFINE.nocfbot
Description: Binary data

Attachment: v50-0001-Evaluate-navigation-offset-once-at-one-place.nocfbot
Description: Binary data

Reply via email to