uros-db commented on code in PR #45643: URL: https://github.com/apache/spark/pull/45643#discussion_r1565559007
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala: ########## @@ -974,15 +974,19 @@ case class StringTranslate(srcExpr: Expression, matchingExpr: Expression, replac case class FindInSet(left: Expression, right: Expression) extends BinaryExpression with ImplicitCastInputTypes with NullIntolerant { - override def inputTypes: Seq[AbstractDataType] = Seq(StringType, StringType) + final lazy val collationId: Int = left.dataType.asInstanceOf[StringType].collationId + + override def inputTypes: Seq[AbstractDataType] = + Seq(StringTypeAnyCollation, StringTypeAnyCollation) - override protected def nullSafeEval(word: Any, set: Any): Any = - set.asInstanceOf[UTF8String].findInSet(word.asInstanceOf[UTF8String]) + override protected def nullSafeEval(word: Any, set: Any): Any = { + CollationSupport.FindInSet. + exec(word.asInstanceOf[UTF8String], set.asInstanceOf[UTF8String], collationId) + } override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = { - nullSafeCodeGen(ctx, ev, (word, set) => - s"${ev.value} = $set.findInSet($word);" - ) + nullSafeCodeGen(ctx, ev, (l, r) => + s"${ev.value} = " + CollationSupport.FindInSet.genCode(l, r, collationId) + ";") Review Comment: of course, it's just shorthand (see defineCodeGen impl) -- 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