Skip to content

Commit

Permalink
add a new case class for nullable data
Browse files Browse the repository at this point in the history
  • Loading branch information
gatorsmile committed Nov 24, 2015
1 parent 50f5320 commit 980b153
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,16 @@ class DatasetSuite extends QueryTest with SharedSQLContext {
test("joinWith, expression condition, outer join") {
val nullInteger = null.asInstanceOf[Integer]
val nullString = null.asInstanceOf[String]
val ds1 = Seq(ClassData("a", new Integer(1)),
ClassData("c", new Integer(3))).toDS()
val ds1 = Seq(ClassNullableData("a", new Integer(1)),
ClassNullableData("c", new Integer(3))).toDS()
val ds2 = Seq(("a", new Integer(1)),
("b", new Integer(2))).toDS()

checkAnswer(
ds1.joinWith(ds2, $"_1" === $"a", "outer"),
(ClassData("a", new Integer(1)), ("a", new Integer(1))),
(ClassData("c", new Integer(3)), (nullString, nullInteger)),
(ClassData(nullString, nullInteger), ("b", new Integer(2))))
(ClassNullableData("a", new Integer(1)), ("a", new Integer(1))),
(ClassNullableData("c", new Integer(3)), (nullString, nullInteger)),
(ClassNullableData(nullString, nullInteger), ("b", new Integer(2))))
}

test("joinWith tuple with primitive, expression") {
Expand Down Expand Up @@ -418,7 +418,8 @@ class DatasetSuite extends QueryTest with SharedSQLContext {
}


case class ClassData(a: String, b: Integer)
case class ClassData(a: String, b: Int)
case class ClassNullableData(a: String, b: Integer)

/**
* A class used to test serialization using encoders. This class throws exceptions when using
Expand Down

0 comments on commit 980b153

Please sign in to comment.