cloud-fan commented on a change in pull request #34848:
URL: https://github.com/apache/spark/pull/34848#discussion_r814582111
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
##########
@@ -484,23 +537,35 @@ abstract class StringPredicate extends BinaryExpression
false
> SELECT _FUNC_('Spark SQL', null);
NULL
+ > SELECT _FUNC_(x'537061726b2053514c', x'537061726b');
+ true
""",
since = "3.3.0",
group = "string_funcs"
)
+object ContainsExpressionBuilder extends
StringBinaryPredicateExpressionBuilderBase {
+ override protected def funcName: String = "contains"
+
+ override protected def createStringPredicate(left: Expression, right:
Expression): Expression = {
+ Contains(left, right)
+ }
+}
+
case class Contains(left: Expression, right: Expression) extends
StringPredicate {
override def compare(l: UTF8String, r: UTF8String): Boolean = l.contains(r)
override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
defineCodeGen(ctx, ev, (c1, c2) => s"($c1).contains($c2)")
}
+ override def prettyName: String = "contains"
Review comment:
do we need it? the default implementation should work
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]