Github user HyukjinKwon commented on a diff in the pull request: https://github.com/apache/spark/pull/22962#discussion_r232447967 --- Diff: python/pyspark/taskcontext.py --- @@ -144,10 +144,19 @@ def __init__(self): """Construct a BarrierTaskContext, use get instead""" pass + def __new__(cls): + """ + Rewrite __new__ method to BarrierTaskContext for _getOrCreate called when _taskContext + is not instance of BarrierTaskContext. + """ + if not isinstance(cls._taskContext, BarrierTaskContext): + cls._taskContext = object.__new__(cls) + return cls._taskContext --- End diff -- Why should we rewrite `__new__`?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org