diff options
author | Tobias Schlatter <tobias@meisch.ch> | 2015-02-06 12:15:02 -0800 |
---|---|---|
committer | Michael Armbrust <michael@databricks.com> | 2015-02-06 12:15:02 -0800 |
commit | 500dc2b4b3136029457e708859fe27da93b1f9e8 (patch) | |
tree | 61a6d5760b830c761b2934d0e9eab4970f370906 /sql | |
parent | d433816157bb3ae1f0fbe44efec43a0c906d9f82 (diff) | |
download | spark-500dc2b4b3136029457e708859fe27da93b1f9e8.tar.gz spark-500dc2b4b3136029457e708859fe27da93b1f9e8.tar.bz2 spark-500dc2b4b3136029457e708859fe27da93b1f9e8.zip |
[SPARK-5640] Synchronize ScalaReflection where necessary
Author: Tobias Schlatter <tobias@meisch.ch>
Closes #4431 from gzm0/sync-scala-refl and squashes the following commits:
c5da21e [Tobias Schlatter] [SPARK-5640] Synchronize ScalaReflection where necessary
Diffstat (limited to 'sql')
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala index 0445f3aa07..5d9c331ca5 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala @@ -103,10 +103,11 @@ trait ScalaReflection { } /** Returns a catalyst DataType and its nullability for the given Scala Type using reflection. */ - def schemaFor[T: TypeTag]: Schema = schemaFor(typeOf[T]) + def schemaFor[T: TypeTag]: Schema = + ScalaReflectionLock.synchronized { schemaFor(typeOf[T]) } /** Returns a catalyst DataType and its nullability for the given Scala Type using reflection. */ - def schemaFor(tpe: `Type`): Schema = { + def schemaFor(tpe: `Type`): Schema = ScalaReflectionLock.synchronized { val className: String = tpe.erasure.typeSymbol.asClass.fullName tpe match { case t if Utils.classIsLoadable(className) && |