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


##########
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:
   Additionally, exceptions may be thrown below due to invalid `collationId`, 
but unfortunately, they are all `functions `that only `trigger` when `called`
   
https://github.com/apache/spark/blob/83a97917d46debe9c3ebb24cf2540b07f6a902ec/sql/api/src/main/scala/org/apache/spark/sql/types/StringType.scala#L32-L46



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