{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/191492537","pull_request_review_id":124075049,"id":191492537,"diff_hunk":"@@ -282,6 +282,26 @@ class AstBuilder(conf: SQLConf) extends SqlBaseBaseVisitor[AnyRef] with Logging\n     parts.toMap\n   }\n \n+  /**\n+   * Create a partition filter specification.\n+   */\n+  def visitPartitionFilterSpec(ctx: PartitionSpecContext): Seq[Expression] = withOrigin(ctx) {\n+    val parts = ctx.expression.asScala.map { pVal =>\n+      expression(pVal) match {\n+        case EqualNullSafe(_, _) =>\n+          throw new ParseException(\"'<=>' operator is not allowed in partition specification.\", ctx)\n+        case cmp @ BinaryComparison(UnresolvedAttribute(name :: Nil), constant: Literal) =>\n+          cmp\n+        case bc @ BinaryComparison(constant: Literal, _) =>\n+          throw new ParseException(\"Literal \" + constant","path":"sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala","position":15,"original_position":15,"commit_id":"e92185c021435b4b041f7a4b88ea9875f4976433","original_commit_id":"e92185c021435b4b041f7a4b88ea9875f4976433","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},"body":"Sorry,  I was careless. Will fix this.","created_at":"2018-05-29T16:36:54Z","updated_at":"2018-05-29T16:36:55Z","html_url":"https://github.com/apache/spark/pull/19691#discussion_r191492537","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/19691","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/191492537"},"html":{"href":"https://github.com/apache/spark/pull/19691#discussion_r191492537"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/19691"}},"in_reply_to_id":191204888},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/19691","id":151312018,"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","issue_url":"https://api.github.com/repos/apache/spark/issues/19691","number":19691,"state":"open","locked":false,"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},"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","created_at":"2017-11-08T07:36:55Z","updated_at":"2018-05-29T16:36:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4630a02a3b8a8def362a1958caa75a4ec231c89c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/19691/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/19691/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/19691/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/e92185c021435b4b041f7a4b88ea9875f4976433","head":{"label":"DazhuangSu:SPARK-17732","ref":"SPARK-17732","sha":"e92185c021435b4b041f7a4b88ea9875f4976433","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},"repo":{"id":75449756,"name":"spark","full_name":"DazhuangSu/spark","owner":{"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},"private":false,"html_url":"https://github.com/DazhuangSu/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/DazhuangSu/spark","forks_url":"https://api.github.com/repos/DazhuangSu/spark/forks","keys_url":"https://api.github.com/repos/DazhuangSu/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DazhuangSu/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DazhuangSu/spark/teams","hooks_url":"https://api.github.com/repos/DazhuangSu/spark/hooks","issue_events_url":"https://api.github.com/repos/DazhuangSu/spark/issues/events{/number}","events_url":"https://api.github.com/repos/DazhuangSu/spark/events","assignees_url":"https://api.github.com/repos/DazhuangSu/spark/assignees{/user}","branches_url":"https://api.github.com/repos/DazhuangSu/spark/branches{/branch}","tags_url":"https://api.github.com/repos/DazhuangSu/spark/tags","blobs_url":"https://api.github.com/repos/DazhuangSu/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DazhuangSu/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DazhuangSu/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/DazhuangSu/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DazhuangSu/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/DazhuangSu/spark/languages","stargazers_url":"https://api.github.com/repos/DazhuangSu/spark/stargazers","contributors_url":"https://api.github.com/repos/DazhuangSu/spark/contributors","subscribers_url":"https://api.github.com/repos/DazhuangSu/spark/subscribers","subscription_url":"https://api.github.com/repos/DazhuangSu/spark/subscription","commits_url":"https://api.github.com/repos/DazhuangSu/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/DazhuangSu/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/DazhuangSu/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/DazhuangSu/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/DazhuangSu/spark/contents/{+path}","compare_url":"https://api.github.com/repos/DazhuangSu/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DazhuangSu/spark/merges","archive_url":"https://api.github.com/repos/DazhuangSu/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DazhuangSu/spark/downloads","issues_url":"https://api.github.com/repos/DazhuangSu/spark/issues{/number}","pulls_url":"https://api.github.com/repos/DazhuangSu/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/DazhuangSu/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/DazhuangSu/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DazhuangSu/spark/labels{/name}","releases_url":"https://api.github.com/repos/DazhuangSu/spark/releases{/id}","deployments_url":"https://api.github.com/repos/DazhuangSu/spark/deployments","created_at":"2016-12-03T03:41:04Z","updated_at":"2016-12-03T03:41:27Z","pushed_at":"2018-05-25T08:26:33Z","git_url":"git://github.com/DazhuangSu/spark.git","ssh_url":"git@github.com:DazhuangSu/spark.git","clone_url":"https://github.com/DazhuangSu/spark.git","svn_url":"https://github.com/DazhuangSu/spark","homepage":null,"size":255940,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"11eea1a4ce32c9018218d4dfc9f46b744eb82991","user":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","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://avatars0.githubusercontent.com/u/47359?v=4","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}","deployments_url":"https://api.github.com/repos/apache/spark/deployments","created_at":"2014-02-25T08:00:08Z","updated_at":"2018-05-29T16:26:51Z","pushed_at":"2018-05-29T16:15:06Z","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":271316,"stargazers_count":17440,"watchers_count":17440,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":15954,"mirror_url":null,"archived":false,"open_issues_count":548,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":15954,"open_issues":548,"watchers":17440,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/19691"},"html":{"href":"https://github.com/apache/spark/pull/19691"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/19691"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/19691/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/19691/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/19691/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/e92185c021435b4b041f7a4b88ea9875f4976433"}},"author_association":"NONE"}}
{"actor":{"display_login":"DazhuangSu"}}