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
| // core/src/main/scala/App.scala | |
| import org.apache.spark.sql.SparkSession | |
| object App { | |
| trait Base | |
| class A extends Base { | |
| def impl(x: Int): String = "ab" + x.toString | |
| } |
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
| import org.apache.spark.sql.catalyst.ScalaReflection | |
| import ScalaReflection.universe._ | |
| import org.apache.spark.sql.SparkSession | |
| import org.reflections.Reflections | |
| import scala.jdk.CollectionConverters._ | |
| import scala.reflect.api | |
| object App { |
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
| import org.apache.spark.sql.catalyst.ScalaReflection | |
| import ScalaReflection.universe._ | |
| import org.apache.spark.sql.SparkSession | |
| import org.apache.spark.sql.catalyst.ScalaReflection.universe | |
| import org.reflections.Reflections | |
| import scala.jdk.CollectionConverters._ | |
| import scala.reflect.api | |
| import scala.tools.reflect.ToolBox |
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
| import org.apache.spark.sql.catalyst.ScalaReflection | |
| import ScalaReflection.universe._ | |
| import org.apache.spark.sql.SparkSession | |
| import org.apache.spark.sql.catalyst.ScalaReflection.universe | |
| import org.reflections.Reflections | |
| import scala.jdk.CollectionConverters._ | |
| import scala.reflect.api | |
| import scala.tools.reflect.ToolBox |
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
| import org.apache.spark.sql.catalyst.ScalaReflection | |
| import ScalaReflection.universe._ | |
| import org.apache.spark.sql.SparkSession | |
| import org.reflections.Reflections | |
| import scala.jdk.CollectionConverters._ | |
| import scala.tools.reflect.ToolBox | |
| object App { | |
| def getType[T: TypeTag](obj: T) = typeOf[T] |
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
| import org.apache.spark.sql.catalyst.ScalaReflection | |
| import ScalaReflection.universe._ | |
| import org.apache.spark.sql.SparkSession | |
| import org.reflections.Reflections | |
| import scala.jdk.CollectionConverters._ | |
| import scala.reflect.api | |
| object App { | |
| def getType[T: TypeTag](obj: T) = typeOf[T] |
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
| import org.apache.spark.sql.SparkSession | |
| import org.apache.spark.sql.catalyst.ScalaReflection | |
| import ScalaReflection.universe._ | |
| import scala.tools.reflect.ToolBox | |
| object App { | |
| val spark = SparkSession.builder | |
| .master("local") | |
| .appName("Spark app") | |
| .getOrCreate() |
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
| import org.apache.spark.sql.SparkSession | |
| import org.apache.spark.sql.catalyst.ScalaReflection.universe._ | |
| object App { | |
| val spark = SparkSession.builder | |
| .master("local") | |
| .appName("Spark app") | |
| .getOrCreate() | |
| def impl(): Any = (x: Int) => "ab" + x.toString |
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
| $ scalac potato.scala | |
| $ ls | |
| potato.class potato$.class potato.scala | |
| $ javap -p potato.class | |
| Compiled from "potato.scala" | |
| public final class potato { | |
| public static void dirt_$eq(int); | |
| public static int dirt(); | |
| } | |
| $ javap -p potato\$.class |
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
| import org.apache.spark.sql.SparkSession | |
| import org.apache.spark.sql.functions.typedLit | |
| object App13 { | |
| val spark: SparkSession = SparkSession.builder.master("local[*]").appName("Example").getOrCreate | |
| import spark.implicits._ | |
| val columns = Seq("language", "users_count") |