Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/10073#discussion_r46350732
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/planning/patterns.scala
---
@@ -133,6 +132,38 @@ object ExtractEquiJoinKeys extends Logging with
PredicateHelper {
}
/**
+ * A pattern that collects the filter and inner joins.
+ *
+ * Filter
+ * |
+ * inner Join
+ * / \ ----> (filters, Seq(plan1, plan2),
input)
+ * inner join plan2
+ * / \
+ * input plan1
+ */
+object FilterAndInnerJoins extends PredicateHelper {
+ def unapply(plan: LogicalPlan): Option[(LogicalPlan, Seq[LogicalPlan],
Seq[Expression])] =
+ plan match {
+ case f @ Filter(filterCondition, j @ Join(left, right, Inner, None))
=>
+
+ // flatten all inner joins, which are next to each other and has
no condition
+ def flattenJoin(plan: LogicalPlan): (LogicalPlan,
Seq[LogicalPlan]) = plan match {
--- End diff --
Building on what @nongli said, I think that you can have the top level
match handle both filters and joins, which should make this more powerful
(similar to what we do in `PhysicalOperation`
[here](https://github.com/apache/spark/pull/10073/files#diff-820e654df2a5133c0f86c17e2fc5512eR54)).
---
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]