HyukjinKwon commented on code in PR #36161:
URL: https://github.com/apache/spark/pull/36161#discussion_r849997242
##########
python/pyspark/sql/session.py:
##########
@@ -276,8 +315,20 @@ def getOrCreate(self) -> "SparkSession":
).applyModifiableSettings(session._jsparkSession,
self._options)
return session
- builder = Builder()
- """A class attribute having a :class:`Builder` to construct
:class:`SparkSession` instances."""
+ # TODO: This workaround can be dropped once support for Python 3.8 is
dropped
+ # In Python 3.9, the @property decorator has been made compatible with the
@classmethod decorator.
+ # https://docs.python.org/3.9/library/functions.html#classmethod
+ if sys.version >= "3.9":
+ @classmethod
+ @property
+ def builder(cls):
+ """A class attribute having a :class:`Builder` to construct
:class:`SparkSession` instances."""
+ return cls.Builder()
+ else:
+ @classproperty
+ def builder(cls):
+ """A class attribute having a :class:`Builder` to construct
:class:`SparkSession` instances."""
+ return cls.Builder()
Review Comment:
Let's don't bother w/ the old codes, and just leave it as is. We will likely
drop Python 3.8 in the near future in any event.
--
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]