holdenk commented on a change in pull request #32237:
URL: https://github.com/apache/spark/pull/32237#discussion_r658953261



##########
File path: python/pyspark/java_gateway.py
##########
@@ -97,8 +99,18 @@ def preexec_func():
                 popen_kwargs['preexec_fn'] = preexec_func
                 proc = Popen(command, **popen_kwargs)
             else:
+                # If an argument contains a character that needs escaping 
(e.g. an 
+                # ampersand) we need to apply a double quoting mechanism to 
correctly 
+                # pass the value through the submit shell scripts.
+                def quote(s):
+                    r, count = subn(r"([&<>()|,;^])", r"^^^\1", s)
+                    if count:
+                        return '"""' + r + '"""'
+                    return s

Review comment:
       Can we put this in a utils function and or is there a library that does 
this escaping? I imagine there's a bunch of random values and I'd rather us get 
them all.




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