itholic commented on code in PR #43237:
URL: https://github.com/apache/spark/pull/43237#discussion_r1348172327


##########
python/pyspark/pandas/sql_formatter.py:
##########
@@ -200,7 +201,8 @@ def sql(
     try:
         sdf = session.sql(formatter.format(query, **kwargs), args)
     finally:
-        formatter.clear()
+        if not is_remote():
+            formatter.clear()

Review Comment:
   We should keep the temp view for Spark Connect after formatting. Otherwise, 
it fails to find a view properly.
   
   ```
   org.apache.spark.sql.catalyst.ExtendedAnalysisException: 
[TABLE_OR_VIEW_NOT_FOUND] The table or view 
`_pandas_api_d2d7164cc1894c8895bc7f0c541db96b` cannot be found. Verify the 
spelling and correctness of the schema and catalog.
   If you did not qualify the name with a schema, verify the current_schema() 
output, or qualify the name with the correct schema and catalog.
   To tolerate the error on drop use DROP VIEW IF EXISTS or DROP TABLE IF 
EXISTS.; line 1 pos 14;
   ```



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