aboutsummaryrefslogtreecommitdiff
path: root/sql/core
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2016-03-16 21:53:16 -0700
committerReynold Xin <rxin@databricks.com>2016-03-16 21:53:16 -0700
commit7eef2463ade693f8e87ecd913a5adf03b69ac14e (patch)
treeee4aa4e324e41d49f2f580783cd751fa83a17b18 /sql/core
parentc100d31ddc6db9c03b7a65a20a7dd56dcdc18baf (diff)
downloadspark-7eef2463ade693f8e87ecd913a5adf03b69ac14e.tar.gz
spark-7eef2463ade693f8e87ecd913a5adf03b69ac14e.tar.bz2
spark-7eef2463ade693f8e87ecd913a5adf03b69ac14e.zip
[SPARK-13118][SQL] Expression encoding for optional synthetic classes
## What changes were proposed in this pull request? Fix expression generation for optional types. Standard Java reflection causes issues when dealing with synthetic Scala objects (things that do not map to Java and thus contain a dollar sign in their name). This patch introduces Scala reflection in such cases. This patch also adds a regression test for Dataset's handling of classes defined in package objects (which was the initial purpose of this PR). ## How was this patch tested? A new test in ExpressionEncoderSuite that tests optional inner classes and a regression test for Dataset's handling of package objects. Author: Jakob Odersky <jakob@odersky.com> Closes #11708 from jodersky/SPARK-13118-package-objects.
Diffstat (limited to 'sql/core')
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/DatasetPrimitiveSuite.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/DatasetPrimitiveSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/DatasetPrimitiveSuite.scala
index 6e9840e4a7..ff022b2dc4 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/DatasetPrimitiveSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/DatasetPrimitiveSuite.scala
@@ -23,6 +23,10 @@ import org.apache.spark.sql.test.SharedSQLContext
case class IntClass(value: Int)
+package object packageobject {
+ case class PackageClass(value: Int)
+}
+
class DatasetPrimitiveSuite extends QueryTest with SharedSQLContext {
import testImplicits._
@@ -127,4 +131,10 @@ class DatasetPrimitiveSuite extends QueryTest with SharedSQLContext {
checkDataset(Seq(Array("test")).toDS(), Array("test"))
checkDataset(Seq(Array(Tuple1(1))).toDS(), Array(Tuple1(1)))
}
+
+ test("package objects") {
+ import packageobject._
+ checkDataset(Seq(PackageClass(1)).toDS(), PackageClass(1))
+ }
+
}