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
/** | |
* Generate Case class from DataFrame.schema | |
* | |
* val df:DataFrame = ... | |
* | |
* val s2cc = new Schema2CaseClass | |
* import s2cc.implicit._ | |
* | |
* println(s2cc.schemaToCaseClass(df.schema, "MyClass")) | |
* |
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
package eval | |
import scala.reflect.runtime.currentMirror | |
import scala.tools.reflect.ToolBox | |
import java.io.File | |
object Eval { | |
def apply[A](string: String): A = { | |
val toolbox = currentMirror.mkToolBox() |
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
(defn replace-symbols | |
"Given a map of replacement pairs and a form, returns a (nested) | |
form with any symbol = a key in smap replaced with the corresponding | |
val in smap." | |
[smap form] | |
(if (sequential? form) | |
(map (partial replace-symbols smap) form) | |
(get smap form form))) | |
(defmacro lazy-let |