-
- Downloads
[SPARK-13456][SQL] fix creating encoders for case classes defined in Spark shell
## What changes were proposed in this pull request? case classes defined in REPL are wrapped by line classes, and we have a trick for scala 2.10 REPL to automatically register the wrapper classes to `OuterScope` so that we can use when create encoders. However, this trick doesn't work right after we upgrade to scala 2.11, and unfortunately the tests are only in scala 2.10, which makes this bug hidden until now. This PR moves the encoder tests to scala 2.11 `ReplSuite`, and fixes this bug by another approach(the previous trick can't port to scala 2.11 REPL): make `OuterScope` smarter that can detect classes defined in REPL and load the singleton of line wrapper classes automatically. ## How was this patch tested? the migrated encoder tests in `ReplSuite` Author: Wenchen Fan <wenchen@databricks.com> Closes #11410 from cloud-fan/repl.
Showing
- repl/scala-2.10/src/test/scala/org/apache/spark/repl/ReplSuite.scala 2 additions, 2 deletions...2.10/src/test/scala/org/apache/spark/repl/ReplSuite.scala
- repl/scala-2.11/src/test/scala/org/apache/spark/repl/ReplSuite.scala 66 additions, 2 deletions...2.11/src/test/scala/org/apache/spark/repl/ReplSuite.scala
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala 1 addition, 1 deletion...ala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/encoders/OuterScopes.scala 46 additions, 1 deletion.../org/apache/spark/sql/catalyst/encoders/OuterScopes.scala
Loading
Please register or sign in to comment