You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2023/07/11 04:56:41 UTC

[GitHub] [spark] zhengruifeng commented on a diff in pull request #41931: [SPARK-43665][CONNECT][PS] Enable PandasSQLStringFormatter.vformat to work with Spark Connect

zhengruifeng commented on code in PR #41931:
URL: https://github.com/apache/spark/pull/41931#discussion_r1259184198


##########
python/pyspark/pandas/sql_formatter.py:
##########
@@ -265,7 +266,10 @@ def _convert_value(self, val: Any, name: str) -> Optional[str]:
             val._to_spark().createOrReplaceTempView(df_name)
             return df_name
         elif isinstance(val, str):
-            return lit(val)._jc.expr().sql()  # for escaped characters.
+            if is_remote():
+                return f"'{val}'"

Review Comment:
   I think there is behavior change:
   
   ```
   In [1]: from pyspark.sql.functions import *
   
   In [2]: val = "a'''c''d"
   
   In [3]: lit(val)._jc.expr().sql()
   Out[3]: "'a\\'\\'\\'c\\'\\'d'"
   ```



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