Github user viirya commented on a diff in the pull request: https://github.com/apache/spark/pull/21886#discussion_r205573522 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala --- @@ -1407,6 +1408,87 @@ object ReplaceExceptWithAntiJoin extends Rule[LogicalPlan] { } } +/** + * Replaces logical [[Intersect]] operator using a combination of Union, Aggregate + * and Generate operator. + * + * Input Query : + * {{{ + * SELECT c1 FROM ut1 INTERSECT ALL SELECT c1 FROM ut2 + * }}} + * + * Rewritten Query: + * {{{ + * SELECT c1 + * FROM ( + * SELECT replicate_row(min_count, c1) AS (min_count, c1) + * FROM ( + * SELECT c1, + * vcol1_cnt, + * vcol2_cnt, --- End diff -- Do we need to have `vcol1_cnt` and `vcol2_cnt` here? I think above `replicate_row` only takes `min_count` input.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org