wbo4958 commented on code in PR #50013:
URL: https://github.com/apache/spark/pull/50013#discussion_r1962815424


##########
sql/connect/server/src/main/scala/org/apache/spark/sql/connect/ml/MLCache.scala:
##########
@@ -47,8 +76,18 @@ private[connect] class MLCache extends Logging {
    *   the key
    */
   def register(obj: Object): String = {
+    val (estimatedSize, name) = obj match {
+      case m: Model[_] => (m.estimatedSize, m.uid)
+      case o => (SizeEstimator.estimate(o), 
Option(o).map(_.getClass.getName).getOrElse("NULL"))
+    }
+
+    val maxSize = 
conf.getConf(Connect.CONNECT_SESSION_ML_CACHE_SINGLE_ITEM_SIZE)
+    if (maxSize > 0 && estimatedSize > maxSize) {
+      throw MlItemSizeExceededException("cache", name, estimatedSize, maxSize)

Review Comment:
   Do we need to remove the existing cache before throwing exception?



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