Github user mgaido91 commented on a diff in the pull request:
https://github.com/apache/spark/pull/22029#discussion_r228440938
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
---
@@ -212,27 +212,27 @@ object ReorderAssociativeOperator extends
Rule[LogicalPlan] {
* 1. Converts the predicate to false when the list is empty and
* the value is not nullable.
* 2. Removes literal repetitions.
- * 3. Replaces [[In (value, seq[Literal])]] with optimized version
+ * 3. Replaces [[In (values, seq[Literal])]] with optimized version
* [[InSet (value, HashSet[Literal])]] which is much faster.
*/
object OptimizeIn extends Rule[LogicalPlan] {
def apply(plan: LogicalPlan): LogicalPlan = plan transform {
case q: LogicalPlan => q transformExpressionsDown {
- case In(v, list) if list.isEmpty =>
+ case i @ In(_, list) if list.isEmpty =>
// When v is not nullable, the following expression will be
optimized
// to FalseLiteral which is tested in OptimizeInSuite.scala
- If(IsNotNull(v), FalseLiteral, Literal(null, BooleanType))
- case expr @ In(v, list) if expr.inSetConvertible =>
+ If(IsNotNull(i.value), FalseLiteral, Literal(null, BooleanType))
+ case expr @ In(_, list) if expr.inSetConvertible =>
val newList = ExpressionSet(list).toSeq
if (newList.length == 1
// TODO: `EqualTo` for structural types are not working. Until
SPARK-24443 is addressed,
// TODO: we exclude them in this rule.
- && !v.isInstanceOf[CreateNamedStructLike]
+ && !expr.value.isInstanceOf[CreateNamedStructLike]
&& !newList.head.isInstanceOf[CreateNamedStructLike]) {
- EqualTo(v, newList.head)
+ EqualTo(expr.value, newList.head)
--- End diff --
no, we do this only when `value` is not a `CreateNamedStructLike`, so we
don't go here if there are multi-values
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]