yanghua commented on a change in pull request #1440: [HUDI-731] Add ChainedTransformer URL: https://github.com/apache/incubator-hudi/pull/1440#discussion_r396869939
########## File path: hudi-utilities/src/main/java/org/apache/hudi/utilities/transform/ChainedTransformer.java ########## @@ -0,0 +1,30 @@ +package org.apache.hudi.utilities.transform; + +import org.apache.hudi.common.util.TypedProperties; + +import org.apache.spark.api.java.JavaSparkContext; +import org.apache.spark.sql.Dataset; +import org.apache.spark.sql.Row; +import org.apache.spark.sql.SparkSession; + +import java.util.List; +import java.util.function.Supplier; + +/** + * An abstract {@link Transformer} to chain other {@link Transformer}s and apply sequentially. + * <p> + * A subclass is to supply a {@link List} of {@link Transformer}s in desired sequence. + */ +public abstract class ChainedTransformer implements Transformer { + + protected abstract Supplier<List<Transformer>> supplyTransformers(); + + @Override + public Dataset<Row> apply(JavaSparkContext jsc, SparkSession sparkSession, Dataset<Row> rowDataset, TypedProperties properties) { Review comment: It would be better to have a test case which extends `ChainedTransformer ` and mock some transformer to verify this function. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services