Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/9308#discussion_r45699604
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
---
@@ -1997,4 +1997,35 @@ class SQLQuerySuite extends QueryTest with
SharedSQLContext {
sqlContext.setConf("spark.sql.subexpressionElimination.enabled",
"true")
verifyCallCount(df.selectExpr("testUdf(a)", "testUdf(a)"), Row(1, 1),
1)
}
+
+ test("SPARK-10707: nullability should be correctly propagated through
set operations (1)") {
+ // This test produced an incorrect result of 1 before the SPARK-10707
fix because of the
+ // NullPropagation rule: COUNT(v) got replaced with COUNT(1) because
the output column of
+ // UNION was incorrectly considered non-nullable:
+ checkAnswer(
+ sql("""SELECT count(v) FROM (
+ | SELECT v FROM (
+ | SELECT 'foo' AS v UNION ALL
+ | SELECT NULL AS v
+ | ) my_union WHERE isnull(v)
+ |) my_subview""".stripMargin),
--- End diff --
nit: can you keep the code style of this test consistent with others? i.e.
```
sql(
""".....
```
---
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]