{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/12340","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/12340/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/12340/comments","events_url":"https://api.github.com/repos/apache/spark/issues/12340/events","html_url":"https://github.com/apache/spark/pull/12340","id":147891806,"number":12340,"title":"[SPARK-14580][SPARK-14655][SQL] Hive IfCoercion should preserve predicate.","user":{"login":"dongjoon-hyun","id":9700541,"avatar_url":"https://avatars.githubusercontent.com/u/9700541?v=3","gravatar_id":"","url":"https://api.github.com/users/dongjoon-hyun","html_url":"https://github.com/dongjoon-hyun","followers_url":"https://api.github.com/users/dongjoon-hyun/followers","following_url":"https://api.github.com/users/dongjoon-hyun/following{/other_user}","gists_url":"https://api.github.com/users/dongjoon-hyun/gists{/gist_id}","starred_url":"https://api.github.com/users/dongjoon-hyun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dongjoon-hyun/subscriptions","organizations_url":"https://api.github.com/users/dongjoon-hyun/orgs","repos_url":"https://api.github.com/users/dongjoon-hyun/repos","events_url":"https://api.github.com/users/dongjoon-hyun/events{/privacy}","received_events_url":"https://api.github.com/users/dongjoon-hyun/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2016-04-12T22:28:30Z","updated_at":"2016-04-15T10:57:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/12340","html_url":"https://github.com/apache/spark/pull/12340","diff_url":"https://github.com/apache/spark/pull/12340.diff","patch_url":"https://github.com/apache/spark/pull/12340.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nCurrently, `HiveTypeCoercion.IfCoercion` removes all predicates whose return-type are null. However, some UDFs need evaluations because they are designed to throw exceptions. This PR fixes that to preserve the predicates. Also, `assert_true` is implemented as Spark SQL function.\r\n\r\n**Before**\r\n```\r\nscala> sql(\"select if(assert_true(false),2,3)\").head\r\nres2: org.apache.spark.sql.Row = [3]\r\n```\r\n\r\n**After**\r\n```\r\nscala> sql(\"select if(assert_true(false),2,3)\").head\r\n... ASSERT_TRUE ...\r\n```\r\n\r\n**Hive**\r\n```\r\nhive> select if(assert_true(false),2,3);\r\nOK\r\nFailed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: ASSERT_TRUE(): assertion failed.\r\n```\r\n\r\n## How was this patch tested?\r\n\r\nPass the Jenkins tests (including a new testcase in `HivePlanTest`)"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/210414400","html_url":"https://github.com/apache/spark/pull/12340#issuecomment-210414400","issue_url":"https://api.github.com/repos/apache/spark/issues/12340","id":210414400,"user":{"login":"SparkQA","id":8108735,"avatar_url":"https://avatars.githubusercontent.com/u/8108735?v=3","gravatar_id":"","url":"https://api.github.com/users/SparkQA","html_url":"https://github.com/SparkQA","followers_url":"https://api.github.com/users/SparkQA/followers","following_url":"https://api.github.com/users/SparkQA/following{/other_user}","gists_url":"https://api.github.com/users/SparkQA/gists{/gist_id}","starred_url":"https://api.github.com/users/SparkQA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SparkQA/subscriptions","organizations_url":"https://api.github.com/users/SparkQA/orgs","repos_url":"https://api.github.com/users/SparkQA/repos","events_url":"https://api.github.com/users/SparkQA/events{/privacy}","received_events_url":"https://api.github.com/users/SparkQA/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T10:57:36Z","updated_at":"2016-04-15T10:57:36Z","body":"**[Test build #55915 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/55915/consoleFull)** for PR 12340 at commit [`bdcef78`](https://github.com/apache/spark/commit/bdcef787efcb0faff56d14f89d260773056cafec).\n * This patch passes all tests.\n * This patch merges cleanly.\n * This patch adds no public classes."}}