uros-db commented on code in PR #45856:
URL: https://github.com/apache/spark/pull/45856#discussion_r1550948477


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/regexpExpressions.scala:
##########
@@ -543,25 +543,52 @@ case class RLike(left: Expression, right: Expression) 
extends StringRegexExpress
 case class StringSplit(str: Expression, regex: Expression, limit: Expression)
   extends TernaryExpression with ImplicitCastInputTypes with NullIntolerant {
 
-  override def dataType: DataType = ArrayType(StringType, containsNull = false)
-  override def inputTypes: Seq[DataType] = Seq(StringType, StringType, 
IntegerType)
+  override def dataType: DataType = ArrayType(str.dataType, containsNull = 
false)
+  override def inputTypes: Seq[AbstractDataType] =
+    Seq(StringTypeAnyCollation, StringTypeAnyCollation, IntegerType)
+
+  override def checkInputDataTypes(): TypeCheckResult = str.dataType match {
+    case s: StringType =>
+      if (s.supportsBinaryEquality || s.isUTF8BinaryLcaseCollation) {
+        super.checkInputDataTypes()
+      } else {
+        TypeCheckFailure("Unsupported collation: " +
+          CollationFactory.fetchCollation(s.collationId).collationName)
+      }
+    case _ => super.checkInputDataTypes()
+  }
+
   override def first: Expression = str
   override def second: Expression = regex
   override def third: Expression = limit
 
+  private def collationId = str.dataType.asInstanceOf[StringType].collationId

Review Comment:
   use:
   `final lazy val collationId: Int = 
str.dataType.asInstanceOf[StringType].collationId`



-- 
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

Reply via email to