ashishmgofficial commented on issue #2149:
URL: https://github.com/apache/hudi/issues/2149#issuecomment-704569933
@bvaradar I implemented the transformer class as `public class
DebeziumCustomTransformer implements Transformer {
private static final Logger LOG =
LogManager.getLogger(DebeziumCustomTransformer.class);
@Override
public Dataset apply(JavaSparkContext jsc, SparkSession sparkSession,
Dataset<Row> rowDataset,
TypedProperties properties) {
Dataset<Row> insertedOrUpdatedData = rowDataset
.select("op", "ts_ms", "after.*")
.withColumnRenamed("op", "_op")
.withColumn("_is_hoodie_deleted",lit("false"))
.withColumnRenamed("ts_ms", "_ts_ms")
.filter(rowDataset.col("op").notEqual("d"));
Dataset<Row> deletedData = rowDataset
.select("op", "ts_ms", "before.*")
.withColumnRenamed("op", "_op")
.withColumn("_is_hoodie_deleted",lit("true"))
.withColumnRenamed("ts_ms", "_ts_ms")
.filter(rowDataset.col("op").equalTo("d"));
Dataset<Row> transformedData = insertedOrUpdatedData.union(deletedData);
LOG.info("Debezium converted Table : ");
LOG.info(transformedData.showString(5, 1, false));
return transformedData;
}
}
`
----------------------------------------------------------------
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:
[email protected]