<commit_before>package com.socrata.datacoordinator.main

abstract class ColumnAdder[CT, CV](mutator: DatabaseMutator[CT, CV]) {
  // Glue points we want/need
  //
  // Data updates (schema changes, upsert, etc)
  // Global log listener (specifically: a playback in some postgres table)
  // A secondary store (just a dummy for plugging in)
  // Store-update operations
  //  * Refresh dataset X to {StoreSet} : Future[Either[Error, NewVersion]]
  //  * Remove dataset X from {StoreSet} : Future[Option[Error]]
  // Get replication status : Map[Store, Version] (from secondary manifest)

  def addToSchema(dataset: String, columns: Map[String, CT], username: String) {
    mutator.withTransaction() { providerOfNecessaryThings =>
      import providerOfNecessaryThings._
      val ds = datasetMapWriter.datasetInfo(dataset).getOrElse(sys.error("Augh no such dataset"))
      val table = datasetMapWriter.latest(ds)
      val logger = datasetLog(ds)

      for((columnName, columnType) <- columns) {
        val baseName = physicalColumnBaseForType(columnType) + "_" + singleId()
        val col = datasetMapWriter.addColumn(table, columnName, nameForType(columnType), baseName)
        schemaLoader(col.versionInfo, logger).addColumn(col)
      }

      logger.endTransaction().foreach { ver =>
        truthManifest.updateLatestVersion(ds, ver)
        globalLog.log(ds, ver, now, username)
      }
    }
  }
}
<commit_msg>Remove superfluous `abstract'<commit_after>package com.socrata.datacoordinator.main

class ColumnAdder[CT, CV](mutator: DatabaseMutator[CT, CV]) {
  // Glue points we want/need
  //
  // Data updates (schema changes, upsert, etc)
  // Global log listener (specifically: a playback in some postgres table)
  // A secondary store (just a dummy for plugging in)
  // Store-update operations
  //  * Refresh dataset X to {StoreSet} : Future[Either[Error, NewVersion]]
  //  * Remove dataset X from {StoreSet} : Future[Option[Error]]
  // Get replication status : Map[Store, Version] (from secondary manifest)

  def addToSchema(dataset: String, columns: Map[String, CT], username: String) {
    mutator.withTransaction() { providerOfNecessaryThings =>
      import providerOfNecessaryThings._
      val ds = datasetMapWriter.datasetInfo(dataset).getOrElse(sys.error("Augh no such dataset"))
      val table = datasetMapWriter.latest(ds)
      val logger = datasetLog(ds)

      for((columnName, columnType) <- columns) {
        val baseName = physicalColumnBaseForType(columnType) + "_" + singleId()
        val col = datasetMapWriter.addColumn(table, columnName, nameForType(columnType), baseName)
        schemaLoader(col.versionInfo, logger).addColumn(col)
      }

      logger.endTransaction().foreach { ver =>
        truthManifest.updateLatestVersion(ds, ver)
        globalLog.log(ds, ver, now, username)
      }
    }
  }
}

{'fraction_non_alphanumeric': 0.11286365229582895, 'fraction_numerical': 0.0, 'mean_word_length': 3.6940789473684212, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1466556', 'n_tokens_mistral': 850, 'n_tokens_neox': 825, 'n_words': 215}