You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "nija-at (via GitHub)" <gi...@apache.org> on 2023/02/16 14:31:37 UTC

[GitHub] [spark] nija-at commented on a diff in pull request #40054: pyspark: accept user_agent in spark connect's connection string

nija-at commented on code in PR #40054:
URL: https://github.com/apache/spark/pull/40054#discussion_r1108553346


##########
python/pyspark/sql/connect/client.py:
##########
@@ -244,6 +246,17 @@ def userId(self) -> Optional[str]:
         """
         return self.params.get(ChannelBuilder.PARAM_USER_ID, None)
 
+    @property
+    def userAgent(self) -> str:
+        """
+        Returns
+        -------
+        user_agent : str
+            The user_agent parameter specified in the connection string,
+            or "_SPARK_CONNECT_PYTHON" when not specified.
+        """
+        return self.params.get(ChannelBuilder.PARAM_USER_AGENT, "_SPARK_CONNECT_PYTHON")

Review Comment:
   TODO: apply some reasonable validation on the length and charset of user agent



-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org