v50-0003-replace-EMPTY_LOOP-to-RPR_ELEM_EMPTY_LOOP.nocfbot
application/octet-stream
Filename: v50-0003-replace-EMPTY_LOOP-to-RPR_ELEM_EMPTY_LOOP.nocfbot
Type: application/octet-stream
Part: 1
Message:
Re: Row pattern recognition
From e0cbfc341d36f1c8d528a3be32739d37a32a6c92 Mon Sep 17 00:00:00 2001
From: jian he <jian.universality@gmail.com>
Date: Thu, 2 Jul 2026 11:51:57 +0800
Subject: [PATCH v50 3/3] replace EMPTY_LOOP to RPR_ELEM_EMPTY_LOOP
EMPTY_LOOP occurs infrequently, so I'd prefer using the full name,
RPR_ELEM_EMPTY_LOOP. I think it improves readability.
Based on https://github.com/assam258-5892/postgres/commits/RPR
---
src/backend/executor/README.rpr | 4 ++--
src/backend/executor/execRPR.c | 6 +++---
src/test/regress/expected/rpr_nfa.out | 2 +-
src/test/regress/sql/rpr_nfa.sql | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/backend/executor/README.rpr b/src/backend/executor/README.rpr
index 9275e265d4..604e34d97b 100644
--- a/src/backend/executor/README.rpr
+++ b/src/backend/executor/README.rpr
@@ -1642,7 +1642,7 @@ C-7. PATTERN ((A+ B | C*)+ D) -- Per-branch absorption in ALT
2 A 2 1 INF 3 4 ABSORBABLE | ABSORBABLE_BRANCH
3 B 2 1 1 5 -1
4 C 2 0 INF 5 -1 ABSORBABLE | ABSORBABLE_BRANCH
- 5 END 0 1 INF 6 1 EMPTY_LOOP
+ 5 END 0 1 INF 6 1 RPR_ELEM_EMPTY_LOOP
6 D 0 1 1 7 -1
7 FIN 0 1 1 -1 -1
@@ -1651,7 +1651,7 @@ C-7. PATTERN ((A+ B | C*)+ D) -- Per-branch absorption in ALT
Branch 2: C* matches Case 1 -> C gets ABSORBABLE.
Both A and C get ABSORBABLE_BRANCH as part of their respective branch
paths.
- END has EMPTY_LOOP: branch 2 (C*) is nullable, making the group body
+ END has RPR_ELEM_EMPTY_LOOP: branch 2 (C*) is nullable, making the group body
nullable.
BEGIN and ALT get ABSORBABLE_BRANCH (on the path to absorbable elements).
diff --git a/src/backend/executor/execRPR.c b/src/backend/executor/execRPR.c
index a85ab563ab..0730928fec 100644
--- a/src/backend/executor/execRPR.c
+++ b/src/backend/executor/execRPR.c
@@ -1181,9 +1181,9 @@ nfa_advance_end(WindowAggState *winstate, RPRNFAContext *ctx,
/*
* Unlike the must-exit path, no isAbsorbable update is needed:
- * the fast-forward path runs only for EMPTY_LOOP (nullable)
- * groups, which are never inside an absorbable region, so
- * isAbsorbable is already false here.
+ * the fast-forward path runs only for RPR_ELEM_EMPTY_LOOP
+ * (nullable) groups, which are never inside an absorbable region,
+ * so isAbsorbable is already false here.
*/
/* END->END: increment outer END's count */
diff --git a/src/test/regress/expected/rpr_nfa.out b/src/test/regress/expected/rpr_nfa.out
index 22d244707c..47c31096f6 100644
--- a/src/test/regress/expected/rpr_nfa.out
+++ b/src/test/regress/expected/rpr_nfa.out
@@ -1290,7 +1290,7 @@ ORDER BY id;
-- Doubly-nested reluctant nullable group: (((A??){2,}?){2,}?). Reluctant
-- quantifiers disable optimizer flattening, so both levels survive and the
-- inner group's END->next lands on the outer END. This exercises the
--- END->END count increment in the EMPTY_LOOP fast-forward (count < min).
+-- END->END count increment in the RPR_ELEM_EMPTY_LOOP fast-forward (count < min).
WITH t(id, isa) AS (VALUES (1, true), (2, true), (3, false))
SELECT id, count(*) OVER w AS c
FROM t
diff --git a/src/test/regress/sql/rpr_nfa.sql b/src/test/regress/sql/rpr_nfa.sql
index 79f9992287..76f2a1ba0c 100644
--- a/src/test/regress/sql/rpr_nfa.sql
+++ b/src/test/regress/sql/rpr_nfa.sql
@@ -915,7 +915,7 @@ ORDER BY id;
-- Doubly-nested reluctant nullable group: (((A??){2,}?){2,}?). Reluctant
-- quantifiers disable optimizer flattening, so both levels survive and the
-- inner group's END->next lands on the outer END. This exercises the
--- END->END count increment in the EMPTY_LOOP fast-forward (count < min).
+-- END->END count increment in the RPR_ELEM_EMPTY_LOOP fast-forward (count < min).
WITH t(id, isa) AS (VALUES (1, true), (2, true), (3, false))
SELECT id, count(*) OVER w AS c
FROM t
--
2.34.1