MaxGekk commented on code in PR #41580:
URL: https://github.com/apache/spark/pull/41580#discussion_r1245530188


##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SessionHolder.scala:
##########
@@ -163,6 +169,31 @@ case class SessionHolder(userId: String, sessionId: 
String, session: SparkSessio
       }
     }
   }
+
+  /**
+   * Caches given DataFrame with the ID. The cache does not expire. The entry 
needs to be
+   * explicitly removed by the owners of the DataFrame once it is not needed.
+   */
+  private[connect] def cacheDataFrameById(dfId: String, df: DataFrame): Unit = 
{
+    if (dataFrameCache.putIfAbsent(dfId, df) != null) {
+      throw new IllegalArgumentException(s"A dataframe is already associated 
with id $dfId")

Review Comment:
   Cannot you use the error framework for this?



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