{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/38456406","id":38456406,"diff_hunk":"@@ -168,10 +168,12 @@ def needConversion(self):\n         return True\n \n     def toInternal(self, d):\n-        return d and d.toordinal() - self.EPOCH_ORDINAL\n+        if d is not None:","path":"python/pyspark/sql/types.py","position":5,"original_position":5,"commit_id":"7985de776958ddec7335a3399f2a6d772dbb18e1","original_commit_id":"7985de776958ddec7335a3399f2a6d772dbb18e1","user":{"login":"davies","id":40902,"avatar_url":"https://avatars.githubusercontent.com/u/40902?v=3","gravatar_id":"","url":"https://api.github.com/users/davies","html_url":"https://github.com/davies","followers_url":"https://api.github.com/users/davies/followers","following_url":"https://api.github.com/users/davies/following{/other_user}","gists_url":"https://api.github.com/users/davies/gists{/gist_id}","starred_url":"https://api.github.com/users/davies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davies/subscriptions","organizations_url":"https://api.github.com/users/davies/orgs","repos_url":"https://api.github.com/users/davies/repos","events_url":"https://api.github.com/users/davies/events{/privacy}","received_events_url":"https://api.github.com/users/davies/received_events","type":"User","site_admin":false},"body":"I think this change is not needed, `d` will always be true if it's not None","created_at":"2015-09-01T18:49:14Z","updated_at":"2015-09-01T18:49:14Z","html_url":"https://github.com/apache/spark/pull/8556#discussion_r38456406","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/8556","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/38456406"},"html":{"href":"https://github.com/apache/spark/pull/8556#discussion_r38456406"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/8556"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/8556","id":43875976,"html_url":"https://github.com/apache/spark/pull/8556","diff_url":"https://github.com/apache/spark/pull/8556.diff","patch_url":"https://github.com/apache/spark/pull/8556.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/8556","number":8556,"state":"open","locked":false,"title":"[SPARK-10392] [SQL] Pyspark - Wrong DateType support on JDBC connection","user":{"login":"0x0FFF","id":1366872,"avatar_url":"https://avatars.githubusercontent.com/u/1366872?v=3","gravatar_id":"","url":"https://api.github.com/users/0x0FFF","html_url":"https://github.com/0x0FFF","followers_url":"https://api.github.com/users/0x0FFF/followers","following_url":"https://api.github.com/users/0x0FFF/following{/other_user}","gists_url":"https://api.github.com/users/0x0FFF/gists{/gist_id}","starred_url":"https://api.github.com/users/0x0FFF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0x0FFF/subscriptions","organizations_url":"https://api.github.com/users/0x0FFF/orgs","repos_url":"https://api.github.com/users/0x0FFF/repos","events_url":"https://api.github.com/users/0x0FFF/events{/privacy}","received_events_url":"https://api.github.com/users/0x0FFF/received_events","type":"User","site_admin":false},"body":"This PR addresses issue [SPARK-10392](https://issues.apache.org/jira/browse/SPARK-10392)\r\nThe problem is that for \"start of epoch\" date (01 Jan 1970) PySpark class DateType returns 0 instead of the `datetime.date` due to implementation of its return statement\r\n\r\nIssue reproduction on master:\r\n```\r\n>>> from pyspark.sql.types import *\r\n>>> a = DateType()\r\n>>> a.fromInternal(0)\r\n0\r\n>>> a.fromInternal(1)\r\ndatetime.date(1970, 1, 2)\r\n```","created_at":"2015-09-01T13:37:10Z","updated_at":"2015-09-01T18:49:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"40d760d8ab1da5116fbe3c90376a97dab41a240b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/8556/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/8556/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/8556/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/7985de776958ddec7335a3399f2a6d772dbb18e1","head":{"label":"0x0FFF:SPARK-10392","ref":"SPARK-10392","sha":"7985de776958ddec7335a3399f2a6d772dbb18e1","user":{"login":"0x0FFF","id":1366872,"avatar_url":"https://avatars.githubusercontent.com/u/1366872?v=3","gravatar_id":"","url":"https://api.github.com/users/0x0FFF","html_url":"https://github.com/0x0FFF","followers_url":"https://api.github.com/users/0x0FFF/followers","following_url":"https://api.github.com/users/0x0FFF/following{/other_user}","gists_url":"https://api.github.com/users/0x0FFF/gists{/gist_id}","starred_url":"https://api.github.com/users/0x0FFF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0x0FFF/subscriptions","organizations_url":"https://api.github.com/users/0x0FFF/orgs","repos_url":"https://api.github.com/users/0x0FFF/repos","events_url":"https://api.github.com/users/0x0FFF/events{/privacy}","received_events_url":"https://api.github.com/users/0x0FFF/received_events","type":"User","site_admin":false},"repo":{"id":41735678,"name":"spark","full_name":"0x0FFF/spark","owner":{"login":"0x0FFF","id":1366872,"avatar_url":"https://avatars.githubusercontent.com/u/1366872?v=3","gravatar_id":"","url":"https://api.github.com/users/0x0FFF","html_url":"https://github.com/0x0FFF","followers_url":"https://api.github.com/users/0x0FFF/followers","following_url":"https://api.github.com/users/0x0FFF/following{/other_user}","gists_url":"https://api.github.com/users/0x0FFF/gists{/gist_id}","starred_url":"https://api.github.com/users/0x0FFF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0x0FFF/subscriptions","organizations_url":"https://api.github.com/users/0x0FFF/orgs","repos_url":"https://api.github.com/users/0x0FFF/repos","events_url":"https://api.github.com/users/0x0FFF/events{/privacy}","received_events_url":"https://api.github.com/users/0x0FFF/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/0x0FFF/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/0x0FFF/spark","forks_url":"https://api.github.com/repos/0x0FFF/spark/forks","keys_url":"https://api.github.com/repos/0x0FFF/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/0x0FFF/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/0x0FFF/spark/teams","hooks_url":"https://api.github.com/repos/0x0FFF/spark/hooks","issue_events_url":"https://api.github.com/repos/0x0FFF/spark/issues/events{/number}","events_url":"https://api.github.com/repos/0x0FFF/spark/events","assignees_url":"https://api.github.com/repos/0x0FFF/spark/assignees{/user}","branches_url":"https://api.github.com/repos/0x0FFF/spark/branches{/branch}","tags_url":"https://api.github.com/repos/0x0FFF/spark/tags","blobs_url":"https://api.github.com/repos/0x0FFF/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/0x0FFF/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/0x0FFF/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/0x0FFF/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/0x0FFF/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/0x0FFF/spark/languages","stargazers_url":"https://api.github.com/repos/0x0FFF/spark/stargazers","contributors_url":"https://api.github.com/repos/0x0FFF/spark/contributors","subscribers_url":"https://api.github.com/repos/0x0FFF/spark/subscribers","subscription_url":"https://api.github.com/repos/0x0FFF/spark/subscription","commits_url":"https://api.github.com/repos/0x0FFF/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/0x0FFF/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/0x0FFF/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/0x0FFF/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/0x0FFF/spark/contents/{+path}","compare_url":"https://api.github.com/repos/0x0FFF/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/0x0FFF/spark/merges","archive_url":"https://api.github.com/repos/0x0FFF/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/0x0FFF/spark/downloads","issues_url":"https://api.github.com/repos/0x0FFF/spark/issues{/number}","pulls_url":"https://api.github.com/repos/0x0FFF/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/0x0FFF/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/0x0FFF/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/0x0FFF/spark/labels{/name}","releases_url":"https://api.github.com/repos/0x0FFF/spark/releases{/id}","created_at":"2015-09-01T11:54:38Z","updated_at":"2015-09-01T11:55:01Z","pushed_at":"2015-09-01T18:25:48Z","git_url":"git://github.com/0x0FFF/spark.git","ssh_url":"git@github.com:0x0FFF/spark.git","clone_url":"https://github.com/0x0FFF/spark.git","svn_url":"https://github.com/0x0FFF/spark","homepage":null,"size":123433,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"391e6be0ae883f3ea0fab79463eb8b618af79afb","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17165658,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/spark","description":"Mirror of Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","created_at":"2014-02-25T08:00:08Z","updated_at":"2015-09-01T15:51:15Z","pushed_at":"2015-09-01T18:25:50Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":null,"size":1704056,"stargazers_count":5270,"watchers_count":5270,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4836,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":371,"forks":4836,"open_issues":371,"watchers":5270,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/8556"},"html":{"href":"https://github.com/apache/spark/pull/8556"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/8556"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/8556/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/8556/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/8556/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/7985de776958ddec7335a3399f2a6d772dbb18e1"}}}}