Last active
January 8, 2016 14:22
-
-
Save fblundun/091ae59fecd265e5cfd6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def f(x: DfType, pairs: List[(String, AType)]): DfType = pairs match { | |
| case head :: tail => f(x.withColumn(head._1, head._2), tail) | |
| case Nil => x | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| implicit class RichDfType(df: DfType) { | |
| def f(pairs: List[(String, AType)]): DfType = pairs match { | |
| case head :: tail => df.withColumn(head._1, head._2).f(tail) | |
| case Nil => df | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment