dubeyx commented on issue #12070:
URL: https://github.com/apache/hudi/issues/12070#issuecomment-2401680075
/**
* Implementation of Transformer to add a 'day' column formatted as 'yymmdd'
from the 'CreatedAt' column.
*/
public class DayTransform implements Transformer {
/**
* Transforms the input Dataset by adding a 'day' column based on the
'CreatedAt' column, formatted as 'yymmdd'.
*
* @param jsc JavaSparkContext
* @param sparkSession Spark Session
* @param rowDataset Source DataSet
* @param properties Config properties
* @return Transformed Dataset with the 'day' column added
*/
@Override
public Dataset<Row> apply(JavaSparkContext jsc, SparkSession
sparkSession, Dataset<Row> rowDataset, TypedProperties properties) {
return rowDataset
.withColumn("day", functions.date_format(
functions.col("CreatedAt").cast(DataTypes.TimestampType), "yyMMdd")
);
}
}
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]