panbingkun commented on code in PR #47401:
URL: https://github.com/apache/spark/pull/47401#discussion_r1682650679


##########
sql/api/src/main/scala/org/apache/spark/sql/types/StringType.scala:
##########
@@ -88,7 +88,10 @@ class StringType private(val collationId: Int) extends 
AtomicType with Serializa
  */
 @Stable
 case object StringType extends StringType(0) {
-  private[spark] def apply(collationId: Int): StringType = new 
StringType(collationId)
+  private[spark] def apply(collationId: Int): StringType = {
+    assert (collationId >= 0 && collationId <= (1 << 12))

Review Comment:
   It did not check `collationId`, it only checked `collationName`,
   
https://github.com/apache/spark/blob/1a428c1606645057ef94ac8a6cadbb947b9208a6/sql/api/src/main/scala/org/apache/spark/sql/types/StringType.scala#L94
   
https://github.com/apache/spark/blob/1a428c1606645057ef94ac8a6cadbb947b9208a6/common/unsafe/src/main/java/org/apache/spark/sql/catalyst/util/CollationFactory.java#L391
   
https://github.com/apache/spark/blob/1a428c1606645057ef94ac8a6cadbb947b9208a6/common/unsafe/src/main/java/org/apache/spark/sql/catalyst/util/CollationFactory.java#L615
   



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

Reply via email to