-
- Downloads
[SPARK-21567][SQL] Dataset should work with type alias
## What changes were proposed in this pull request? If we create a type alias for a type workable with Dataset, the type alias doesn't work with Dataset. A reproducible case looks like: object C { type TwoInt = (Int, Int) def tupleTypeAlias: TwoInt = (1, 1) } Seq(1).toDS().map(_ => ("", C.tupleTypeAlias)) It throws an exception like: type T1 is not a class scala.ScalaReflectionException: type T1 is not a class at scala.reflect.api.Symbols$SymbolApi$class.asClass(Symbols.scala:275) ... This patch accesses the dealias of type in many places in `ScalaReflection` to fix it. ## How was this patch tested? Added test case. Author: Liang-Chi Hsieh <viirya@gmail.com> Closes #18813 from viirya/SPARK-21567.
Showing
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala 14 additions, 13 deletions...scala/org/apache/spark/sql/catalyst/ScalaReflection.scala
- sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala 24 additions, 0 deletions...re/src/test/scala/org/apache/spark/sql/DatasetSuite.scala
Please register or sign in to comment