xupefei commented on code in PR #48651:
URL: https://github.com/apache/spark/pull/48651#discussion_r1832731995
##########
python/pyspark/sql/tests/test_connect_compatibility.py:
##########
@@ -60,16 +60,23 @@
from pyspark.sql.connect.streaming.readwriter import DataStreamReader as
ConnectDataStreamReader
from pyspark.sql.connect.streaming.readwriter import DataStreamWriter as
ConnectDataStreamWriter
+SPARK_CONNECT_ONLY = "spark_connect_only"
+
class ConnectCompatibilityTestsMixin:
def get_public_methods(self, cls):
"""Get public methods of a class."""
- return {
- name: method
- for name, method in inspect.getmembers(cls)
- if (inspect.isfunction(method) or isinstance(method,
functools._lru_cache_wrapper))
- and not name.startswith("_")
- }
+ methods = {}
+ for name, method in inspect.getmembers(cls):
+ if (
+ inspect.isfunction(method) or isinstance(method,
functools._lru_cache_wrapper)
+ ) and not name.startswith("_"):
+ source_lines = inspect.getsource(method).upper()
+ if "ONLY_SUPPORTED_WITH_SPARK_CONNECT" in source_lines:
Review Comment:
How about using a new decorator `@SparkConnectOnly` which doesn't suffer
from flakiness? So instead of having a list in
`test_spark_session_compatibility` we now spread the items to their declaration
sites.
That would make people more aware of adding such a decorator when needed.
--
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]