Skip to content
Snippets Groups Projects
Commit 8154ed7d authored by Michael Armbrust's avatar Michael Armbrust
Browse files

[SQL] Support ScalaReflection of schema in different universes

Author: Michael Armbrust <michael@databricks.com>

Closes #3096 from marmbrus/reflectionContext and squashes the following commits:

adc221f [Michael Armbrust] Support ScalaReflection of schema in different universes
parent 86e9eaa3
No related branches found
No related tags found
No related merge requests found
......@@ -26,14 +26,26 @@ import org.apache.spark.sql.catalyst.plans.logical.LocalRelation
import org.apache.spark.sql.catalyst.types._
import org.apache.spark.sql.catalyst.types.decimal.Decimal
/**
* Provides experimental support for generating catalyst schemas for scala objects.
* A default version of ScalaReflection that uses the runtime universe.
*/
object ScalaReflection {
object ScalaReflection extends ScalaReflection {
val universe: scala.reflect.runtime.universe.type = scala.reflect.runtime.universe
}
/**
* Support for generating catalyst schemas for scala objects.
*/
trait ScalaReflection {
/** The universe we work in (runtime or macro) */
val universe: scala.reflect.api.Universe
import universe._
// The Predef.Map is scala.collection.immutable.Map.
// Since the map values can be mutable, we explicitly import scala.collection.Map at here.
import scala.collection.Map
import scala.reflect.runtime.universe._
case class Schema(dataType: DataType, nullable: Boolean)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment