GitHub PullRequestReviewCommentEvent at 2014-06-12 22:23:21
Repository: scalding
Actor: johnynek
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/twitter/scalding/pulls/comments/13730154","id":13730154,"diff_hunk":"@@ -66,110 +64,185 @@ abstract class JDBCSource extends Source {\n   // How many rows to insert/update into this table in a batch?\n   def batchSize = 1000\n \n-  protected def driverFor(adapter: String): String = \n-    Map(\"mysql\" -> \"com.mysql.jdbc.Driver\",\n-        \"hsqldb\" -> \"org.hsqldb.jdbcDriver\")\n-    .apply(adapter)\n+  // If true, will perform an update when inserting a row with a primary or unique key that already\n+  // exists in the table. Will replace the old values in that row with the new values.\n+  val replaceOnInsert: Boolean = false\n \n-  def fields : Fields = new Fields(columnNames.toSeq :_*)\n+  def fields: Fields = new Fields(columnNames.map(_.get).toSeq :_*)\n \n-  protected def columnNames : Array[String] = columns.map{ _.name }.toArray\n-  protected def columnDefinitions : Array[String] = columns.map{ _.definition }.toArray\n-  protected def tableDesc = new TableDesc(tableName, columnNames, columnDefinitions, null, null)\n+  protected def columnNames: Array[ColumnName] = columns.map(_.name).toArray\n+  protected def columnDefinitions: Array[Definition] = columns.map(_.definition).toArray\n \n-  protected def nullStr(nullable : Boolean) = if(nullable) \"NULL\" else \"NOT NULL\"\n+  sealed abstract class IsNullable(val get: String)\n+  case object Nullable extends IsNullable(\"NULL\")\n+  case object NotNullable extends IsNullable(\"NOT NULL\")\n \n-  protected def mkColumnDef(name : String, typeName : String,\n-    nullable : Boolean, sizeOp : Option[Int] = None, defOp : Option[String]) = {\n+  protected def mkColumnDef(\n+    name: ColumnName,\n+    typeName: ColumnType,\n+    nullable: IsNullable,\n+    sizeOp: Option[Int] = None,\n+    defOp: Option[String]\n+  ) = {\n     val sizeStr = sizeOp.map { \"(\" + _.toString + \")\" }.getOrElse(\"\")\n     val defStr = defOp.map { \" DEFAULT '\" + _.toString + \"' \" }.getOrElse(\" \")\n-    ColumnDefinition(name, typeName + sizeStr + defStr + nullStr(nullable))\n+    column(name, Definition(typeName.get + sizeStr + defStr + nullable.get))\n   }\n \n+  sealed abstract class ColumnType(val get: String)\n+  private[this] case object BIGINT extends ColumnType(\"BIGINT\")\n+  private[this] case object INT extends ColumnType(\"INT\")\n+  private[this] case object SMALLINT extends ColumnType(\"SMALLINT\")\n+  private[this] case object TINYINT extends ColumnType(\"TINYINT\")\n+  private[this] case object VARCHAR extends ColumnType(\"VARCHAR\")\n+  private[this] case object DATE extends ColumnType(\"DATE\")\n+  private[this] case object DATETIME extends ColumnType(\"DATETIME\")\n+  private[this] case object TEXT extends ColumnType(\"TEXT\")\n+  private[this] case object DOUBLE extends ColumnType(\"DOUBLE\")\n+\n   // Some helper methods that we can use to generate column definitions\n-  protected def bigint(name : String, size : Int = 20, nullable : Boolean = false) = {\n-    mkColumnDef(name, \"BIGINT\", nullable, Some(size), None)\n-  }\n+  protected def bigint(name: ColumnName, size : Int = 20, nullable: IsNullable = NotNullable) =","path":"scalding-jdbc/src/main/scala/com/twitter/scalding/jdbc/JDBCSource.scala","position":76,"original_position":76,"commit_id":"aed25fb5f695065fd101d154fa825c0c0546d59c","original_commit_id":"aed25fb5f695065fd101d154fa825c0c0546d59c","user":{"login":"johnynek","id":67958,"avatar_url":"https://avatars.githubusercontent.com/u/67958?","gravatar_id":"fa94a62940f16a371fdd3e6e8e12c3a1","url":"https://api.github.com/users/johnynek","html_url":"https://github.com/johnynek","followers_url":"https://api.github.com/users/johnynek/followers","following_url":"https://api.github.com/users/johnynek/following{/other_user}","gists_url":"https://api.github.com/users/johnynek/gists{/gist_id}","starred_url":"https://api.github.com/users/johnynek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnynek/subscriptions","organizations_url":"https://api.github.com/users/johnynek/orgs","repos_url":"https://api.github.com/users/johnynek/repos","events_url":"https://api.github.com/users/johnynek/events{/privacy}","received_events_url":"https://api.github.com/users/johnynek/received_events","type":"User","site_admin":false},"body":"I encouraged this, but I think that ColumnName here, might be too little win. I don't see the risk of using String directly here. The more dangerous case is: `def fn(name: String, dogsName: String, teamName: String)` as the compiler can't help if you get an argument wrong. Maybe one thing: it is safe to use a \"raw\" type, if it is the only occurrence of that type (or boxed type) in the method. Thoughts on that? ","created_at":"2014-06-12T22:23:21Z","updated_at":"2014-06-12T22:23:21Z","html_url":"https://github.com/twitter/scalding/pull/898#discussion_r13730154","pull_request_url":"https://api.github.com/repos/twitter/scalding/pulls/898","_links":{"self":{"href":"https://api.github.com/repos/twitter/scalding/pulls/comments/13730154"},"html":{"href":"https://github.com/twitter/scalding/pull/898#discussion_r13730154"},"pull_request":{"href":"https://api.github.com/repos/twitter/scalding/pulls/898"}}},"pull_request":{"url":"https://api.github.com/repos/twitter/scalding/pulls/898","id":17016243,"html_url":"https://github.com/twitter/scalding/pull/898","diff_url":"https://github.com/twitter/scalding/pull/898.diff","patch_url":"https://github.com/twitter/scalding/pull/898.patch","issue_url":"https://api.github.com/repos/twitter/scalding/issues/898","number":898,"state":"open","title":"Update JDBCSource","user":{"login":"jcoveney","id":830087,"avatar_url":"https://avatars.githubusercontent.com/u/830087?","gravatar_id":"c31517bb2497ca20710a294d3f8d1144","url":"https://api.github.com/users/jcoveney","html_url":"https://github.com/jcoveney","followers_url":"https://api.github.com/users/jcoveney/followers","following_url":"https://api.github.com/users/jcoveney/following{/other_user}","gists_url":"https://api.github.com/users/jcoveney/gists{/gist_id}","starred_url":"https://api.github.com/users/jcoveney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcoveney/subscriptions","organizations_url":"https://api.github.com/users/jcoveney/orgs","repos_url":"https://api.github.com/users/jcoveney/repos","events_url":"https://api.github.com/users/jcoveney/events{/privacy}","received_events_url":"https://api.github.com/users/jcoveney/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-06-11T18:55:39Z","updated_at":"2014-06-12T22:23:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e02cd61e9e0a61bd9ac080dcb423f8fcd99a50a2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/twitter/scalding/pulls/898/commits","review_comments_url":"https://api.github.com/repos/twitter/scalding/pulls/898/comments","review_comment_url":"https://api.github.com/repos/twitter/scalding/pulls/comments/{number}","comments_url":"https://api.github.com/repos/twitter/scalding/issues/898/comments","statuses_url":"https://api.github.com/repos/twitter/scalding/statuses/aed25fb5f695065fd101d154fa825c0c0546d59c","head":{"label":"twitter:jco/mysql_specific_table_existence","ref":"jco/mysql_specific_table_existence","sha":"aed25fb5f695065fd101d154fa825c0c0546d59c","user":{"login":"twitter","id":50278,"avatar_url":"https://avatars.githubusercontent.com/u/50278?","gravatar_id":"2f4a8254d032a8ec5e4c48d461e54fcc","url":"https://api.github.com/users/twitter","html_url":"https://github.com/twitter","followers_url":"https://api.github.com/users/twitter/followers","following_url":"https://api.github.com/users/twitter/following{/other_user}","gists_url":"https://api.github.com/users/twitter/gists{/gist_id}","starred_url":"https://api.github.com/users/twitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twitter/subscriptions","organizations_url":"https://api.github.com/users/twitter/orgs","repos_url":"https://api.github.com/users/twitter/repos","events_url":"https://api.github.com/users/twitter/events{/privacy}","received_events_url":"https://api.github.com/users/twitter/received_events","type":"Organization","site_admin":false},"repo":{"id":3146558,"name":"scalding","full_name":"twitter/scalding","owner":{"login":"twitter","id":50278,"avatar_url":"https://avatars.githubusercontent.com/u/50278?","gravatar_id":"2f4a8254d032a8ec5e4c48d461e54fcc","url":"https://api.github.com/users/twitter","html_url":"https://github.com/twitter","followers_url":"https://api.github.com/users/twitter/followers","following_url":"https://api.github.com/users/twitter/following{/other_user}","gists_url":"https://api.github.com/users/twitter/gists{/gist_id}","starred_url":"https://api.github.com/users/twitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twitter/subscriptions","organizations_url":"https://api.github.com/users/twitter/orgs","repos_url":"https://api.github.com/users/twitter/repos","events_url":"https://api.github.com/users/twitter/events{/privacy}","received_events_url":"https://api.github.com/users/twitter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/twitter/scalding","description":"A Scala API for Cascading","fork":false,"url":"https://api.github.com/repos/twitter/scalding","forks_url":"https://api.github.com/repos/twitter/scalding/forks","keys_url":"https://api.github.com/repos/twitter/scalding/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twitter/scalding/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twitter/scalding/teams","hooks_url":"https://api.github.com/repos/twitter/scalding/hooks","issue_events_url":"https://api.github.com/repos/twitter/scalding/issues/events{/number}","events_url":"https://api.github.com/repos/twitter/scalding/events","assignees_url":"https://api.github.com/repos/twitter/scalding/assignees{/user}","branches_url":"https://api.github.com/repos/twitter/scalding/branches{/branch}","tags_url":"https://api.github.com/repos/twitter/scalding/tags","blobs_url":"https://api.github.com/repos/twitter/scalding/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twitter/scalding/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twitter/scalding/git/refs{/sha}","trees_url":"https://api.github.com/repos/twitter/scalding/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twitter/scalding/statuses/{sha}","languages_url":"https://api.github.com/repos/twitter/scalding/languages","stargazers_url":"https://api.github.com/repos/twitter/scalding/stargazers","contributors_url":"https://api.github.com/repos/twitter/scalding/contributors","subscribers_url":"https://api.github.com/repos/twitter/scalding/subscribers","subscription_url":"https://api.github.com/repos/twitter/scalding/subscription","commits_url":"https://api.github.com/repos/twitter/scalding/commits{/sha}","git_commits_url":"https://api.github.com/repos/twitter/scalding/git/commits{/sha}","comments_url":"https://api.github.com/repos/twitter/scalding/comments{/number}","issue_comment_url":"https://api.github.com/repos/twitter/scalding/issues/comments/{number}","contents_url":"https://api.github.com/repos/twitter/scalding/contents/{+path}","compare_url":"https://api.github.com/repos/twitter/scalding/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twitter/scalding/merges","archive_url":"https://api.github.com/repos/twitter/scalding/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twitter/scalding/downloads","issues_url":"https://api.github.com/repos/twitter/scalding/issues{/number}","pulls_url":"https://api.github.com/repos/twitter/scalding/pulls{/number}","milestones_url":"https://api.github.com/repos/twitter/scalding/milestones{/number}","notifications_url":"https://api.github.com/repos/twitter/scalding/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twitter/scalding/labels{/name}","releases_url":"https://api.github.com/repos/twitter/scalding/releases{/id}","created_at":"2012-01-10T16:22:08Z","updated_at":"2014-06-12T18:13:50Z","pushed_at":"2014-06-11T22:54:23Z","git_url":"git://github.com/twitter/scalding.git","ssh_url":"git@github.com:twitter/scalding.git","clone_url":"https://github.com/twitter/scalding.git","svn_url":"https://github.com/twitter/scalding","homepage":"http://twitter.com/scalding","size":21103,"stargazers_count":1560,"watchers_count":1560,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":352,"mirror_url":null,"open_issues_count":149,"forks":352,"open_issues":149,"watchers":1560,"default_branch":"develop"}},"base":{"label":"twitter:develop","ref":"develop","sha":"8a1804ef8dc8fb78e0dccd5abca50a6a446c47f2","user":{"login":"twitter","id":50278,"avatar_url":"https://avatars.githubusercontent.com/u/50278?","gravatar_id":"2f4a8254d032a8ec5e4c48d461e54fcc","url":"https://api.github.com/users/twitter","html_url":"https://github.com/twitter","followers_url":"https://api.github.com/users/twitter/followers","following_url":"https://api.github.com/users/twitter/following{/other_user}","gists_url":"https://api.github.com/users/twitter/gists{/gist_id}","starred_url":"https://api.github.com/users/twitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twitter/subscriptions","organizations_url":"https://api.github.com/users/twitter/orgs","repos_url":"https://api.github.com/users/twitter/repos","events_url":"https://api.github.com/users/twitter/events{/privacy}","received_events_url":"https://api.github.com/users/twitter/received_events","type":"Organization","site_admin":false},"repo":{"id":3146558,"name":"scalding","full_name":"twitter/scalding","owner":{"login":"twitter","id":50278,"avatar_url":"https://avatars.githubusercontent.com/u/50278?","gravatar_id":"2f4a8254d032a8ec5e4c48d461e54fcc","url":"https://api.github.com/users/twitter","html_url":"https://github.com/twitter","followers_url":"https://api.github.com/users/twitter/followers","following_url":"https://api.github.com/users/twitter/following{/other_user}","gists_url":"https://api.github.com/users/twitter/gists{/gist_id}","starred_url":"https://api.github.com/users/twitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twitter/subscriptions","organizations_url":"https://api.github.com/users/twitter/orgs","repos_url":"https://api.github.com/users/twitter/repos","events_url":"https://api.github.com/users/twitter/events{/privacy}","received_events_url":"https://api.github.com/users/twitter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/twitter/scalding","description":"A Scala API for Cascading","fork":false,"url":"https://api.github.com/repos/twitter/scalding","forks_url":"https://api.github.com/repos/twitter/scalding/forks","keys_url":"https://api.github.com/repos/twitter/scalding/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twitter/scalding/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twitter/scalding/teams","hooks_url":"https://api.github.com/repos/twitter/scalding/hooks","issue_events_url":"https://api.github.com/repos/twitter/scalding/issues/events{/number}","events_url":"https://api.github.com/repos/twitter/scalding/events","assignees_url":"https://api.github.com/repos/twitter/scalding/assignees{/user}","branches_url":"https://api.github.com/repos/twitter/scalding/branches{/branch}","tags_url":"https://api.github.com/repos/twitter/scalding/tags","blobs_url":"https://api.github.com/repos/twitter/scalding/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twitter/scalding/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twitter/scalding/git/refs{/sha}","trees_url":"https://api.github.com/repos/twitter/scalding/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twitter/scalding/statuses/{sha}","languages_url":"https://api.github.com/repos/twitter/scalding/languages","stargazers_url":"https://api.github.com/repos/twitter/scalding/stargazers","contributors_url":"https://api.github.com/repos/twitter/scalding/contributors","subscribers_url":"https://api.github.com/repos/twitter/scalding/subscribers","subscription_url":"https://api.github.com/repos/twitter/scalding/subscription","commits_url":"https://api.github.com/repos/twitter/scalding/commits{/sha}","git_commits_url":"https://api.github.com/repos/twitter/scalding/git/commits{/sha}","comments_url":"https://api.github.com/repos/twitter/scalding/comments{/number}","issue_comment_url":"https://api.github.com/repos/twitter/scalding/issues/comments/{number}","contents_url":"https://api.github.com/repos/twitter/scalding/contents/{+path}","compare_url":"https://api.github.com/repos/twitter/scalding/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twitter/scalding/merges","archive_url":"https://api.github.com/repos/twitter/scalding/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twitter/scalding/downloads","issues_url":"https://api.github.com/repos/twitter/scalding/issues{/number}","pulls_url":"https://api.github.com/repos/twitter/scalding/pulls{/number}","milestones_url":"https://api.github.com/repos/twitter/scalding/milestones{/number}","notifications_url":"https://api.github.com/repos/twitter/scalding/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twitter/scalding/labels{/name}","releases_url":"https://api.github.com/repos/twitter/scalding/releases{/id}","created_at":"2012-01-10T16:22:08Z","updated_at":"2014-06-12T18:13:50Z","pushed_at":"2014-06-11T22:54:23Z","git_url":"git://github.com/twitter/scalding.git","ssh_url":"git@github.com:twitter/scalding.git","clone_url":"https://github.com/twitter/scalding.git","svn_url":"https://github.com/twitter/scalding","homepage":"http://twitter.com/scalding","size":21103,"stargazers_count":1560,"watchers_count":1560,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":352,"mirror_url":null,"open_issues_count":149,"forks":352,"open_issues":149,"watchers":1560,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/twitter/scalding/pulls/898"},"html":{"href":"https://github.com/twitter/scalding/pull/898"},"issue":{"href":"https://api.github.com/repos/twitter/scalding/issues/898"},"comments":{"href":"https://api.github.com/repos/twitter/scalding/issues/898/comments"},"review_comments":{"href":"https://api.github.com/repos/twitter/scalding/pulls/898/comments"},"review_comment":{"href":"https://api.github.com/repos/twitter/scalding/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/twitter/scalding/pulls/898/commits"},"statuses":{"href":"https://api.github.com/repos/twitter/scalding/statuses/aed25fb5f695065fd101d154fa825c0c0546d59c"}}}}