Skip to content

Conversation

@pibizza
Copy link
Contributor

@pibizza pibizza commented Oct 30, 2025

This PR introduces two improvements to segment memory handling:

  1. Added isOnlyLiaSegment() helper method to SegmentMemory
  2. Refactored createChildSegments() → initializeChildSegmentsIfNeeded() with simplified signature

@pibizza pibizza marked this pull request as ready for review October 30, 2025 12:44
public SegmentMemory getQuerySegmentMemory(QueryElementNode queryNode);

public void createChildSegments(LeftTupleSinkPropagator sinkProp, SegmentMemory smem);
public void initializeChildSegmentsIfNeeded(SegmentMemory smem);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpic: I would remove the IfNeeded bit from the name of this method (unless you have a good reason to keep it).

Copy link
Contributor Author

@pibizza pibizza Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mariofusco It is to clarify that the method is idempotent - you can call it twice and it won't get extra initailization.

.getLeftTupleSource().isStreamMode());
List<PathMemory> pathsToFlush = LeftInputAdapterNode.doInsertSegmentMemory(wm, true, liaMem, memory.getSegmentMemory(), peer, node
.getLeftTupleSource().isStreamMode() );
wm.getRuleNetworkEvaluator().forceFlushPaths(pathsToFlush);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this force flush necessary now? Did it do this also before in a different way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mariofusco yes. If you see the method called originally was doInsertSegmentMemoryWithFlush. Now it is doInsertSegmentMemory. See changes in LeftInputAdapterNode.

@pibizza pibizza changed the title Segment memory helpers [incubator-kie-issues #203] Cleanup Phreak code - Minor refactoring in SegmentMemory handling Oct 30, 2025
@mariofusco mariofusco merged commit 94ad1ab into apache:main Oct 31, 2025
10 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants