cloud-fan commented on a change in pull request #29999: URL: https://github.com/apache/spark/pull/29999#discussion_r504677943
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/regexpExpressions.scala ########## @@ -176,6 +177,195 @@ case class Like(left: Expression, right: Expression, escapeChar: Char) } } +abstract class LikeAllBase extends Expression with ImplicitCastInputTypes with NullIntolerant { + def value: Expression = children.head + def list: Seq[Expression] = children.tail + def isNot: Boolean + + override def inputTypes: Seq[AbstractDataType] = { + val arrayOrStr = TypeCollection(ArrayType(StringType), StringType) + StringType +: Seq.fill(children.size - 1)(arrayOrStr) + } + + override def dataType: DataType = BooleanType + + override def foldable: Boolean = value.foldable && list.forall(_.foldable) + + override def nullable: Boolean = true + + def escape(v: String): String = StringUtils.escapeLikeRegex(v, '\\') Review comment: It's only called once, can we inline it? ---------------------------------------------------------------- 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. 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