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


##########
python/pyspark/testing/connectutils.py:
##########
@@ -58,7 +60,18 @@ class PlanOnlyTestFixture(unittest.TestCase):
 
     connect: "MockRemoteSession"
 
+    @classmethod
+    def _read_table(cls, table_name: str) -> "DataFrame":
+        return DataFrame.withPlan(Read(table_name), cls.connect)
+
+    @classmethod
+    def _udf_mock(cls, *args, **kwargs):
+        return "internal_name"
+
     @classmethod
     def setUpClass(cls: Any) -> None:
         cls.connect = MockRemoteSession()
         cls.tbl_name = f"tbl{uuid.uuid4()}".replace("-", "")
+
+        cls.connect.set_hook("register_udf", cls._udf_mock)
+        cls.connect.set_hook("readTable", cls._read_table)

Review Comment:
   I think we should also drop the table and udf at `teardownClass`.



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