Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21437#discussion_r191877900
  
    --- Diff: python/pyspark/taskcontext.py ---
    @@ -88,3 +89,9 @@ def taskAttemptId(self):
             TaskAttemptID.
             """
             return self._taskAttemptId
    +
    +    def getLocalProperty(self, key):
    +        """
    +        Get a local property set upstream in the driver, or None if it is 
missing.
    --- End diff --
    
    The Java / Scala equivalents of this API return `null` for missing keys, so 
on the one hand returning `None` is kinda consistent with that.
    
    On the other hand, consider a case where you want to specify an alternative 
in case a key is not set:
    
    With this API, you might think of doing something like 
`tc.getLocalProperty('key') or 'defaultValue'`, which potentially could be a 
problem in case a non-None key could have a `False`-y value. I suppose we're 
only dealing with strings here, though, and that'd only happen for empty 
strings. If we allowed non-strings to be returned here, though, then we'd have 
problems if we're returning values like `0`. For that case, having a 
`getLocalProperty('key', 'defaultValue')` is a bit more useful.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to