mdproctor opened a new issue, #6718:
URL: https://github.com/apache/incubator-kie-drools/issues/6718
## Problem
`RuleDescriptor` stores filters as `List<Object> filters` where
`filters.get(i)` implicitly corresponds to `sources.get(i)`. The distinction
between an alpha filter (single-fact, per-slot) and a beta filter (post-join,
multi-fact) is determined at wire time via reflection — `isMultiFactFilter()`
inspects the predicate's `test()` parameter count.
This means:
- A `filter((p, n) -> ...)` after a 2-source join is stored at index 1 with
no structural marker distinguishing it from a single-fact filter on source 1
- The alpha/beta distinction is implicit and fragile — determined by arity
inspection, not by the DSL's structural intent
- `List<Object>` provides no type safety
## Fix approach
Make the distinction explicit at storage time in `RuleBuilder`. Options:
**Option A — separate fields:**
- `List<Object> slotFilters` — one entry per source slot (alpha, single-fact)
- `Object postJoinFilter` — optional beta filter applied after the join
(nullable)
**Option B — sealed interface:**
```java
sealed interface Filter<CTX> permits SlotFilter, PostJoinFilter {}
record SlotFilter<CTX>(int slot, Object predicate) implements Filter<CTX> {}
record PostJoinFilter<CTX>(Object predicate) implements Filter<CTX> {}
```
Either approach eliminates the reflection-based arity detection in
`ReteEngine`/`BruteForceCompiledEngine`.
Refs #6712
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]