When using SparkETLApp, the framework orchestrates the data flow.
Required Implementations:
appName: The name of the application.configClass: The class of the configuration object.transform(ctx, inputs): The core logic that takes input DataFrames and returns a map of output DataFrames.
Optional Overrides:
validateConfig(config): Custom validation for the configuration.configureSpark(builder, config): Customize the SparkSession.Builder before the session is created.beforeSparkStart(config, args, logger): Logic to execute before the Spark session starts.extract(ctx): Custom extraction logic.load(ctx, outputs): Custom loading logic.
object OrdersJob extends SparkETLApp[OrdersConfig] {
override protected def appName: String = "orders-job"
override protected def configClass: Class[OrdersConfig] = classOf[OrdersConfig]
override protected def transform(
ctx: AppContext[OrdersConfig],
inputs: Map[String, DataFrame]
): Map[String, DataFrame] = {
// Transformation logic here
Map("customer_orders" -> resultDataFrame)
}
}