Github user tejasapatil commented on a diff in the pull request:
https://github.com/apache/spark/pull/15595#discussion_r84600424
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala
---
@@ -377,4 +377,23 @@ class AnalysisSuite extends AnalysisTest {
assertExpressionType(sum(Divide(Decimal(1), 2.0)), DoubleType)
assertExpressionType(sum(Divide(1.0, Decimal(2.0))), DoubleType)
}
+
+ test("SPARK-18058: union and set operations shall not care about the
nullability" +
+ " when comparing column types") {
+ val firstTable = LocalRelation(
+ AttributeReference("a",
+ StructType(Seq(StructField("a", IntegerType, nullable = true))),
nullable = false)())
+ val secondTable = LocalRelation(
+ AttributeReference("a",
+ StructType(Seq(StructField("a", IntegerType, nullable = false))),
nullable = false)())
+
+ val unionPlan = Union(firstTable, secondTable)
+ assertAnalysisSuccess(unionPlan)
+
+ val r1 = Except(firstTable, secondTable)
--- End diff --
nit: this var could have been named better.
Actually, you could have gotten rid of the vars by doing :
```
assertAnalysisSuccess(Union(firstTable, secondTable))
assertAnalysisSuccess(Except(firstTable, secondTable))
assertAnalysisSuccess(Intersect(firstTable, secondTable))
```
---
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]