diff options
author | Eran Medan <ehrann.mehdan@gmail.com> | 2015-03-30 00:02:52 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2015-03-30 00:02:52 -0700 |
commit | 17b13c53ec9d8579a7fb801ab781bce43809db6a (patch) | |
tree | a269e81d1b5e1a497284d124f0cfda41ba3b4b5d /sql/catalyst/src/main | |
parent | 01dc9f50d1aae1f24021062291d73182a2622f2c (diff) | |
download | spark-17b13c53ec9d8579a7fb801ab781bce43809db6a.tar.gz spark-17b13c53ec9d8579a7fb801ab781bce43809db6a.tar.bz2 spark-17b13c53ec9d8579a7fb801ab781bce43809db6a.zip |
[spark-sql] a better exception message than "scala.MatchError" for unsupported types in Schema creation
Currently if trying to register an RDD (or DataFrame in 1.3) as a table that has types that have no supported Schema representation (e.g. type "Any") - it would throw a match error. e.g. scala.MatchError: Any (of class scala.reflect.internal.Types$ClassNoArgsTypeRef)
This fix is just to have a nicer error message than a MatchError
Author: Eran Medan <ehrann.mehdan@gmail.com>
Closes #5235 from eranation/patch-2 and squashes the following commits:
af4b1a2 [Eran Medan] Line should be under 100 chars
0c69e9d [Eran Medan] Change from sys.error UnsupportedOperationException
524be86 [Eran Medan] better exception than scala.MatchError: Any
Diffstat (limited to 'sql/catalyst/src/main')
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala | 2 |
1 files changed, 2 insertions, 0 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 d6126c24fc..2220970085 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 @@ -179,6 +179,8 @@ trait ScalaReflection { case t if t <:< definitions.ShortTpe => Schema(ShortType, nullable = false) case t if t <:< definitions.ByteTpe => Schema(ByteType, nullable = false) case t if t <:< definitions.BooleanTpe => Schema(BooleanType, nullable = false) + case other => + throw new UnsupportedOperationException(s"Schema for type $other is not supported") } } |