{"action":"created","comment":{"url":"https://api.github.com/repos/apache/zeppelin/pulls/comments/129510906","pull_request_review_id":52289993,"id":129510906,"diff_hunk":"@@ -161,6 +163,41 @@ public void test_null_value_in_row() {\n     assertEquals(\"name\\tage\\ngates\\tnull\\n\", ret.message().get(0).getData());\n   }\n \n+  private SparkInterpreter getSparkInterpreter() {\n+    LazyOpenInterpreter lazy = null;\n+    SparkInterpreter spark = null;\n+    Interpreter p = sql.getInterpreterInTheSameSessionByClassName(SparkInterpreter.class.getName());\n+\n+    while (p instanceof WrappedInterpreter) {\n+      if (p instanceof LazyOpenInterpreter) {\n+        lazy = (LazyOpenInterpreter) p;\n+      }\n+      p = ((WrappedInterpreter) p).getInnerInterpreter();\n+    }\n+    spark = (SparkInterpreter) p;\n+\n+    if (lazy != null) {\n+      lazy.open();\n+    }\n+    return spark;\n+  }\n+\n+  @Test\n+  public void testVariableInterpolation() {\n+    InterpreterContext newContext = new InterpreterContext(\"NoteId\", \"ParaId\", null,\n+            \"testVariableInterpolation\", \"\",\n+            null, null, null, null,\n+            new LocalResourcePool(\"testVariableInterpolation\"),\n+            null, null);\n+    SparkZeppelinContext zc = getSparkInterpreter().getZeppelinContext();\n+    zc.setInterpreterContext(newContext);\n+    zc.put(\"n\", \"100\");\n+    zc.put(\"table\", \"name\");\n+    String commandWithVariables = \"select * from {table} where count = {n}\";","path":"spark/src/test/java/org/apache/zeppelin/spark/SparkSqlInterpreterTest.java","position":50,"original_position":50,"commit_id":"47fde2fc6ab9f348d2702293c6ebe0fb389aa252","original_commit_id":"47fde2fc6ab9f348d2702293c6ebe0fb389aa252","user":{"login":"zjffdu","id":164491,"avatar_url":"https://avatars2.githubusercontent.com/u/164491?v=4","gravatar_id":"","url":"https://api.github.com/users/zjffdu","html_url":"https://github.com/zjffdu","followers_url":"https://api.github.com/users/zjffdu/followers","following_url":"https://api.github.com/users/zjffdu/following{/other_user}","gists_url":"https://api.github.com/users/zjffdu/gists{/gist_id}","starred_url":"https://api.github.com/users/zjffdu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zjffdu/subscriptions","organizations_url":"https://api.github.com/users/zjffdu/orgs","repos_url":"https://api.github.com/users/zjffdu/repos","events_url":"https://api.github.com/users/zjffdu/events{/privacy}","received_events_url":"https://api.github.com/users/zjffdu/received_events","type":"User","site_admin":false},"body":"how to escape these special character. e.g. \r\n```\r\nselect * from {table} where count = '{n}'\r\n```\r\nHere `{n}` is a string, will you still replace it using ZeppelinContext ?","created_at":"2017-07-26T08:31:35Z","updated_at":"2017-07-26T08:31:35Z","html_url":"https://github.com/apache/zeppelin/pull/2502#discussion_r129510906","pull_request_url":"https://api.github.com/repos/apache/zeppelin/pulls/2502","_links":{"self":{"href":"https://api.github.com/repos/apache/zeppelin/pulls/comments/129510906"},"html":{"href":"https://github.com/apache/zeppelin/pull/2502#discussion_r129510906"},"pull_request":{"href":"https://api.github.com/repos/apache/zeppelin/pulls/2502"}}},"pull_request":{"url":"https://api.github.com/repos/apache/zeppelin/pulls/2502","id":132031584,"html_url":"https://github.com/apache/zeppelin/pull/2502","diff_url":"https://github.com/apache/zeppelin/pull/2502.diff","patch_url":"https://github.com/apache/zeppelin/pull/2502.patch","issue_url":"https://api.github.com/repos/apache/zeppelin/issues/2502","number":2502,"state":"open","locked":false,"title":"[ZEPPELIN-2807] Passing Z variables to SQL Interpreter (One part of ZEPPELIN-1967)","user":{"login":"sanjaydasgupta","id":477015,"avatar_url":"https://avatars0.githubusercontent.com/u/477015?v=4","gravatar_id":"","url":"https://api.github.com/users/sanjaydasgupta","html_url":"https://github.com/sanjaydasgupta","followers_url":"https://api.github.com/users/sanjaydasgupta/followers","following_url":"https://api.github.com/users/sanjaydasgupta/following{/other_user}","gists_url":"https://api.github.com/users/sanjaydasgupta/gists{/gist_id}","starred_url":"https://api.github.com/users/sanjaydasgupta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanjaydasgupta/subscriptions","organizations_url":"https://api.github.com/users/sanjaydasgupta/orgs","repos_url":"https://api.github.com/users/sanjaydasgupta/repos","events_url":"https://api.github.com/users/sanjaydasgupta/events{/privacy}","received_events_url":"https://api.github.com/users/sanjaydasgupta/received_events","type":"User","site_admin":false},"body":"\r\n### What is this PR for?\r\nThis feature allows embedding/interpolating Z variables into SQL statements passed to the Spark-SQL interpreter. It implements one part of the functions desired by the pre-existing issue (ZEPPELIN-1967)\r\n\r\n\r\n### What type of PR is it?\r\n[Improvement]\r\n\r\n### Todos\r\n* [ ] - Task\r\n\r\n### What is the Jira issue?\r\nhttps://issues.apache.org/jira/browse/ZEPPELIN-2807\r\n\r\n### How should this be tested?\r\nA new test has been added to the unit tests. The attached screenshot also shows tests of the functionality.\r\n\r\n### Screenshots (if appropriate)\r\n![sparksqlchange](https://user-images.githubusercontent.com/477015/28521954-a1148532-7093-11e7-85e8-293d86fb0362.png)\r\n\r\n### Questions:\r\n* Does the licenses files need update? No\r\n* Is there breaking changes for older versions? No\r\n* Does this needs documentation? Yes, a small update to any existing documentation is ideal.\r\n","created_at":"2017-07-24T11:49:27Z","updated_at":"2017-07-26T08:31:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f3c4715cf430ce6aab7497dd7512bfe1ce43e12b","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/zeppelin/pulls/2502/commits","review_comments_url":"https://api.github.com/repos/apache/zeppelin/pulls/2502/comments","review_comment_url":"https://api.github.com/repos/apache/zeppelin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/zeppelin/issues/2502/comments","statuses_url":"https://api.github.com/repos/apache/zeppelin/statuses/47fde2fc6ab9f348d2702293c6ebe0fb389aa252","head":{"label":"sanjaydasgupta:master","ref":"master","sha":"47fde2fc6ab9f348d2702293c6ebe0fb389aa252","user":{"login":"sanjaydasgupta","id":477015,"avatar_url":"https://avatars0.githubusercontent.com/u/477015?v=4","gravatar_id":"","url":"https://api.github.com/users/sanjaydasgupta","html_url":"https://github.com/sanjaydasgupta","followers_url":"https://api.github.com/users/sanjaydasgupta/followers","following_url":"https://api.github.com/users/sanjaydasgupta/following{/other_user}","gists_url":"https://api.github.com/users/sanjaydasgupta/gists{/gist_id}","starred_url":"https://api.github.com/users/sanjaydasgupta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanjaydasgupta/subscriptions","organizations_url":"https://api.github.com/users/sanjaydasgupta/orgs","repos_url":"https://api.github.com/users/sanjaydasgupta/repos","events_url":"https://api.github.com/users/sanjaydasgupta/events{/privacy}","received_events_url":"https://api.github.com/users/sanjaydasgupta/received_events","type":"User","site_admin":false},"repo":{"id":97709403,"name":"zeppelin","full_name":"sanjaydasgupta/zeppelin","owner":{"login":"sanjaydasgupta","id":477015,"avatar_url":"https://avatars0.githubusercontent.com/u/477015?v=4","gravatar_id":"","url":"https://api.github.com/users/sanjaydasgupta","html_url":"https://github.com/sanjaydasgupta","followers_url":"https://api.github.com/users/sanjaydasgupta/followers","following_url":"https://api.github.com/users/sanjaydasgupta/following{/other_user}","gists_url":"https://api.github.com/users/sanjaydasgupta/gists{/gist_id}","starred_url":"https://api.github.com/users/sanjaydasgupta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanjaydasgupta/subscriptions","organizations_url":"https://api.github.com/users/sanjaydasgupta/orgs","repos_url":"https://api.github.com/users/sanjaydasgupta/repos","events_url":"https://api.github.com/users/sanjaydasgupta/events{/privacy}","received_events_url":"https://api.github.com/users/sanjaydasgupta/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sanjaydasgupta/zeppelin","description":"Mirror of Apache Zeppelin","fork":true,"url":"https://api.github.com/repos/sanjaydasgupta/zeppelin","forks_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/forks","keys_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/teams","hooks_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/hooks","issue_events_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/issues/events{/number}","events_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/events","assignees_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/assignees{/user}","branches_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/branches{/branch}","tags_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/tags","blobs_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/git/refs{/sha}","trees_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/statuses/{sha}","languages_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/languages","stargazers_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/stargazers","contributors_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/contributors","subscribers_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/subscribers","subscription_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/subscription","commits_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/commits{/sha}","git_commits_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/git/commits{/sha}","comments_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/comments{/number}","issue_comment_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/issues/comments{/number}","contents_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/contents/{+path}","compare_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/merges","archive_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/downloads","issues_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/issues{/number}","pulls_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/pulls{/number}","milestones_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/milestones{/number}","notifications_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/labels{/name}","releases_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/releases{/id}","deployments_url":"https://api.github.com/repos/sanjaydasgupta/zeppelin/deployments","created_at":"2017-07-19T11:36:56Z","updated_at":"2017-07-19T11:37:01Z","pushed_at":"2017-07-25T08:09:31Z","git_url":"git://github.com/sanjaydasgupta/zeppelin.git","ssh_url":"git@github.com:sanjaydasgupta/zeppelin.git","clone_url":"https://github.com/sanjaydasgupta/zeppelin.git","svn_url":"https://github.com/sanjaydasgupta/zeppelin","homepage":"","size":60168,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"90b3be5b6b9c9b1664a8feafff578c7f57216059","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":32848140,"name":"zeppelin","full_name":"apache/zeppelin","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/zeppelin","description":"Mirror of Apache Zeppelin","fork":false,"url":"https://api.github.com/repos/apache/zeppelin","forks_url":"https://api.github.com/repos/apache/zeppelin/forks","keys_url":"https://api.github.com/repos/apache/zeppelin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/zeppelin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/zeppelin/teams","hooks_url":"https://api.github.com/repos/apache/zeppelin/hooks","issue_events_url":"https://api.github.com/repos/apache/zeppelin/issues/events{/number}","events_url":"https://api.github.com/repos/apache/zeppelin/events","assignees_url":"https://api.github.com/repos/apache/zeppelin/assignees{/user}","branches_url":"https://api.github.com/repos/apache/zeppelin/branches{/branch}","tags_url":"https://api.github.com/repos/apache/zeppelin/tags","blobs_url":"https://api.github.com/repos/apache/zeppelin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/zeppelin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/zeppelin/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/zeppelin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/zeppelin/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/zeppelin/languages","stargazers_url":"https://api.github.com/repos/apache/zeppelin/stargazers","contributors_url":"https://api.github.com/repos/apache/zeppelin/contributors","subscribers_url":"https://api.github.com/repos/apache/zeppelin/subscribers","subscription_url":"https://api.github.com/repos/apache/zeppelin/subscription","commits_url":"https://api.github.com/repos/apache/zeppelin/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/zeppelin/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/zeppelin/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/zeppelin/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/zeppelin/contents/{+path}","compare_url":"https://api.github.com/repos/apache/zeppelin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/zeppelin/merges","archive_url":"https://api.github.com/repos/apache/zeppelin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/zeppelin/downloads","issues_url":"https://api.github.com/repos/apache/zeppelin/issues{/number}","pulls_url":"https://api.github.com/repos/apache/zeppelin/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/zeppelin/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/zeppelin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/zeppelin/labels{/name}","releases_url":"https://api.github.com/repos/apache/zeppelin/releases{/id}","deployments_url":"https://api.github.com/repos/apache/zeppelin/deployments","created_at":"2015-03-25T07:00:06Z","updated_at":"2017-07-26T06:41:15Z","pushed_at":"2017-07-26T03:40:58Z","git_url":"git://github.com/apache/zeppelin.git","ssh_url":"git@github.com:apache/zeppelin.git","clone_url":"https://github.com/apache/zeppelin.git","svn_url":"https://github.com/apache/zeppelin","homepage":"","size":60163,"stargazers_count":3008,"watchers_count":3008,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1526,"mirror_url":"git://git.apache.org/incubator-zeppelin.git","open_issues_count":140,"forks":1526,"open_issues":140,"watchers":3008,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/zeppelin/pulls/2502"},"html":{"href":"https://github.com/apache/zeppelin/pull/2502"},"issue":{"href":"https://api.github.com/repos/apache/zeppelin/issues/2502"},"comments":{"href":"https://api.github.com/repos/apache/zeppelin/issues/2502/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/zeppelin/pulls/2502/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/zeppelin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/zeppelin/pulls/2502/commits"},"statuses":{"href":"https://api.github.com/repos/apache/zeppelin/statuses/47fde2fc6ab9f348d2702293c6ebe0fb389aa252"}}}}
{"actor":{"display_login":"zjffdu"}}