Repository: spark
Updated Branches:
  refs/heads/branch-1.3 61813662a -> 4859c40e2


[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.meh...@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

(cherry picked from commit 17b13c53ec9d8579a7fb801ab781bce43809db6a)
Signed-off-by: Reynold Xin <r...@databricks.com>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/4859c40e
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/4859c40e
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/4859c40e

Branch: refs/heads/branch-1.3
Commit: 4859c40e2428b5cb05f08b1816fa08715566fd6b
Parents: 6181366
Author: Eran Medan <ehrann.meh...@gmail.com>
Authored: Mon Mar 30 00:02:52 2015 -0700
Committer: Reynold Xin <r...@databricks.com>
Committed: Mon Mar 30 00:03:00 2015 -0700

----------------------------------------------------------------------
 .../main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/4859c40e/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala
----------------------------------------------------------------------
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 d6126c2..2220970 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")
     }
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to