adrians commented on code in PR #50170: URL: https://github.com/apache/spark/pull/50170#discussion_r2054148711
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala: ########## @@ -298,6 +299,24 @@ object ReorderAssociativeOperator extends Rule[LogicalPlan] { } +/** + * The "ArrayContains" node checks if a given value is present in a given array, + * being similar to the "IN" predicate. + * + * This optimization rule replaces the "ArrayContains" nodes working on literal + * lists with "InSet" nodes in the expression. + */ +object ReplaceArrayContainsWithInSet extends Rule[LogicalPlan] { + override def apply(plan: LogicalPlan): LogicalPlan = { + plan transformAllExpressions { + case ArrayContains(arrayParam: Literal, col) + if arrayParam.value.isInstanceOf[GenericArrayData] => Review Comment: I've reformulated that guard-condition. The only effect it had was protecting against `arrayParam.value` being NULL (which would throw an Null-Pointer-Exception in the next line). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org