Hi.

The attached patch refactors absorbability helper functions, white at
it, also other misc changes.
It's still based on https://github.com/assam258-5892/postgres/commits/RPR

The below is commit message:
----------------------------------------------------------------------------
Rename isUnboundedStart() to start_with_unbounded_quantifier() and
isFixedLengthChildren() to isFixedQuantifier() for clarity.

Rework start_with_unbounded_quantifier() to accept an RPRPatternElement *
directly instead of an index, and restructure its body as an explicit
if/else chain over element kinds (VAR, BEGIN, ALT/FIN, END) rather than
two loosely-coupled early-return checks.

Fix subgroup traversal in isFixedQuantifier() to use elem->jump - 1 to
locate the matching END element directly, replacing the previous loop
that walked next pointers.

Move isAbsorbable initialization from finalizeRPRPattern() into
makeRPRPattern(), and guard the computeAbsorbabilityRecursive() call in
computeAbsorbability() so it is only entered when the first element is
an ALT or has an unbounded quantifier.

Use palloc_array/palloc0_array in makeRPRPattern(). Remove the redundant
"T_RPRPattern" comment on the NodeTag field. Update README.rpr and
in-code comments to reflect the new function names.
----------------------------------------------------------------------------



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

Attachment: v50-0001-refactor-absorbability-helper-functions.nocfbot
Description: Binary data

Reply via email to