Details
-
Task
-
Status: Resolved
-
Minor
-
Resolution: Done
-
3.5.0
-
None
-
None
Description
The PredicatedTransformation https://github.com/apache/kafka/blob/trunk/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/PredicatedTransformation.java
is an instance of Transformation, a plugin class.
This allows both a PredicatedTransformation and a base Transformation to exist in the same list inside of the TransformationChain.
However, the PredicatedTransformation is not a compliant general-purpose Transformation, and has a number of non-standard behaviors:
1. The PredicatedTransformation is hidden from the REST API plugin listings
2. PredicatedTransformation::config and ::configure throw an exception, as they are not called under normal circumstances
3. The PredicatedTransformation has no default constructor, and would throw an exception if loaded via the standard plugin initialization logic.
4. The TransformationChain calls `.getClass()` on the PredicatedTransformation, which returns the PredicatedTransformation class itself, and not the wrapped transformation class.
The current implementation is also an exceptional case and would conflict with potential future changes:
1. If the "Versioned" interface were added to SMTs, the PredicatedTransformation would throw exceptions during plugin scanning
2. If the `connect-plugin-path.sh` script is implement as-described in KIP-898, the PredicatedTransformation would show up as a non-migrated plugin class
3. If https://issues.apache.org/jira/browse/KAFKA-14670 is implemented, then there will be no common interface for wrapped transformations and PredicatedTransformations to exist in the same data structure.
The PredicatedTransformation is a reasonable abstraction to compose a predicate and transformation, but it can do so without subclassing Transformation, and incurring the above pitfalls.
Attachments
Issue Links
- links to