-
Couldn't load subscription status.
- Fork 13.7k
[FLINK-38566] Support CEP DSL #27152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
@flinkbot run azure |
|
Hi @tillrohrmann @dianfu , do you have time to look at this feature? |
|
@kaori-seasons Thanks for the PR, but without a FLIP we shouldn't just add a new API. |
@MartijnVisser Hello, thank you for your reminder. This is my question. Can you please add editing permissions for Confluence for me? My JIRA account is complone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the pattern of generating the API from a grammar. Some thoughts:
- As this is introducing a new dsl API- I think this new feature should have a Flip
- The Flip talks about migrating from the pattern API to the new dsl based API - but there is a no documentation describing the new API or the migration process.
What is the purpose of the change
Related to FLINK-38566
Flink CEP DSL Module
This module provides a Domain-Specific Language (DSL) for Apache Flink's Complex Event Processing (CEP) library, making it easier to define pattern matching logic without verbose Java code.
Features
Quick Start
Maven Dependency
The DSL is included in the standard
flink-cepmodule:Basic Example
DSL Syntax
Conditions
Pattern Sequencing
Quantifiers
Event Correlation
"Start(userId > 0) -> End(userId = Start.userId and value > 50)"Time Windows
Skip Strategies
Advanced Usage
Custom Event Adapters
For non-POJO events or custom attribute extraction:
Map-Based Events
Builder API
Architecture
Core Components
DslCompiler: Main API entry pointEventAdapter: Interface for event attribute extractionDslPatternTranslator: ANTLR listener that builds Flink PatternsDslCondition: CEP condition implementationDslExpression: Single expression evaluatorPackage Structure
Examples
Complex Pattern
Error Handling
Best Practices
Compatibility
Performance
The DSL compiler performs one-time parsing during job initialization. Runtime performance is identical to hand-written Pattern API code, as the DSL compiles down to the same Pattern objects.
Troubleshooting
Common Errors
Syntax Error
→ Check DSL syntax against reference
Attribute Not Found
→ Verify attribute names match event fields/getters
Type Mismatch
→ Ensure operators match attribute types
Migration from Pattern API
Before (Pattern API)
After (DSL)
Brief change log
Migration from Pattern API
Before (Pattern API)
After (DSL)
Verifying this change
Please make sure both new and modified tests in this PR follow the conventions for tests defined in our code quality guide.
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (yes / no)Documentation