Github user 0x0FFF commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8556#discussion_r38460209
  
    --- Diff: python/pyspark/sql/types.py ---
    @@ -168,10 +168,12 @@ def needConversion(self):
             return True
     
         def toInternal(self, d):
    -        return d and d.toordinal() - self.EPOCH_ORDINAL
    +        if d is not None:
    --- End diff --
    
    It will be false for None, empty string, empty list, 0. This way it will be 
returned instead of the date:
    ```
    >>> [] and 'foo'
    []
    >>> 0 and 'foo'
    0
    >>> 1 and 'foo'
    'foo'
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to