dongjoon-hyun commented on code in PR #36161:
URL: https://github.com/apache/spark/pull/36161#discussion_r850860115
##########
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:
Actually, it's a little difficult to drop Python 3.8 because the end of
support is 2024/10.
- https://www.python.org/downloads
Python 3.7 also is still used frequently like in Google Colab because the
end of support is 2023-06-27.
<img width="253" alt="Screen Shot 2022-04-14 at 3 35 06 PM"
src="https://user-images.githubusercontent.com/9700541/163488911-313a3df5-3d85-465f-9ecb-bc28c6d671cf.png">
--
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]