GitHub PullRequestReviewCommentEvent at 2014-11-21 18:51:13
Repository: cdap
Actor: anew
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/caskdata/cdap/pulls/comments/20733350","id":20733350,"diff_hunk":"@@ -0,0 +1,103 @@\n+/*\n+ * Copyright © 2014 Cask Data, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n+ * use this file except in compliance with the License. You may obtain a copy of\n+ * the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+ * License for the specific language governing permissions and limitations under\n+ * the License.\n+ */\n+\n+package co.cask.cdap.api.dataset.lib;\n+\n+import co.cask.cdap.api.annotation.Beta;\n+import com.google.common.collect.Lists;\n+\n+import java.util.Collection;\n+import java.util.Collections;\n+import java.util.List;\n+import java.util.Map;\n+\n+/**\n+ * Constants and helper methods to configure runtime arguments for a file dataset.\n+ */\n+@Beta\n+public class FileArguments {\n+\n+  /**\n+   * Sets the input path in the runtime arguments for a file dataset.\n+   */\n+  public static void setInputPath(Map<String, String> arguments, String path) {\n+    arguments.put(File.ARGUMENT_INPUT_PATHS, path);\n+  }\n+\n+  /**\n+   * Sets multiple input paths in the runtime arguments for a file dataset.\n+   * @param paths A comma-separated sequence of paths\n+   */\n+  public static void setInputPaths(Map<String, String> arguments, String paths) {\n+    arguments.remove(File.ARGUMENT_INPUT_PATHS);\n+    for (String path : paths.split(\",\")) {\n+      addInputPath(arguments, path.trim());\n+    }\n+  }\n+\n+  /**\n+   * Sets multiple input paths in the runtime arguments for a file dataset.\n+   */\n+  public static void setInputPaths(Map<String, String> arguments, Collection<String> paths) {\n+    arguments.remove(File.ARGUMENT_INPUT_PATHS);\n+    for (String path : paths) {\n+      addInputPath(arguments, path);\n+    }\n+  }\n+\n+  /**\n+   * Add an input path in the runtime arguments for a file dataset.\n+   */\n+  public static void addInputPath(Map<String, String> arguments, String path) {\n+    String existing = arguments.get(File.ARGUMENT_INPUT_PATHS);\n+    if (existing == null) {\n+      setInputPath(arguments, path);\n+    } else {\n+      setInputPath(arguments, existing + \",\" + path);\n+    }\n+  }\n+\n+  /**\n+   * Sets the output path in the runtime arguments for a file dataset.\n+   */\n+  public static void setOutputPath(Map<String, String> arguments, String path) {\n+    arguments.put(File.ARGUMENT_OUTPUT_PATH, path);\n+  }\n+\n+  /**\n+   * @return the output path in the runtime arguments for a file dataset.\n+   */\n+  public static String getOutputPath(Map<String, String> arguments) {\n+    return arguments.get(File.ARGUMENT_OUTPUT_PATH);\n+  }\n+\n+  /**\n+   * @return the output path in the runtime arguments for a file dataset.\n+   */\n+  public static Collection<String> getInputPaths(Map<String, String> arguments) {\n+    String pathsArg = arguments.get(File.ARGUMENT_INPUT_PATHS);\n+    if (pathsArg == null) {\n+      return Collections.emptyList();\n+    }\n+    String[] paths = pathsArg.split(\",\");","path":"cdap-api/src/main/java/co/cask/cdap/api/dataset/lib/FileArguments.java","position":95,"original_position":95,"commit_id":"fcc909427b54e2b05e8b55eb2d69aa188417ea0e","original_commit_id":"618c938493123c8ac8d362832525d0a11e0a0b0f","user":{"login":"anew","id":483004,"avatar_url":"https://avatars.githubusercontent.com/u/483004?v=3","gravatar_id":"","url":"https://api.github.com/users/anew","html_url":"https://github.com/anew","followers_url":"https://api.github.com/users/anew/followers","following_url":"https://api.github.com/users/anew/following{/other_user}","gists_url":"https://api.github.com/users/anew/gists{/gist_id}","starred_url":"https://api.github.com/users/anew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anew/subscriptions","organizations_url":"https://api.github.com/users/anew/orgs","repos_url":"https://api.github.com/users/anew/repos","events_url":"https://api.github.com/users/anew/events{/privacy}","received_events_url":"https://api.github.com/users/anew/received_events","type":"User","site_admin":false},"body":"Should I be trimming the strings? If not, then I agree with you. ","created_at":"2014-11-21T18:51:13Z","updated_at":"2014-11-21T18:51:13Z","html_url":"https://github.com/caskdata/cdap/pull/648#discussion_r20733350","pull_request_url":"https://api.github.com/repos/caskdata/cdap/pulls/648","_links":{"self":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/comments/20733350"},"html":{"href":"https://github.com/caskdata/cdap/pull/648#discussion_r20733350"},"pull_request":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/648"}}},"pull_request":{"url":"https://api.github.com/repos/caskdata/cdap/pulls/648","id":24736437,"html_url":"https://github.com/caskdata/cdap/pull/648","diff_url":"https://github.com/caskdata/cdap/pull/648.diff","patch_url":"https://github.com/caskdata/cdap/pull/648.patch","issue_url":"https://api.github.com/repos/caskdata/cdap/issues/648","number":648,"state":"open","locked":false,"title":"Feature/file ds","user":{"login":"anew","id":483004,"avatar_url":"https://avatars.githubusercontent.com/u/483004?v=3","gravatar_id":"","url":"https://api.github.com/users/anew","html_url":"https://github.com/anew","followers_url":"https://api.github.com/users/anew/followers","following_url":"https://api.github.com/users/anew/following{/other_user}","gists_url":"https://api.github.com/users/anew/gists{/gist_id}","starred_url":"https://api.github.com/users/anew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anew/subscriptions","organizations_url":"https://api.github.com/users/anew/orgs","repos_url":"https://api.github.com/users/anew/repos","events_url":"https://api.github.com/users/anew/events{/privacy}","received_events_url":"https://api.github.com/users/anew/received_events","type":"User","site_admin":false},"body":"- adds a File dataset interface, also Input/OutputFormatProvider \r\n- an implementation named FileDataset, including a definition and admin\r\n- Map/reduce runner to support Input/OutputFormatProvider in addition to BatchReadable/Writable\r\n- utilities for scoped runtime arguments (\"dataset.<name>.my.property\"). \r\n- unit tests\r\n\r\nPlease give feedback especially about the APIs. ","created_at":"2014-11-20T01:27:26Z","updated_at":"2014-11-21T18:51:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4fcf7e476378757821e5e62bb9917759bc618aed","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/caskdata/cdap/pulls/648/commits","review_comments_url":"https://api.github.com/repos/caskdata/cdap/pulls/648/comments","review_comment_url":"https://api.github.com/repos/caskdata/cdap/pulls/comments/{number}","comments_url":"https://api.github.com/repos/caskdata/cdap/issues/648/comments","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/fcc909427b54e2b05e8b55eb2d69aa188417ea0e","head":{"label":"caskdata:feature/file-ds","ref":"feature/file-ds","sha":"fcc909427b54e2b05e8b55eb2d69aa188417ea0e","user":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"repo":{"id":22542759,"name":"cdap","full_name":"caskdata/cdap","owner":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/caskdata/cdap","description":"Cask Data Application Platform (CDAP)","fork":false,"url":"https://api.github.com/repos/caskdata/cdap","forks_url":"https://api.github.com/repos/caskdata/cdap/forks","keys_url":"https://api.github.com/repos/caskdata/cdap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caskdata/cdap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caskdata/cdap/teams","hooks_url":"https://api.github.com/repos/caskdata/cdap/hooks","issue_events_url":"https://api.github.com/repos/caskdata/cdap/issues/events{/number}","events_url":"https://api.github.com/repos/caskdata/cdap/events","assignees_url":"https://api.github.com/repos/caskdata/cdap/assignees{/user}","branches_url":"https://api.github.com/repos/caskdata/cdap/branches{/branch}","tags_url":"https://api.github.com/repos/caskdata/cdap/tags","blobs_url":"https://api.github.com/repos/caskdata/cdap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caskdata/cdap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caskdata/cdap/git/refs{/sha}","trees_url":"https://api.github.com/repos/caskdata/cdap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/{sha}","languages_url":"https://api.github.com/repos/caskdata/cdap/languages","stargazers_url":"https://api.github.com/repos/caskdata/cdap/stargazers","contributors_url":"https://api.github.com/repos/caskdata/cdap/contributors","subscribers_url":"https://api.github.com/repos/caskdata/cdap/subscribers","subscription_url":"https://api.github.com/repos/caskdata/cdap/subscription","commits_url":"https://api.github.com/repos/caskdata/cdap/commits{/sha}","git_commits_url":"https://api.github.com/repos/caskdata/cdap/git/commits{/sha}","comments_url":"https://api.github.com/repos/caskdata/cdap/comments{/number}","issue_comment_url":"https://api.github.com/repos/caskdata/cdap/issues/comments/{number}","contents_url":"https://api.github.com/repos/caskdata/cdap/contents/{+path}","compare_url":"https://api.github.com/repos/caskdata/cdap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caskdata/cdap/merges","archive_url":"https://api.github.com/repos/caskdata/cdap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caskdata/cdap/downloads","issues_url":"https://api.github.com/repos/caskdata/cdap/issues{/number}","pulls_url":"https://api.github.com/repos/caskdata/cdap/pulls{/number}","milestones_url":"https://api.github.com/repos/caskdata/cdap/milestones{/number}","notifications_url":"https://api.github.com/repos/caskdata/cdap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caskdata/cdap/labels{/name}","releases_url":"https://api.github.com/repos/caskdata/cdap/releases{/id}","created_at":"2014-08-02T09:00:10Z","updated_at":"2014-11-21T03:55:43Z","pushed_at":"2014-11-21T18:13:34Z","git_url":"git://github.com/caskdata/cdap.git","ssh_url":"git@github.com:caskdata/cdap.git","clone_url":"https://github.com/caskdata/cdap.git","svn_url":"https://github.com/caskdata/cdap","homepage":"http://cdap.io","size":394489,"stargazers_count":15,"watchers_count":15,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4,"mirror_url":null,"open_issues_count":14,"forks":4,"open_issues":14,"watchers":15,"default_branch":"develop"}},"base":{"label":"caskdata:develop","ref":"develop","sha":"95ee854633297ac0c8246e2c1339c9c79c8feb27","user":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"repo":{"id":22542759,"name":"cdap","full_name":"caskdata/cdap","owner":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/caskdata/cdap","description":"Cask Data Application Platform (CDAP)","fork":false,"url":"https://api.github.com/repos/caskdata/cdap","forks_url":"https://api.github.com/repos/caskdata/cdap/forks","keys_url":"https://api.github.com/repos/caskdata/cdap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caskdata/cdap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caskdata/cdap/teams","hooks_url":"https://api.github.com/repos/caskdata/cdap/hooks","issue_events_url":"https://api.github.com/repos/caskdata/cdap/issues/events{/number}","events_url":"https://api.github.com/repos/caskdata/cdap/events","assignees_url":"https://api.github.com/repos/caskdata/cdap/assignees{/user}","branches_url":"https://api.github.com/repos/caskdata/cdap/branches{/branch}","tags_url":"https://api.github.com/repos/caskdata/cdap/tags","blobs_url":"https://api.github.com/repos/caskdata/cdap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caskdata/cdap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caskdata/cdap/git/refs{/sha}","trees_url":"https://api.github.com/repos/caskdata/cdap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/{sha}","languages_url":"https://api.github.com/repos/caskdata/cdap/languages","stargazers_url":"https://api.github.com/repos/caskdata/cdap/stargazers","contributors_url":"https://api.github.com/repos/caskdata/cdap/contributors","subscribers_url":"https://api.github.com/repos/caskdata/cdap/subscribers","subscription_url":"https://api.github.com/repos/caskdata/cdap/subscription","commits_url":"https://api.github.com/repos/caskdata/cdap/commits{/sha}","git_commits_url":"https://api.github.com/repos/caskdata/cdap/git/commits{/sha}","comments_url":"https://api.github.com/repos/caskdata/cdap/comments{/number}","issue_comment_url":"https://api.github.com/repos/caskdata/cdap/issues/comments/{number}","contents_url":"https://api.github.com/repos/caskdata/cdap/contents/{+path}","compare_url":"https://api.github.com/repos/caskdata/cdap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caskdata/cdap/merges","archive_url":"https://api.github.com/repos/caskdata/cdap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caskdata/cdap/downloads","issues_url":"https://api.github.com/repos/caskdata/cdap/issues{/number}","pulls_url":"https://api.github.com/repos/caskdata/cdap/pulls{/number}","milestones_url":"https://api.github.com/repos/caskdata/cdap/milestones{/number}","notifications_url":"https://api.github.com/repos/caskdata/cdap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caskdata/cdap/labels{/name}","releases_url":"https://api.github.com/repos/caskdata/cdap/releases{/id}","created_at":"2014-08-02T09:00:10Z","updated_at":"2014-11-21T03:55:43Z","pushed_at":"2014-11-21T18:13:34Z","git_url":"git://github.com/caskdata/cdap.git","ssh_url":"git@github.com:caskdata/cdap.git","clone_url":"https://github.com/caskdata/cdap.git","svn_url":"https://github.com/caskdata/cdap","homepage":"http://cdap.io","size":394489,"stargazers_count":15,"watchers_count":15,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4,"mirror_url":null,"open_issues_count":14,"forks":4,"open_issues":14,"watchers":15,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/648"},"html":{"href":"https://github.com/caskdata/cdap/pull/648"},"issue":{"href":"https://api.github.com/repos/caskdata/cdap/issues/648"},"comments":{"href":"https://api.github.com/repos/caskdata/cdap/issues/648/comments"},"review_comments":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/648/comments"},"review_comment":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/648/commits"},"statuses":{"href":"https://api.github.com/repos/caskdata/cdap/statuses/fcc909427b54e2b05e8b55eb2d69aa188417ea0e"}}}}