bio.ferlab.datalake.spark3.transformation.Concat.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of datalake-spark3_2.12 Show documentation
Show all versions of datalake-spark3_2.12 Show documentation
Library built on top of Apache Spark to speed-up data lakes development..
package bio.ferlab.datalake.spark3.transformation
import org.apache.spark.sql.functions.{col, concat}
import org.apache.spark.sql.{Column, DataFrame}
case class Concat(name: String, cols: Column*) extends Transformation {
/**
* Main method of the trait.
* It defines the logic to transform the input dataframe.
*
* @return a transformed dataframe
*/
override def transform: DataFrame => DataFrame = { df =>
df.withColumn(name, concat(cols:_*))
}
}