rosemarYuan opened a new pull request, #821: URL: https://github.com/apache/flink-agents/pull/821
<!-- * Thank you very much for contributing to Flink Agents. * Please add the relevant components in the PR title. E.g., [api], [runtime], [java], [python], [hotfix], etc. --> <!-- Please link the PR to the relevant issue(s). Hotfix doesn't need this. --> Linked issue: #754 > **Stacked PR** — this PR is based on [#756](https://github.com/apache/flink-agents/pull/756) (API changes). Please review the [incremental diff against PR1](https://github.com/apache/flink-agents/compare/feature/event-type-and-action-trigger-unification...rosemarYuan:flink-agents:pr2/java-cel-implementation), not `main`. ### Purpose of change This is the second PR in the four-PR stack tracked by #754: 1. #756 — API changes (under review) 2. **This PR** — Java CEL runtime 3. Python CEL runtime (planned) 4. Documentation (planned) It adds the Java-side CEL runtime for `@Action` trigger conditions, enabling actions to filter events by field-level CEL expressions (e.g. `event.tokenCount > 100`). Key components: - **Plan-time classifier** (`PlanCelClassifier`): distinguishes bare event-type identifiers (fast-path `TypeMatch`) from CEL expressions (`CelExpression`) at plan construction time. - **AST rewriter** (`AstRewriter`): folds constants, normalizes identifiers, qualifies bare names, and rebuilds `has()` calls to canonical form. - **CEL macro whitelist** (`CelMacroPolicy`): only `has()` is allowed; `exists`, `exists_one`, `all`, `filter`, `map` are rejected with a clear error message. - **Expression facade** (`CelExpressionFacade`): wraps cel-java with a process-wide LRU program cache, handling compilation and evaluation. - **Condition evaluator** (`CelConditionEvaluator`): evaluates a `ParsedCondition` against an event payload, resolving `TypeMatch` via direct string comparison and `CelExpression` via the facade. - **Action router** (`ActionRouter`): two-phase routing — typed-index fast path for `TypeMatch` conditions, CEL slow path for expressions, with deduplication across both phases. - **Operator integration**: `ActionExecutionOperator` / `EventRouter` updated to use `ActionRouter` for dispatch. ### Tests - `PlanCelClassifierTest`, `ParsedConditionTest`, `ActionParsedConditionsTest`, `ActionConstructionFailureTest` — plan-layer unit tests - `CelExpressionFacadeTest`, `CelConditionEvaluatorTest`, `AstRewriterTest`, `ActionRouterTest`, `CelResourceLimitsTest` — runtime-layer unit tests - `ActionJsonSerializerTest`, `ActionJsonDeserializerTest` — serialization round-trip including legacy `listen_event_types` fallback - Cross-language conformance fixtures (`cel_conformance_cases.yaml`, `disallowed_macros.yaml`) + CI workflow (`.github/workflows/cel-conformance.yml`) ### API No new public API beyond what was introduced in #756. This PR adds runtime internals only. ### Documentation - [ ] `doc-needed` <!-- Your PR changes impact docs --> - [x] `doc-not-needed` <!-- Your PR changes do not impact docs --> (documentation will be covered in PR4) - [ ] `doc-included` <!-- Your PR already contains the necessary documentation updates --> -- 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]
