Github user jiangxb1987 commented on a diff in the pull request:
https://github.com/apache/spark/pull/15319#discussion_r81446306
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/InferFiltersFromConstraintsSuite.scala
---
@@ -120,4 +122,28 @@ class InferFiltersFromConstraintsSuite extends
PlanTest {
val optimized = Optimize.execute(originalQuery)
comparePlans(optimized, correctAnswer)
}
+
+ test("don't generate constraints for recursive functions") {
+ val t1 = testRelation.subquery('t1)
+ val t2 = testRelation.subquery('t2)
+ val t3 = testRelation.subquery('t3)
+
+ val originalQuery = t1.select('a, 'b.as('d), Coalesce(Seq('a,
'b)).as('int_col)).as("t")
+ .join(t2, Inner,
+ Some("t.a".attr === "t2.a".attr
+ && "t.d".attr === "t2.a".attr
+ && "t.int_col".attr === "t2.a".attr))
+ .analyze
+ val correctAnswer = t1.where(IsNotNull('a) && 'a === Coalesce(Seq('a,
'b))
+ && IsNotNull('b) && 'b === Coalesce(Seq('a, 'b))
+ && IsNotNull(Coalesce(Seq('a, 'b))) && 'a === 'b)
--- End diff --
These predicates are infered from `t.a = t2.a, t.d = t2.a, t.int_col =
t2.a`, which in line with our expectation.
---
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]