[FLINK-40409][runtime] CDC YAML supports inline Python UDF definition - #4501
[FLINK-40409][runtime] CDC YAML supports inline Python UDF definition#4501yuxiqian wants to merge 2 commits into
Conversation
747d2b6 to
3bd3731
Compare
|
Kindly ping @lvyanquan @haruki-830 if you're interested. |
3bd3731 to
fe9d404
Compare
There was a problem hiding this comment.
Pull request overview
Adds inline Python UDF definitions to YAML pipelines using Pemja.
Changes:
- Adds Python UDF execution and return-type inference.
- Extends YAML parsing, UDF context, and runtime bindings.
- Adds packaging, CI, tests, and bilingual documentation.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
pom.xml |
Registers the Python module. |
flink-cdc-runtime/.../TransformParserTest.java |
Updates generated UDF bindings. |
flink-cdc-runtime/.../UserDefinedFunctionDescriptorTest.java |
Tests option-aware return types. |
flink-cdc-runtime/.../JaninoCompiler.java |
Generates name-based UDF calls. |
flink-cdc-runtime/.../UserDefinedFunctionDescriptor.java |
Supplies UDF configuration context. |
flink-cdc-runtime/.../TransformExpressionCompiler.java |
Declares name-based evaluator parameters. |
flink-cdc-python/.../PythonUdfSignatureTest.java |
Tests signature inference errors. |
flink-cdc-python/.../PemjaTestSupport.java |
Configures Pemja tests. |
flink-cdc-python/.../PythonUdfTest.java |
Tests execution and dependencies. |
flink-cdc-python/.../signature.py |
Parses Python return annotations. |
flink-cdc-python/.../PythonUdfSignature.java |
Maps annotations to CDC types. |
flink-cdc-python/.../PythonUdf.java |
Implements Python-backed UDFs. |
flink-cdc-python/pom.xml |
Defines and shades Pemja dependency. |
flink-cdc-e2e-tests/.../unexpected.yaml |
Updates accepted YAML keys. |
flink-cdc-e2e-tests/.../python_udf_test.sql |
Adds database fixtures. |
flink-cdc-e2e-tests/.../PythonUdfE2eITCase.java |
Tests Python UDF pipelines end to end. |
flink-cdc-dist/pom.xml |
Packages Python support. |
flink-cdc-common/.../UserDefinedFunction.java |
Adds context-aware return typing. |
flink-cdc-cli/.../pipeline-definition-with-python-udf.yaml |
Adds parser fixture. |
flink-cdc-cli/.../YamlPipelineDefinitionParserTest.java |
Tests Python YAML validation. |
flink-cdc-cli/.../YamlPipelineDefinitionParser.java |
Parses inline Python UDF fields. |
docs/content/.../transform.md |
Documents Python UDFs in English. |
docs/content.zh/.../transform.md |
Documents Python UDFs in Chinese. |
.github/workflows/modules.py |
Adds the module to core CI. |
.github/workflows/flink_cdc_base.yml |
Installs Python and Pemja in CI. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| this.interpreter = new PythonInterpreter(pemjaConfigBuilder.build()); | ||
| this.interpreter.exec(source); |
There was a problem hiding this comment.
Hi, @yuxiqian.
The issues previously raised by Copilot may be less likely to occur in our Pipeline use case.
However, resource cleanup is worth further attention because we need to extract Python files, and Flink
does not centrally clean up the java.io.tmpdir directory. We should ensure that no temporary files are
left behind.
There was a problem hiding this comment.
Fixed. But we may have no chance to clean-up resources if native error occurs and JVM crashes.
As java.io.tmpdir usually points to /tmp where files are not written to disks, it might be acceptable.
|
It would be better if you could create a jira issue to track this as we may include this feature in the release notes. |
Add the Pemja-backed Python UDF runtime, inline YAML API, distribution packaging, documentation, and test coverage. Generated-by: Codex (gpt-5.6-sol) Co-Authored-By: Codex <noreply@openai.com> AI-Model: gpt-5.6-sol AI-Contributed/Feature: 226/797 AI-Contributed/UT: 185/944
Co-Authored-By: Codex <noreply@openai.com> AI-Model: gpt-5.6-sol AI-Contributed/Feature: 48/48 AI-Contributed/UT: 48/48
921403f to
b894154
Compare
This PR adds support for defining inline Python UDFs in YAML pipeline jobs:
The wrapper itself is implemented as a Java UDF as well. No changes are made in the existing framework except the following:
Was generative AI tooling used to co-author this PR?
Generated-by: Codex (gpt-5.6-sol)