RamonZhou commented on code in PR #58264: URL: https://github.com/apache/spark/pull/58264#discussion_r3866652779
########## sql/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SessionHolder.scala: ########## @@ -649,9 +660,24 @@ case class SessionHolder(userId: String, sessionId: String, session: SparkSessio } // For testing. Expose the plan cache for testing purposes. - private[service] def getPlanCache: Option[Cache[proto.Relation, LogicalPlan]] = planCache + private[service] def getPlanCache: Option[Cache[PlanCacheKey, LogicalPlan]] = planCache } +/** + * Key of an entry in a session's plan cache. + * + * @param relation + * the relation the cached plan was built from. + * @param pythonWorkerEnv + * the Python worker environment the plan was built with, as the request that built it observed + * it. Part of the key because the environment is baked into every Python function the plan Review Comment: Fixed ########## sql/connect/server/src/main/scala/org/apache/spark/sql/connect/service/PythonWorkerEnvironment.scala: ########## @@ -0,0 +1,219 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.sql.connect.service + +import java.nio.charset.StandardCharsets + +import org.apache.spark.{SparkEnv, SparkException} +import org.apache.spark.sql.RuntimeConfig +import org.apache.spark.sql.connect.config.Connect +import org.apache.spark.sql.internal.SQLConf + +/** + * The environment variables that Python worker processes launched for a session's Python + * functions should inherit. + * + * The environment is carried by session configurations under a reserved prefix, one configuration + * per variable: `spark.pythonWorkerEnv.FOO=bar` makes `FOO` visible as `bar` in `os.environ` Review Comment: Added -- 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]
