Skip to content

[FLINK-37586][udf] Add support for options in user-defined functions and update related documentation#4252

Merged
lvyanquan merged 4 commits into
apache:masterfrom
Hisoka-X:FLINK-37586-yaml
Mar 5, 2026
Merged

[FLINK-37586][udf] Add support for options in user-defined functions and update related documentation#4252
lvyanquan merged 4 commits into
apache:masterfrom
Hisoka-X:FLINK-37586-yaml

Conversation

@Hisoka-X
Copy link
Copy Markdown
Member

This close https://issues.apache.org/jira/browse/FLINK-37586

This pull request adds support for passing configuration options to user-defined functions (UDFs) in pipeline definitions. It updates both the YAML schema and the internal Java representations to allow specifying an options block for each UDF, making these options available at runtime. The documentation is updated to explain how to use this feature, and new tests are added to ensure correct parsing and handling.

@github-actions github-actions Bot added docs Improvements or additions to documentation composer cli labels Jan 31, 2026
@Hisoka-X
Copy link
Copy Markdown
Member Author

Hisoka-X commented Feb 3, 2026

cc @yuxiqian

Comment thread docs/content.zh/docs/core-concept/transform.md
@Hisoka-X Hisoka-X requested a review from yuxiqian March 4, 2026 08:40
Copy link
Copy Markdown
Member

@yuxiqian yuxiqian left a comment

Choose a reason for hiding this comment

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

LGTM overall.

+@lvyanquan as it is related to public API change.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for passing configuration options to user-defined functions (UDFs) in Flink CDC pipeline definitions. Previously, UDFs could be registered but had no way to receive external configuration at startup.

Changes:

  • Extended UdfDef class with an options field, new constructor, and updated equals/hashCode/toString
  • Updated the YAML parser to read the new options block for UDFs, and fixed TransformTranslator to pass these options through (previously it always passed an empty HashMap)
  • Added example UDF implementations (Java and Scala), new test YAML fixture and unit/integration tests, and documentation in both English and Chinese

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
flink-cdc-composer/src/main/java/.../definition/UdfDef.java Adds options map field with constructor overloads and updated equals/hashCode/toString
flink-cdc-composer/src/main/java/.../translator/TransformTranslator.java Passes actual UDF options instead of an empty HashMap
flink-cdc-cli/src/main/java/.../parser/YamlPipelineDefinitionParser.java Parses optional options block from YAML UDF definitions
flink-cdc-cli/src/test/java/.../YamlPipelineDefinitionParserTest.java Adds test for parsing UDF definitions with options
flink-cdc-cli/src/test/resources/definitions/pipeline-definition-with-udf-options.yaml Test YAML fixture with options block for a UDF
flink-cdc-composer/src/test/java/.../FlinkPipelineUdfITCase.java Integration test for configurable UDFs using options
flink-cdc-pipeline-udf-examples/.../java/ConfigurableFunctionClass.java Java example UDF that reads options via ConfigOptions
flink-cdc-pipeline-udf-examples/.../scala/ConfigurableFunctionClass.scala Scala example UDF that reads options via ConfigOptions
flink-cdc-e2e-tests/.../rules/unexpected.yaml Updates the allowed-keys error message to include options
docs/content/docs/core-concept/transform.md English documentation for the new options feature
docs/content.zh/docs/core-concept/transform.md Chinese documentation for the new options feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/content/docs/core-concept/transform.md
Comment thread docs/content.zh/docs/core-concept/transform.md Outdated
Copy link
Copy Markdown
Contributor

@lvyanquan lvyanquan left a comment

Choose a reason for hiding this comment

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

LGTM.

@lvyanquan lvyanquan merged commit a19fdfe into apache:master Mar 5, 2026
30 of 31 checks passed
ThorneANN pushed a commit to ThorneANN/flink-cdc that referenced this pull request Mar 6, 2026
suhwan-cheon pushed a commit to suhwan-cheon/flink-cdc that referenced this pull request Mar 9, 2026
ThorneANN pushed a commit to ThorneANN/flink-cdc that referenced this pull request Mar 19, 2026
Mrart pushed a commit to Mrart/flink-cdc that referenced this pull request Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants