{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/34216605","id":34216605,"diff_hunk":"@@ -37,7 +37,16 @@ trait ExpectsInputTypes { self: Expression =>\n   def inputTypes: Seq[AbstractDataType]\n \n   override def checkInputDataTypes(): TypeCheckResult = {\n-    // TODO: implement proper type checking.\n-    TypeCheckResult.TypeCheckSuccess\n+    val mismatches = children.zip(inputTypes).zipWithIndex.collect {\n+      case ((child, expected), idx) if !expected.acceptsType(child.dataType) =>\n+        s\"Argument ${idx + 1} is expected to be of type ${expected.simpleString}, \" +\n+        s\"however, ${child.prettyString} is of type ${child.dataType.simpleString}.\"","path":"sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ExpectsInputTypes.scala","position":9,"original_position":9,"commit_id":"c654a0e4f308d53e82ab78e6679eabd43649d9db","original_commit_id":"c654a0e4f308d53e82ab78e6679eabd43649d9db","user":{"login":"rxin","id":323388,"avatar_url":"https://avatars.githubusercontent.com/u/323388?v=3","gravatar_id":"","url":"https://api.github.com/users/rxin","html_url":"https://github.com/rxin","followers_url":"https://api.github.com/users/rxin/followers","following_url":"https://api.github.com/users/rxin/following{/other_user}","gists_url":"https://api.github.com/users/rxin/gists{/gist_id}","starred_url":"https://api.github.com/users/rxin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rxin/subscriptions","organizations_url":"https://api.github.com/users/rxin/orgs","repos_url":"https://api.github.com/users/rxin/repos","events_url":"https://api.github.com/users/rxin/events{/privacy}","received_events_url":"https://api.github.com/users/rxin/received_events","type":"User","site_admin":false},"body":"quote child.prettyString","created_at":"2015-07-09T01:27:16Z","updated_at":"2015-07-09T01:27:16Z","html_url":"https://github.com/apache/spark/pull/7303#discussion_r34216605","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/7303","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/34216605"},"html":{"href":"https://github.com/apache/spark/pull/7303#discussion_r34216605"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/7303"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/7303","id":39534882,"html_url":"https://github.com/apache/spark/pull/7303","diff_url":"https://github.com/apache/spark/pull/7303.diff","patch_url":"https://github.com/apache/spark/pull/7303.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/7303","number":7303,"state":"open","locked":false,"title":"[SPARK-8926][SQL] Good errors for ExpectsInputType expressions","user":{"login":"marmbrus","id":527,"avatar_url":"https://avatars.githubusercontent.com/u/527?v=3","gravatar_id":"","url":"https://api.github.com/users/marmbrus","html_url":"https://github.com/marmbrus","followers_url":"https://api.github.com/users/marmbrus/followers","following_url":"https://api.github.com/users/marmbrus/following{/other_user}","gists_url":"https://api.github.com/users/marmbrus/gists{/gist_id}","starred_url":"https://api.github.com/users/marmbrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marmbrus/subscriptions","organizations_url":"https://api.github.com/users/marmbrus/orgs","repos_url":"https://api.github.com/users/marmbrus/repos","events_url":"https://api.github.com/users/marmbrus/events{/privacy}","received_events_url":"https://api.github.com/users/marmbrus/received_events","type":"User","site_admin":false},"body":"For example: `cannot resolve 'testfunction(null)' due to data type mismatch: argument 1 is expected to be of type int, however, null is of type datetype.`","created_at":"2015-07-08T23:35:03Z","updated_at":"2015-07-09T01:27:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2cb5e4e468b9f5c03382d8cb161526d73f262492","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/7303/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/7303/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/7303/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/c654a0e4f308d53e82ab78e6679eabd43649d9db","head":{"label":"marmbrus:expectsTypeErrors","ref":"expectsTypeErrors","sha":"c654a0e4f308d53e82ab78e6679eabd43649d9db","user":{"login":"marmbrus","id":527,"avatar_url":"https://avatars.githubusercontent.com/u/527?v=3","gravatar_id":"","url":"https://api.github.com/users/marmbrus","html_url":"https://github.com/marmbrus","followers_url":"https://api.github.com/users/marmbrus/followers","following_url":"https://api.github.com/users/marmbrus/following{/other_user}","gists_url":"https://api.github.com/users/marmbrus/gists{/gist_id}","starred_url":"https://api.github.com/users/marmbrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marmbrus/subscriptions","organizations_url":"https://api.github.com/users/marmbrus/orgs","repos_url":"https://api.github.com/users/marmbrus/repos","events_url":"https://api.github.com/users/marmbrus/events{/privacy}","received_events_url":"https://api.github.com/users/marmbrus/received_events","type":"User","site_admin":false},"repo":{"id":17230869,"name":"spark","full_name":"marmbrus/spark","owner":{"login":"marmbrus","id":527,"avatar_url":"https://avatars.githubusercontent.com/u/527?v=3","gravatar_id":"","url":"https://api.github.com/users/marmbrus","html_url":"https://github.com/marmbrus","followers_url":"https://api.github.com/users/marmbrus/followers","following_url":"https://api.github.com/users/marmbrus/following{/other_user}","gists_url":"https://api.github.com/users/marmbrus/gists{/gist_id}","starred_url":"https://api.github.com/users/marmbrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marmbrus/subscriptions","organizations_url":"https://api.github.com/users/marmbrus/orgs","repos_url":"https://api.github.com/users/marmbrus/repos","events_url":"https://api.github.com/users/marmbrus/events{/privacy}","received_events_url":"https://api.github.com/users/marmbrus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marmbrus/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/marmbrus/spark","forks_url":"https://api.github.com/repos/marmbrus/spark/forks","keys_url":"https://api.github.com/repos/marmbrus/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marmbrus/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marmbrus/spark/teams","hooks_url":"https://api.github.com/repos/marmbrus/spark/hooks","issue_events_url":"https://api.github.com/repos/marmbrus/spark/issues/events{/number}","events_url":"https://api.github.com/repos/marmbrus/spark/events","assignees_url":"https://api.github.com/repos/marmbrus/spark/assignees{/user}","branches_url":"https://api.github.com/repos/marmbrus/spark/branches{/branch}","tags_url":"https://api.github.com/repos/marmbrus/spark/tags","blobs_url":"https://api.github.com/repos/marmbrus/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marmbrus/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marmbrus/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/marmbrus/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marmbrus/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/marmbrus/spark/languages","stargazers_url":"https://api.github.com/repos/marmbrus/spark/stargazers","contributors_url":"https://api.github.com/repos/marmbrus/spark/contributors","subscribers_url":"https://api.github.com/repos/marmbrus/spark/subscribers","subscription_url":"https://api.github.com/repos/marmbrus/spark/subscription","commits_url":"https://api.github.com/repos/marmbrus/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/marmbrus/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/marmbrus/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/marmbrus/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/marmbrus/spark/contents/{+path}","compare_url":"https://api.github.com/repos/marmbrus/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marmbrus/spark/merges","archive_url":"https://api.github.com/repos/marmbrus/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marmbrus/spark/downloads","issues_url":"https://api.github.com/repos/marmbrus/spark/issues{/number}","pulls_url":"https://api.github.com/repos/marmbrus/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/marmbrus/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/marmbrus/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marmbrus/spark/labels{/name}","releases_url":"https://api.github.com/repos/marmbrus/spark/releases{/id}","created_at":"2014-02-27T00:22:54Z","updated_at":"2014-11-27T06:21:59Z","pushed_at":"2015-07-09T00:50:56Z","git_url":"git://github.com/marmbrus/spark.git","ssh_url":"git@github.com:marmbrus/spark.git","clone_url":"https://github.com/marmbrus/spark.git","svn_url":"https://github.com/marmbrus/spark","homepage":null,"size":156521,"stargazers_count":2,"watchers_count":2,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":2,"default_branch":"catalyst"}},"base":{"label":"apache:master","ref":"master","sha":"f472b8cdc00839780dc79be0bbe53a098cde230c","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-07-08T19:52:12Z","pushed_at":"2015-07-09T01:27:12Z","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":1513790,"stargazers_count":4679,"watchers_count":4679,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4148,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":345,"forks":4148,"open_issues":345,"watchers":4679,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/7303"},"html":{"href":"https://github.com/apache/spark/pull/7303"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/7303"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/7303/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/7303/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/7303/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/c654a0e4f308d53e82ab78e6679eabd43649d9db"}}}}