{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/35294849","id":35294849,"diff_hunk":"@@ -35,3 +36,47 @@ case class Size(child: Expression) extends UnaryExpression with ExpectsInputType\n     nullSafeCodeGen(ctx, ev, c => s\"${ev.primitive} = ($c).size();\")\n   }\n }\n+\n+case class ArrayContains(left: Expression, right: Expression) extends BinaryExpression with ExpectsInputTypes {\n+  override def dataType: DataType = BooleanType\n+\n+  override def inputTypes: Seq[AbstractDataType] = Seq(ArrayType, AnyDataType)","path":"sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala","position":16,"original_position":16,"commit_id":"52c02e585c908473895b27a32bc6cd70010ff6a1","original_commit_id":"52c02e585c908473895b27a32bc6cd70010ff6a1","user":{"login":"chenghao-intel","id":2367031,"avatar_url":"https://avatars.githubusercontent.com/u/2367031?v=3","gravatar_id":"","url":"https://api.github.com/users/chenghao-intel","html_url":"https://github.com/chenghao-intel","followers_url":"https://api.github.com/users/chenghao-intel/followers","following_url":"https://api.github.com/users/chenghao-intel/following{/other_user}","gists_url":"https://api.github.com/users/chenghao-intel/gists{/gist_id}","starred_url":"https://api.github.com/users/chenghao-intel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenghao-intel/subscriptions","organizations_url":"https://api.github.com/users/chenghao-intel/orgs","repos_url":"https://api.github.com/users/chenghao-intel/repos","events_url":"https://api.github.com/users/chenghao-intel/events{/privacy}","received_events_url":"https://api.github.com/users/chenghao-intel/received_events","type":"User","site_admin":false},"body":"Sorry, I mean we don't need the implicit casting, as it's not the same behavior in Hive.\r\nOr are you trying to implicit casting?\r\n","created_at":"2015-07-23T07:09:39Z","updated_at":"2015-07-23T07:09:39Z","html_url":"https://github.com/apache/spark/pull/7580#discussion_r35294849","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/7580","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/35294849"},"html":{"href":"https://github.com/apache/spark/pull/7580#discussion_r35294849"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/7580"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/7580","id":40516514,"html_url":"https://github.com/apache/spark/pull/7580","diff_url":"https://github.com/apache/spark/pull/7580.diff","patch_url":"https://github.com/apache/spark/pull/7580.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/7580","number":7580,"state":"open","locked":false,"title":"[SPARK-8231][SQL][WIP] Add array_contains","user":{"login":"EntilZha","id":1382460,"avatar_url":"https://avatars.githubusercontent.com/u/1382460?v=3","gravatar_id":"","url":"https://api.github.com/users/EntilZha","html_url":"https://github.com/EntilZha","followers_url":"https://api.github.com/users/EntilZha/followers","following_url":"https://api.github.com/users/EntilZha/following{/other_user}","gists_url":"https://api.github.com/users/EntilZha/gists{/gist_id}","starred_url":"https://api.github.com/users/EntilZha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EntilZha/subscriptions","organizations_url":"https://api.github.com/users/EntilZha/orgs","repos_url":"https://api.github.com/users/EntilZha/repos","events_url":"https://api.github.com/users/EntilZha/events{/privacy}","received_events_url":"https://api.github.com/users/EntilZha/received_events","type":"User","site_admin":false},"body":"PR for work on https://issues.apache.org/jira/browse/SPARK-8231\r\n\r\nCurrently, I have an initial implementation for contains. Based on discussion on JIRA, it should behave same as Hive: https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFArrayContains.java#L102-L128\r\n\r\nMain points are:\r\n1. If the array is empty, null, or the value is null, return false\r\n2. If there is a type mismatch, throw error\r\n3. If comparison is not supported, throw error\r\n\r\nThus far, I have 1 implemented, however the codegen is failing. A nudge in the right direction would be helpful. I am also uncertain if I should be directly outputting the code or using a helper function. I am directly outputting the code because my understanding is if the return value should not be null if any of the arguments are null, then it needs to be custom.\r\n\r\nI have an idea of how to do 2 based on other code I have seen, and google probably knows how to find out 3.\r\n\r\nAdditionally, still need to:\r\n1. Add docs\r\n2. Add python API","created_at":"2015-07-21T23:32:05Z","updated_at":"2015-07-23T07:09:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"77d3a35c9a0739f440124a4ad857303f193e605e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/7580/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/7580/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/7580/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/52c02e585c908473895b27a32bc6cd70010ff6a1","head":{"label":"EntilZha:SPARK-8231","ref":"SPARK-8231","sha":"52c02e585c908473895b27a32bc6cd70010ff6a1","user":{"login":"EntilZha","id":1382460,"avatar_url":"https://avatars.githubusercontent.com/u/1382460?v=3","gravatar_id":"","url":"https://api.github.com/users/EntilZha","html_url":"https://github.com/EntilZha","followers_url":"https://api.github.com/users/EntilZha/followers","following_url":"https://api.github.com/users/EntilZha/following{/other_user}","gists_url":"https://api.github.com/users/EntilZha/gists{/gist_id}","starred_url":"https://api.github.com/users/EntilZha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EntilZha/subscriptions","organizations_url":"https://api.github.com/users/EntilZha/orgs","repos_url":"https://api.github.com/users/EntilZha/repos","events_url":"https://api.github.com/users/EntilZha/events{/privacy}","received_events_url":"https://api.github.com/users/EntilZha/received_events","type":"User","site_admin":false},"repo":{"id":19327912,"name":"spark","full_name":"EntilZha/spark","owner":{"login":"EntilZha","id":1382460,"avatar_url":"https://avatars.githubusercontent.com/u/1382460?v=3","gravatar_id":"","url":"https://api.github.com/users/EntilZha","html_url":"https://github.com/EntilZha","followers_url":"https://api.github.com/users/EntilZha/followers","following_url":"https://api.github.com/users/EntilZha/following{/other_user}","gists_url":"https://api.github.com/users/EntilZha/gists{/gist_id}","starred_url":"https://api.github.com/users/EntilZha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EntilZha/subscriptions","organizations_url":"https://api.github.com/users/EntilZha/orgs","repos_url":"https://api.github.com/users/EntilZha/repos","events_url":"https://api.github.com/users/EntilZha/events{/privacy}","received_events_url":"https://api.github.com/users/EntilZha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/EntilZha/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/EntilZha/spark","forks_url":"https://api.github.com/repos/EntilZha/spark/forks","keys_url":"https://api.github.com/repos/EntilZha/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/EntilZha/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/EntilZha/spark/teams","hooks_url":"https://api.github.com/repos/EntilZha/spark/hooks","issue_events_url":"https://api.github.com/repos/EntilZha/spark/issues/events{/number}","events_url":"https://api.github.com/repos/EntilZha/spark/events","assignees_url":"https://api.github.com/repos/EntilZha/spark/assignees{/user}","branches_url":"https://api.github.com/repos/EntilZha/spark/branches{/branch}","tags_url":"https://api.github.com/repos/EntilZha/spark/tags","blobs_url":"https://api.github.com/repos/EntilZha/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/EntilZha/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/EntilZha/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/EntilZha/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/EntilZha/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/EntilZha/spark/languages","stargazers_url":"https://api.github.com/repos/EntilZha/spark/stargazers","contributors_url":"https://api.github.com/repos/EntilZha/spark/contributors","subscribers_url":"https://api.github.com/repos/EntilZha/spark/subscribers","subscription_url":"https://api.github.com/repos/EntilZha/spark/subscription","commits_url":"https://api.github.com/repos/EntilZha/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/EntilZha/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/EntilZha/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/EntilZha/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/EntilZha/spark/contents/{+path}","compare_url":"https://api.github.com/repos/EntilZha/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/EntilZha/spark/merges","archive_url":"https://api.github.com/repos/EntilZha/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/EntilZha/spark/downloads","issues_url":"https://api.github.com/repos/EntilZha/spark/issues{/number}","pulls_url":"https://api.github.com/repos/EntilZha/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/EntilZha/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/EntilZha/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/EntilZha/spark/labels{/name}","releases_url":"https://api.github.com/repos/EntilZha/spark/releases{/id}","created_at":"2014-04-30T21:31:22Z","updated_at":"2015-02-26T03:58:28Z","pushed_at":"2015-07-23T06:50:12Z","git_url":"git://github.com/EntilZha/spark.git","ssh_url":"git@github.com:EntilZha/spark.git","clone_url":"https://github.com/EntilZha/spark.git","svn_url":"https://github.com/EntilZha/spark","homepage":null,"size":106940,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"d4c7a7a3642a74ad40093c96c4bf45a62a470605","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-23T03:59:07Z","pushed_at":"2015-07-23T06:50:14Z","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":1581047,"stargazers_count":4832,"watchers_count":4832,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4337,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":331,"forks":4337,"open_issues":331,"watchers":4832,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/7580"},"html":{"href":"https://github.com/apache/spark/pull/7580"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/7580"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/7580/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/7580/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/7580/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/52c02e585c908473895b27a32bc6cd70010ff6a1"}}}}