{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/19691","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/19691/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/19691/comments","events_url":"https://api.github.com/repos/apache/spark/issues/19691/events","html_url":"https://github.com/apache/spark/pull/19691","id":272100461,"number":19691,"title":"[SPARK-14922][SPARK-17732][SQL]ALTER TABLE DROP PARTITION should support comparators","user":{"login":"DazhuangSu","id":5742748,"avatar_url":"https://avatars0.githubusercontent.com/u/5742748?v=4","gravatar_id":"","url":"https://api.github.com/users/DazhuangSu","html_url":"https://github.com/DazhuangSu","followers_url":"https://api.github.com/users/DazhuangSu/followers","following_url":"https://api.github.com/users/DazhuangSu/following{/other_user}","gists_url":"https://api.github.com/users/DazhuangSu/gists{/gist_id}","starred_url":"https://api.github.com/users/DazhuangSu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DazhuangSu/subscriptions","organizations_url":"https://api.github.com/users/DazhuangSu/orgs","repos_url":"https://api.github.com/users/DazhuangSu/repos","events_url":"https://api.github.com/users/DazhuangSu/events{/privacy}","received_events_url":"https://api.github.com/users/DazhuangSu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":31,"created_at":"2017-11-08T07:36:55Z","updated_at":"2018-05-25T08:28:14Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/19691","html_url":"https://github.com/apache/spark/pull/19691","diff_url":"https://github.com/apache/spark/pull/19691.diff","patch_url":"https://github.com/apache/spark/pull/19691.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nThis pr is inspired by @dongjoon-hyun.\r\n\r\nquote from https://github.com/apache/spark/pull/15704 :\r\n\r\n> **What changes were proposed in this pull request?**\r\n\tThis PR aims to support comparators, e.g. '<', '<=', '>', '>=', again in Apache Spark 2.0 for backward compatibility.\r\n        **Spark 1.6**\r\n        `scala> sql(\"CREATE TABLE sales(id INT) PARTITIONED BY (country STRING, quarter STRING)\")\r\nres0: org.apache.spark.sql.DataFrame = [result: string]`\r\n`scala> sql(\"ALTER TABLE sales DROP PARTITION (country < 'KR')\")\r\nres1: org.apache.spark.sql.DataFrame = [result: string]`\r\n        **Spark 2.0**\r\n        `scala> sql(\"CREATE TABLE sales(id INT) PARTITIONED BY (country STRING, quarter STRING)\")\r\nres0: org.apache.spark.sql.DataFrame = []`\r\n        `scala> sql(\"ALTER TABLE sales DROP PARTITION (country < 'KR')\")`\r\n        `org.apache.spark.sql.catalyst.parser.ParseException:`\r\n        `mismatched input '<' expecting {')', ','}(line 1, pos 42)`\r\n        After this PR, it's supported.\r\n\t**How was this patch tested?**\r\n        Pass the Jenkins test with a newly added testcase.\r\n\r\n\r\nhttps://github.com/apache/spark/pull/16036 points out that if we use int literal in DROP PARTITION will fail after patching https://github.com/apache/spark/pull/15704.\r\nThe reason of this failing in https://github.com/apache/spark/pull/15704 is that AlterTableDropPartitionCommand tells BinayComparison and EqualTo with following code:\r\n\r\n`private def isRangeComparison(expr: Expression): Boolean = {  `\r\n    `expr.find(e => e.isInstanceOf[BinaryComparison] && !e.isInstanceOf[EqualTo]).isDefined }`\r\n\r\nThis PR resolve this problem by telling a drop condition when parsing sqls.\r\n\r\n## How was this patch tested?\r\nNew testcase introduced from https://github.com/apache/spark/pull/15704\r\n"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/391981030","html_url":"https://github.com/apache/spark/pull/19691#issuecomment-391981030","issue_url":"https://api.github.com/repos/apache/spark/issues/19691","id":391981030,"user":{"login":"SparkQA","id":8108735,"avatar_url":"https://avatars1.githubusercontent.com/u/8108735?v=4","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":"2018-05-25T08:28:14Z","updated_at":"2018-05-25T08:28:14Z","author_association":"NONE","body":"**[Test build #91152 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/91152/testReport)** for PR 19691 at commit [`e92185c`](https://github.com/apache/spark/commit/e92185c021435b4b041f7a4b88ea9875f4976433)."}}
{"actor":{"display_login":"SparkQA"}}