Github user srinathshankar commented on a diff in the pull request:
https://github.com/apache/spark/pull/14866#discussion_r77049426
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
---
@@ -933,6 +936,45 @@ object CombineLimits extends Rule[LogicalPlan] {
}
/**
+ * Check if there any cartesian products between joins of any type in the
optimized plan tree.
+ * Throw an error if a cartesian product is found without an explicit
cross join specified.
+ * This rule is effectively disabled if the CROSS_JOINS_ENABLED flag is
true.
+ *
+ * This rule must be run AFTER the ReorderJoin rule since the join
conditions for each join must be
+ * collected before checking if it is a cartesian product. If you have
+ * SELECT * from R, S where R.r = S.s,
+ * the join between R and S is not a cartesian product and therefore
should be allowed.
+ * The predicate R.r = S.s is not recognized as a join condition until the
ReorderJoin rule.
+ */
+case class CheckCartesianProducts(conf: CatalystConf)
+ extends Rule[LogicalPlan] with PredicateHelper {
+ /**
+ * Check if a join specified by left, right and condition is a cartesian
product. Returns true if
+ * there are no join conditions involving references from both left and
right.
+ */
+ def isCartesianProduct(left: LogicalPlan, right: LogicalPlan, condition:
Option[Expression])
--- End diff --
done.
---
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]