Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/8983#discussion_r41475635
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala
---
@@ -135,4 +135,26 @@ class AnalysisSuite extends AnalysisTest {
plan = testRelation.select(CreateStructUnsafe(Seq(a, (a +
1).as("a+1"))).as("col"))
checkAnalysis(plan, plan)
}
+
+ test("SPARK-8654: invalid CAST in NULL IN(...) expression") {
+ val plan = Project(Alias(In(Literal(null), Seq(Literal(1),
Literal(2))), "a")() :: Nil,
+ LocalRelation()
+ )
+ assertAnalysisSuccess(plan)
+ }
+
+ test("SPARK-8654: different types in inlist but can be converted to a
commmon type") {
+ val plan = Project(Alias(In(Literal(null), Seq(Literal(1),
Literal(1.2345))), "a")() :: Nil,
+ LocalRelation()
+ )
+ assertAnalysisSuccess(plan)
+ }
+
+ test("SPARK-8654: check type compatibility error") {
+ val plan = Project(Alias(In(Literal(null), Seq(Literal(true),
Literal(1))), "a")() :: Nil,
+ LocalRelation()
+ )
+ assertAnalysisError(plan, Seq("cannot resolve 'null IN (true,1)' due
to data " +
+ "type mismatch: Arguments must be same
type"))
--- End diff --
This can be simplified to `assertAnalysisError(plan, Seq("data type
mismatch: Arguments must be same type")`
---
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]