case class RawTableTransformation(transformers: Map[String, Transformation[String, String]]) extends Transformation[RawTable, RawTable] with Product with Serializable
A transformation class that applies a specific set of transformations to the rows of a RawTable based on matching column names.
- transformers
A map where the keys are column names (as
String) and the values areTransformation[String, String]instances, which define how to transform data in the corresponding columns. This class implements theTransformation[RawTable, RawTable]trait, meaning it takes aRawTableas input and produces a transformedRawTableas output. The transformation process is based on matching column names from thetransformersmap with the column names in the table's header. If a match is found, the corresponding transformation is applied to the relevant column in each row of the table.Example Usage
To use this class, first construct a
RawTableTransformationinstance by providing a map of column names and their corresponding transformations:val transformers: Map[String, Transformation[String, String]] = Map( "column1" -> CustomTransformation1, "column2" -> CustomTransformation2 ) val transformation = RawTableTransformation(transformers) // Apply the transformation to a RawTable object val transformedTable = transformation(rawTable)
Implementation Details
- The
applymethod retrieves the table'smaybeHeaderobject, which contains the column names. - For each column name in the
transformersmap, it fetches the column index usingHeader.getIndex. - The transformations are then compiled into a map associating column indices with their respective transformations.
- Finally, the table's rows are transformed using the
mapmethod, which applies aRawRowTransformationto each row.
- The
- Alphabetic
- By Inheritance
- RawTableTransformation
- Serializable
- Product
- Equals
- Transformation
- Function1
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new RawTableTransformation(transformers: Map[String, Transformation[String, String]])
- transformers
A map where the keys are column names (as
String) and the values areTransformation[String, String]instances, which define how to transform data in the corresponding columns. This class implements theTransformation[RawTable, RawTable]trait, meaning it takes aRawTableas input and produces a transformedRawTableas output. The transformation process is based on matching column names from thetransformersmap with the column names in the table's header. If a match is found, the corresponding transformation is applied to the relevant column in each row of the table.Example Usage
To use this class, first construct a
RawTableTransformationinstance by providing a map of column names and their corresponding transformations:val transformers: Map[String, Transformation[String, String]] = Map( "column1" -> CustomTransformation1, "column2" -> CustomTransformation2 ) val transformation = RawTableTransformation(transformers) // Apply the transformation to a RawTable object val transformedTable = transformation(rawTable)
Implementation Details
- The
applymethod retrieves the table'smaybeHeaderobject, which contains the column names. - For each column name in the
transformersmap, it fetches the column index usingHeader.getIndex. - The transformations are then compiled into a map associating column indices with their respective transformations.
- Finally, the table's rows are transformed using the
mapmethod, which applies aRawRowTransformationto each row.
- The
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def andThen[A](g: (RawTable) => A): (RawTable) => A
- Definition Classes
- Function1
- Annotations
- @unspecialized()
- def apply(t: RawTable): RawTable
Applies a set of transformations to a given
RawTable.Applies a set of transformations to a given
RawTable. The transformations are selectively applied based on the column indices determined by matching keys in thetransformersmap with the column headers (if available) in the input table.- t
the input
RawTablewhich is a representation of a table containing rows and optionally headers. Each row in the table may be transformed based on the transformations for matching columns.- returns
a new
RawTablewhere each row is transformed according to the applicable transformations.
- Definition Classes
- RawTableTransformation → Function1
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def compose[A](g: (A) => RawTable): (A) => RawTable
- Definition Classes
- Function1
- Annotations
- @unspecialized()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- Function1 → AnyRef → Any
- val transformers: Map[String, Transformation[String, String]]
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)