dcoliversun commented on code in PR #35886: URL: https://github.com/apache/spark/pull/35886#discussion_r843449794
########## resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesUtils.scala: ########## @@ -381,4 +381,42 @@ object KubernetesUtils extends Logging { } } } + + /** + * This function builds the EnvVar objects for each key-value env. + */ + @Since("3.4.0") + def buildEnvVars(env: Map[String, String]): Seq[EnvVar] = { + if (env.isEmpty) { Review Comment: `if` was removed in https://github.com/apache/spark/pull/35886/commits/cfb25897c87d7fef0ead07067b7194d60989851f ########## resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesUtils.scala: ########## @@ -381,4 +381,42 @@ object KubernetesUtils extends Logging { } } } + + /** + * This function builds the EnvVar objects for each key-value env. + */ + @Since("3.4.0") + def buildEnvVars(env: Map[String, String]): Seq[EnvVar] = { + if (env.isEmpty) { + Seq.empty + } else { + env.filter( env => env._2 != null) + .map { env => + new EnvVarBuilder() + .withName(env._1) + .withValue(env._2) + .build() + } + }.toSeq + } + + /** + * This function builds the EnvVar objects for each field ref env. + */ + @Since("3.4.0") + def buildEnvVarsWithFieldRef(env: Seq[(String, String, String)]): Seq[EnvVar] = { + if (env.isEmpty) { Review Comment: `if` was removed in https://github.com/apache/spark/pull/35886/commits/cfb25897c87d7fef0ead07067b7194d60989851f -- 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