[FLINK-38996][transform] Enhance error messages for projection and filtering expressions#4243
Conversation
…ltering expressions
|
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
done |
There was a problem hiding this comment.
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
originalExpressionfield toTransformExpressionKeyto store user-provided expressions for error reporting - Updated error messages in
ProjectionColumnProcessorandTransformFilterProcessorto display both original and compiled expressions - Added
getExpression()method toProjectionColumnto 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.
|
Hi @yuxiqian, maybe you can help to review this. |
yuxiqian
left a comment
There was a problem hiding this comment.
Looks good. Thanks Hisoka for the improvement!
…ltering expressions (apache#4243)
…ltering expressions (apache#4243)
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
transformencounters 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:
After: