{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/8983","labels_url":"https://api.github.com/repos/apache/spark/issues/8983/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/8983/comments","events_url":"https://api.github.com/repos/apache/spark/issues/8983/events","html_url":"https://github.com/apache/spark/pull/8983","id":109861398,"number":8983,"title":"[SPARK-8654][SQL] Fix Analysis exception when using NULL IN (...)","user":{"login":"dilipbiswal","id":14225158,"avatar_url":"https://avatars.githubusercontent.com/u/14225158?v=3","gravatar_id":"","url":"https://api.github.com/users/dilipbiswal","html_url":"https://github.com/dilipbiswal","followers_url":"https://api.github.com/users/dilipbiswal/followers","following_url":"https://api.github.com/users/dilipbiswal/following{/other_user}","gists_url":"https://api.github.com/users/dilipbiswal/gists{/gist_id}","starred_url":"https://api.github.com/users/dilipbiswal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dilipbiswal/subscriptions","organizations_url":"https://api.github.com/users/dilipbiswal/orgs","repos_url":"https://api.github.com/users/dilipbiswal/repos","events_url":"https://api.github.com/users/dilipbiswal/events{/privacy}","received_events_url":"https://api.github.com/users/dilipbiswal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-05T18:49:07Z","updated_at":"2015-10-05T20:51:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/8983","html_url":"https://github.com/apache/spark/pull/8983","diff_url":"https://github.com/apache/spark/pull/8983.diff","patch_url":"https://github.com/apache/spark/pull/8983.patch"},"body":"In the analysis phase , while processing the rules for IN predicate, we\r\ncompare the in-list types to the lhs expression type and generate\r\ncast operation if necessary. In the case of NULL [NOT] IN expr1 , we end up\r\ngenerating cast between in list types to NULL like cast (1 as NULL) which\r\nis not a valid cast.\r\n\r\nThe fix is to not generate such a cast if the lhs type is a NullType instead\r\nwe translate the expression to Literal(Null)."},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/145664718","html_url":"https://github.com/apache/spark/pull/8983#issuecomment-145664718","issue_url":"https://api.github.com/repos/apache/spark/issues/8983","id":145664718,"user":{"login":"dilipbiswal","id":14225158,"avatar_url":"https://avatars.githubusercontent.com/u/14225158?v=3","gravatar_id":"","url":"https://api.github.com/users/dilipbiswal","html_url":"https://github.com/dilipbiswal","followers_url":"https://api.github.com/users/dilipbiswal/followers","following_url":"https://api.github.com/users/dilipbiswal/following{/other_user}","gists_url":"https://api.github.com/users/dilipbiswal/gists{/gist_id}","starred_url":"https://api.github.com/users/dilipbiswal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dilipbiswal/subscriptions","organizations_url":"https://api.github.com/users/dilipbiswal/orgs","repos_url":"https://api.github.com/users/dilipbiswal/repos","events_url":"https://api.github.com/users/dilipbiswal/events{/privacy}","received_events_url":"https://api.github.com/users/dilipbiswal/received_events","type":"User","site_admin":false},"created_at":"2015-10-05T20:51:13Z","updated_at":"2015-10-05T20:51:13Z","body":"Thanks !! \r\n\r\nDo we need to look at the in list types in this case ? The in list types could be literals of different types , right ? for example NULL not in (1, 'a')\r\n\r\nSince the result of IN predicate is a boolean type, i thought  it would be safe to transform it to\r\na Null literal of boolean type. Are you thinking of a case where this would not work ?\r\n\r\nThanks a lot in advance for your help.\r\n"}}