Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/3510#discussion_r21128288
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
---
@@ -992,4 +992,17 @@ class SQLQuerySuite extends QueryTest with
BeforeAndAfterAll {
"nulldata2 on nulldata1.value <=> nulldata2.value"),
(1 to 2).map(i => Seq(i)))
}
+
+ test("Supporting Coalesce function in Spark SQL") {
+ val nullCheckData1 = TestData(1,"1") :: TestData(2,null) :: Nil
+ val rdd1 = sparkContext.parallelize((0 to 1).map(i =>
nullCheckData1(i)))
+ rdd1.registerTempTable("nulldata1")
+ val nullCheckData2 = TestData(1,"1") :: TestData(2,"2") :: Nil
+ val rdd2 = sparkContext.parallelize((0 to 1).map(i =>
nullCheckData2(i)))
+ rdd2.registerTempTable("nulldata2")
+
+ checkAnswer(sql("SELECT Coalesce(nulldata2.value,nulldata1.value) FROM
nulldata1 join " +
--- End diff --
Tests like this might be a little easier to read/write if you just use
literals in the SELECT clause.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]