Skip to content

[FLINK-38996][transform] Enhance error messages for projection and filtering expressions#4243

Merged
yuxiqian merged 5 commits into
apache:masterfrom
Hisoka-X:38996-transform-error-message
Jan 30, 2026
Merged

[FLINK-38996][transform] Enhance error messages for projection and filtering expressions#4243
yuxiqian merged 5 commits into
apache:masterfrom
Hisoka-X:38996-transform-error-message

Conversation

@Hisoka-X
Copy link
Copy Markdown
Member

@Hisoka-X Hisoka-X commented Jan 29, 2026

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

This pull request improves error reporting and debugging for transformation expressions in the Flink CDC runtime.

Currently, when a transformation used in transform encounters an error, we don't include the user-provided expression in the error message, making it difficult for users to directly determine the source of the error.

Before:

Failed to evaluate projection expression `castToTimestamp("FOOBAR", __time_zone__)` for column `comp_11` in table `foo.bar.baz`

After:

Failed to evaluate projection expression `CAST('FOOBAR' AS TIMESTAMP(6))` for column `comp_11` in table `foo.bar.baz`.

@lvyanquan
Copy link
Copy Markdown
Contributor

Hi @Hisoka-X, you may need to rebase master to fix confilct.

# Conflicts:
#	flink-cdc-composer/src/test/java/org/apache/flink/cdc/composer/flink/FlinkPipelineTransformITCase.java
#	flink-cdc-runtime/src/test/java/org/apache/flink/cdc/runtime/operators/transform/PostTransformOperatorTest.java
@Hisoka-X
Copy link
Copy Markdown
Member Author

Hi @Hisoka-X, you may need to rebase master to fix confilct.

done

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 pull request enhances error messages for transformation expressions in Flink CDC by displaying the original user-provided SQL expressions alongside the compiled internal expressions. This makes it significantly easier for users to debug transformation errors by showing them the exact expressions they wrote rather than the compiled Janino code.

Changes:

  • Added originalExpression field to TransformExpressionKey to store user-provided expressions for error reporting
  • Updated error messages in ProjectionColumnProcessor and TransformFilterProcessor to display both original and compiled expressions
  • Added getExpression() method to ProjectionColumn to expose the original expression
  • Updated all tests and test fixtures to match the new error message formats

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
TransformExpressionKey.java Added nullable originalExpression field and updated equals/hashCode/toString to include it for improved error reporting
ProjectionColumn.java Added getExpression() getter method to expose the original user expression
ProjectionColumnProcessor.java Updated error messages to show original expression with compiled expression and column name mapping on separate lines
TransformFilterProcessor.java Updated error messages to show both original and compiled expressions with clearer formatting
TransformExpressionCompiler.java Enhanced compilation error messages to include both original and compiled expressions
PostTransformOperatorTest.java Added assertions to validate the new error message format includes both expressions
FlinkPipelineTransformITCase.java Updated test expectations to match new error message formats
casting.yaml Updated expected error message to show original SQL expression instead of compiled code
logical.yaml Updated expected error message to show original SQL expression instead of compiled code

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

@lvyanquan
Copy link
Copy Markdown
Contributor

Hi @yuxiqian, maybe you can help to review this.

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.

Looks good. Thanks Hisoka for the improvement!

@yuxiqian yuxiqian merged commit 798d068 into apache:master Jan 30, 2026
33 of 36 checks passed
@Hisoka-X Hisoka-X deleted the 38996-transform-error-message branch January 30, 2026 13:12
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants