Hi Henson,
> Hi Ishii-san,
>
> Thank you for raising the frame boundary concern. You're right that
> different contexts have different frame boundaries.
Ok.
> Your suggestion was to use row_is_in_frame() to check frame boundaries
> for each row. However, I took a simpler approach: just disable context
> absorption entirely when the frame is limited.
>
> The root cause is that context absorption assumes all contexts see
> the same rows. With limited frames, each context starting at a different
> row has a different visible range, so we cannot absorb one context into
> another.
>
> As I mentioned before, I think we should use absorption conservatively
> for now - only in cases where it's clearly safe (e.g., A* at the
> beginning of the pattern). We can extend it later through more in-depth
> research.
Agreed.
> The fix:
>
> if (winstate->rpSkipTo == ST_PAST_LAST_ROW && !hasLimitedFrame)
> nfa_absorb_contexts(winstate, targetCtx, currentPos);
>
> I added a test case to verify this:
[snip]
> I'm attaching three related commits:
>
> 1. Row pattern recognition: Improve NFA state memory management
>
> This commit refactors NFA state management for better readability
> and maintainability.
>
> 2. Row pattern recognition: Disable context absorption for limited frame
>
> This commit further restricts absorption: even with SKIP PAST LAST ROW,
> absorption is disabled when the frame is limited. With limited frames,
> different contexts have different frame boundaries, making absorption
> unsafe.
I have applied the patches on top of v38 to create v39 patches.
In addition to these patches, I have made following changes:
- Add check for frame option "EXCLUDE". With RPR, using EXCLUDE is not
permitted by the SQL standard. A test case added.
- Remove unused typedef from windowfuncs.c (which causes removal of the
typedef from typedes.list). The typedef was accidentally left by me
while developing RPR.
- Update the Copyright year to 2026 in some newly added files.
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp