HyukjinKwon commented on code in PR #43313:
URL: https://github.com/apache/spark/pull/43313#discussion_r1360289233


##########
connector/connect/common/src/main/scala/org/apache/spark/sql/connect/client/SparkConnectClient.scala:
##########
@@ -585,6 +587,27 @@ object SparkConnectClient {
     def build(): SparkConnectClient = _configuration.toSparkConnectClient
   }
 
+  /**
+   * Appends the Spark, Scala & JVM version, and the used OS to the 
user-provided user agent.
+   */
+  private def genUserAgent(value: String): String = {
+    val scalaVersion = Properties.versionNumberString
+    val jvmVersion = System.getProperty("java.version").split("_")(0)
+    val osName = {
+      val os = System.getProperty("os.name").toLowerCase(Locale.ROOT)
+      if (os.contains("mac")) "darwin"
+      else if (os.contains("linux")) "linux"
+      else if (os.contains("win")) "windows"
+      else "unknown"
+    }
+    List(
+      value,
+      s"spark/$SPARK_VERSION",
+      s"scala/$scalaVersion",
+      s"jvm/$jvmVersion",
+      s"os/$osName").mkString(" ")

Review Comment:
   BTW, I think we should have used other ser/de format like JSON ... other 
values here can easily contain whitespaces cc @nija-at 



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