-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathTableTransformation.scala
More file actions
30 lines (22 loc) · 883 Bytes
/
TableTransformation.scala
File metadata and controls
30 lines (22 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package diamond.transform.table
import diamond.transform.{Transformation, TransformationContext}
import org.apache.spark.sql.DataFrame
import scala.collection.mutable
/**
* A general table-level transformation that takes a DataFrame and returns
* a new DataFrame.
*
* The new DataFrame may conform to a different schema. It may be computed
* with reference to the original DataFrame or to any values in the
* TransformationContext.
*
* Created by markmo on 16/12/2015.
*/
trait TableTransformation extends Transformation {
val dependencies = mutable.Set[TableTransformation]()
def apply(df: DataFrame, ctx: TransformationContext): DataFrame
def addDependencies(dependencies: TableTransformation*): Unit = {
this.dependencies ++= dependencies
}
def edges: Traversable[(TableTransformation, TableTransformation)] = dependencies.map((_, this))
}