{"action":"created","comment":{"url":"https://api.github.com/repos/socrata-platform/spandex/pulls/comments/184913875","pull_request_review_id":116199797,"id":184913875,"diff_hunk":"@@ -0,0 +1,46 @@\n+package com.socrata.spandex.data\n+\n+import java.io.File\n+import scala.io.Source\n+import scala.collection.JavaConverters._\n+import org.scalatest.prop.PropertyChecks\n+import org.scalatest.{FunSuiteLike, Matchers}\n+\n+import com.socrata.datacoordinator.secondary.LifecycleStage\n+\n+import com.socrata.spandex.common.client.{ColumnMap, ColumnValue, DatasetCopy}\n+import com.socrata.spandex.common.SpandexIntegrationTest\n+\n+class LoaderSpec extends FunSuiteLike\n+  with Matchers\n+  with PropertyChecks\n+  with SpandexIntegrationTest {\n+\n+  val datasetId = \"brown_corpus\"\n+\n+  test(\"The Loader should load the expected data with the correct counts\") {\n+    val loader = new Loader(client)\n+    val dataFile = new File(getClass.getResource(\"/brown_tokens.csv\").getFile());","path":"spandex-integration-tests/src/test/scala/com/socrata/spandex/data/LoaderSpec.scala","position":23,"original_position":23,"commit_id":"71f4ba033f0258b6a25aea9294936f800cfe8577","original_commit_id":"71f4ba033f0258b6a25aea9294936f800cfe8577","user":{"login":"rlvoyer","id":172413,"avatar_url":"https://avatars3.githubusercontent.com/u/172413?v=4","gravatar_id":"","url":"https://api.github.com/users/rlvoyer","html_url":"https://github.com/rlvoyer","followers_url":"https://api.github.com/users/rlvoyer/followers","following_url":"https://api.github.com/users/rlvoyer/following{/other_user}","gists_url":"https://api.github.com/users/rlvoyer/gists{/gist_id}","starred_url":"https://api.github.com/users/rlvoyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlvoyer/subscriptions","organizations_url":"https://api.github.com/users/rlvoyer/orgs","repos_url":"https://api.github.com/users/rlvoyer/repos","events_url":"https://api.github.com/users/rlvoyer/events{/privacy}","received_events_url":"https://api.github.com/users/rlvoyer/received_events","type":"User","site_admin":false},"body":"This is a sample of tokens from the Brown Corpus (as indicated in the `dataset_id` variable on line 19). The Brown Corpus is a common corpus for NLP tasks.","created_at":"2018-04-30T05:39:55Z","updated_at":"2018-04-30T05:39:55Z","html_url":"https://github.com/socrata-platform/spandex/pull/122#discussion_r184913875","pull_request_url":"https://api.github.com/repos/socrata-platform/spandex/pulls/122","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/socrata-platform/spandex/pulls/comments/184913875"},"html":{"href":"https://github.com/socrata-platform/spandex/pull/122#discussion_r184913875"},"pull_request":{"href":"https://api.github.com/repos/socrata-platform/spandex/pulls/122"}},"in_reply_to_id":183871454},"pull_request":{"url":"https://api.github.com/repos/socrata-platform/spandex/pulls/122","id":167033716,"html_url":"https://github.com/socrata-platform/spandex/pull/122","diff_url":"https://github.com/socrata-platform/spandex/pull/122.diff","patch_url":"https://github.com/socrata-platform/spandex/pull/122.patch","issue_url":"https://api.github.com/repos/socrata-platform/spandex/issues/122","number":122,"state":"open","locked":false,"title":"Add new mapping to avoid deduplicating suggestions via aggregation","user":{"login":"rlvoyer","id":172413,"avatar_url":"https://avatars3.githubusercontent.com/u/172413?v=4","gravatar_id":"","url":"https://api.github.com/users/rlvoyer","html_url":"https://github.com/rlvoyer","followers_url":"https://api.github.com/users/rlvoyer/followers","following_url":"https://api.github.com/users/rlvoyer/following{/other_user}","gists_url":"https://api.github.com/users/rlvoyer/gists{/gist_id}","starred_url":"https://api.github.com/users/rlvoyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlvoyer/subscriptions","organizations_url":"https://api.github.com/users/rlvoyer/orgs","repos_url":"https://api.github.com/users/rlvoyer/repos","events_url":"https://api.github.com/users/rlvoyer/events{/privacy}","received_events_url":"https://api.github.com/users/rlvoyer/received_events","type":"User","site_admin":false},"body":"With the initial upgrade to Elasticsearch 5, we moved away from Elasticsearch's completion\r\nsuggester for a couple of reasons:\r\n\r\n1. it's not scalable (ie. the memory requirements make it cost prohibitive)\r\n2. it no longer auto dedupes\r\n\r\nThe first change was to replace the completion suggester via the use of a new autocomplete field in\r\nthe mapping and a new edge ngram analyzer. The second change -- specifically to address the\r\ndeduplication issue -- was to introduce an additional aggregation query as part of the suggestions\r\nrequest to ensure that the suggested values are unique.\r\n\r\nAfter some performance testing, despite an expected impact on performance, the individual query\r\nperformance looked reasonable (<1 sec in the aggregate). Once we deployed to production however, we\r\nsaw a different story -- performance degradation was significant in the context of concurrent\r\nrequests.\r\n\r\nThis next revision builds off of that last step. We remove the need for an aggregation to dedupe\r\nsuggestions by restructuring the mapping to store column suggestions as (suggestion, count)\r\npairs. This new mapping is intuitive. We store only the data we need to satisfy the\r\nrequest. This is possible because the secondary receives deltas with each row\r\noperation. Specifically, with each insert, deletion, or update we can do the appropriate\r\nbook-keeping to ensure counts are correct. Storing counts has the added benefit that they can be\r\nused directly for scoring.\r\n\r\nAs a side effect of this new mapping (and the need for partial updates to counts), some integration\r\ntests no longer worked with the local ES testing node. These tests were moved to a new\r\nspandex-integration-tests subproject which expect that Elasticsearch is running locally.\r\n\r\n- [x] unit tests pass\r\n- [x] integration tests pass\r\n- [x] style check passes","created_at":"2018-02-04T22:24:37Z","updated_at":"2018-04-30T05:39:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f49f2e3db88cc633ac0e1e125fe74f90c49148f7","assignee":{"login":"aynleslie","id":6155686,"avatar_url":"https://avatars2.githubusercontent.com/u/6155686?v=4","gravatar_id":"","url":"https://api.github.com/users/aynleslie","html_url":"https://github.com/aynleslie","followers_url":"https://api.github.com/users/aynleslie/followers","following_url":"https://api.github.com/users/aynleslie/following{/other_user}","gists_url":"https://api.github.com/users/aynleslie/gists{/gist_id}","starred_url":"https://api.github.com/users/aynleslie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aynleslie/subscriptions","organizations_url":"https://api.github.com/users/aynleslie/orgs","repos_url":"https://api.github.com/users/aynleslie/repos","events_url":"https://api.github.com/users/aynleslie/events{/privacy}","received_events_url":"https://api.github.com/users/aynleslie/received_events","type":"User","site_admin":false},"assignees":[{"login":"aynleslie","id":6155686,"avatar_url":"https://avatars2.githubusercontent.com/u/6155686?v=4","gravatar_id":"","url":"https://api.github.com/users/aynleslie","html_url":"https://github.com/aynleslie","followers_url":"https://api.github.com/users/aynleslie/followers","following_url":"https://api.github.com/users/aynleslie/following{/other_user}","gists_url":"https://api.github.com/users/aynleslie/gists{/gist_id}","starred_url":"https://api.github.com/users/aynleslie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aynleslie/subscriptions","organizations_url":"https://api.github.com/users/aynleslie/orgs","repos_url":"https://api.github.com/users/aynleslie/repos","events_url":"https://api.github.com/users/aynleslie/events{/privacy}","received_events_url":"https://api.github.com/users/aynleslie/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/socrata-platform/spandex/pulls/122/commits","review_comments_url":"https://api.github.com/repos/socrata-platform/spandex/pulls/122/comments","review_comment_url":"https://api.github.com/repos/socrata-platform/spandex/pulls/comments{/number}","comments_url":"https://api.github.com/repos/socrata-platform/spandex/issues/122/comments","statuses_url":"https://api.github.com/repos/socrata-platform/spandex/statuses/71f4ba033f0258b6a25aea9294936f800cfe8577","head":{"label":"socrata-platform:rlvoyer/new-mapping-test","ref":"rlvoyer/new-mapping-test","sha":"71f4ba033f0258b6a25aea9294936f800cfe8577","user":{"login":"socrata-platform","id":12076358,"avatar_url":"https://avatars3.githubusercontent.com/u/12076358?v=4","gravatar_id":"","url":"https://api.github.com/users/socrata-platform","html_url":"https://github.com/socrata-platform","followers_url":"https://api.github.com/users/socrata-platform/followers","following_url":"https://api.github.com/users/socrata-platform/following{/other_user}","gists_url":"https://api.github.com/users/socrata-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/socrata-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socrata-platform/subscriptions","organizations_url":"https://api.github.com/users/socrata-platform/orgs","repos_url":"https://api.github.com/users/socrata-platform/repos","events_url":"https://api.github.com/users/socrata-platform/events{/privacy}","received_events_url":"https://api.github.com/users/socrata-platform/received_events","type":"Organization","site_admin":false},"repo":{"id":26875426,"name":"spandex","full_name":"socrata-platform/spandex","owner":{"login":"socrata-platform","id":12076358,"avatar_url":"https://avatars3.githubusercontent.com/u/12076358?v=4","gravatar_id":"","url":"https://api.github.com/users/socrata-platform","html_url":"https://github.com/socrata-platform","followers_url":"https://api.github.com/users/socrata-platform/followers","following_url":"https://api.github.com/users/socrata-platform/following{/other_user}","gists_url":"https://api.github.com/users/socrata-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/socrata-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socrata-platform/subscriptions","organizations_url":"https://api.github.com/users/socrata-platform/orgs","repos_url":"https://api.github.com/users/socrata-platform/repos","events_url":"https://api.github.com/users/socrata-platform/events{/privacy}","received_events_url":"https://api.github.com/users/socrata-platform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/socrata-platform/spandex","description":"autocomplete with elasticsearch ","fork":false,"url":"https://api.github.com/repos/socrata-platform/spandex","forks_url":"https://api.github.com/repos/socrata-platform/spandex/forks","keys_url":"https://api.github.com/repos/socrata-platform/spandex/keys{/key_id}","collaborators_url":"https://api.github.com/repos/socrata-platform/spandex/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/socrata-platform/spandex/teams","hooks_url":"https://api.github.com/repos/socrata-platform/spandex/hooks","issue_events_url":"https://api.github.com/repos/socrata-platform/spandex/issues/events{/number}","events_url":"https://api.github.com/repos/socrata-platform/spandex/events","assignees_url":"https://api.github.com/repos/socrata-platform/spandex/assignees{/user}","branches_url":"https://api.github.com/repos/socrata-platform/spandex/branches{/branch}","tags_url":"https://api.github.com/repos/socrata-platform/spandex/tags","blobs_url":"https://api.github.com/repos/socrata-platform/spandex/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/socrata-platform/spandex/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/socrata-platform/spandex/git/refs{/sha}","trees_url":"https://api.github.com/repos/socrata-platform/spandex/git/trees{/sha}","statuses_url":"https://api.github.com/repos/socrata-platform/spandex/statuses/{sha}","languages_url":"https://api.github.com/repos/socrata-platform/spandex/languages","stargazers_url":"https://api.github.com/repos/socrata-platform/spandex/stargazers","contributors_url":"https://api.github.com/repos/socrata-platform/spandex/contributors","subscribers_url":"https://api.github.com/repos/socrata-platform/spandex/subscribers","subscription_url":"https://api.github.com/repos/socrata-platform/spandex/subscription","commits_url":"https://api.github.com/repos/socrata-platform/spandex/commits{/sha}","git_commits_url":"https://api.github.com/repos/socrata-platform/spandex/git/commits{/sha}","comments_url":"https://api.github.com/repos/socrata-platform/spandex/comments{/number}","issue_comment_url":"https://api.github.com/repos/socrata-platform/spandex/issues/comments{/number}","contents_url":"https://api.github.com/repos/socrata-platform/spandex/contents/{+path}","compare_url":"https://api.github.com/repos/socrata-platform/spandex/compare/{base}...{head}","merges_url":"https://api.github.com/repos/socrata-platform/spandex/merges","archive_url":"https://api.github.com/repos/socrata-platform/spandex/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/socrata-platform/spandex/downloads","issues_url":"https://api.github.com/repos/socrata-platform/spandex/issues{/number}","pulls_url":"https://api.github.com/repos/socrata-platform/spandex/pulls{/number}","milestones_url":"https://api.github.com/repos/socrata-platform/spandex/milestones{/number}","notifications_url":"https://api.github.com/repos/socrata-platform/spandex/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/socrata-platform/spandex/labels{/name}","releases_url":"https://api.github.com/repos/socrata-platform/spandex/releases{/id}","deployments_url":"https://api.github.com/repos/socrata-platform/spandex/deployments","created_at":"2014-11-19T18:32:11Z","updated_at":"2017-03-06T18:56:14Z","pushed_at":"2018-04-24T16:20:23Z","git_url":"git://github.com/socrata-platform/spandex.git","ssh_url":"git@github.com:socrata-platform/spandex.git","clone_url":"https://github.com/socrata-platform/spandex.git","svn_url":"https://github.com/socrata-platform/spandex","homepage":null,"size":110090,"stargazers_count":3,"watchers_count":3,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":8,"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":8,"watchers":3,"default_branch":"master"}},"base":{"label":"socrata-platform:master","ref":"master","sha":"62225785ee3d2b3d3b394394c19b782ef63e3635","user":{"login":"socrata-platform","id":12076358,"avatar_url":"https://avatars3.githubusercontent.com/u/12076358?v=4","gravatar_id":"","url":"https://api.github.com/users/socrata-platform","html_url":"https://github.com/socrata-platform","followers_url":"https://api.github.com/users/socrata-platform/followers","following_url":"https://api.github.com/users/socrata-platform/following{/other_user}","gists_url":"https://api.github.com/users/socrata-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/socrata-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socrata-platform/subscriptions","organizations_url":"https://api.github.com/users/socrata-platform/orgs","repos_url":"https://api.github.com/users/socrata-platform/repos","events_url":"https://api.github.com/users/socrata-platform/events{/privacy}","received_events_url":"https://api.github.com/users/socrata-platform/received_events","type":"Organization","site_admin":false},"repo":{"id":26875426,"name":"spandex","full_name":"socrata-platform/spandex","owner":{"login":"socrata-platform","id":12076358,"avatar_url":"https://avatars3.githubusercontent.com/u/12076358?v=4","gravatar_id":"","url":"https://api.github.com/users/socrata-platform","html_url":"https://github.com/socrata-platform","followers_url":"https://api.github.com/users/socrata-platform/followers","following_url":"https://api.github.com/users/socrata-platform/following{/other_user}","gists_url":"https://api.github.com/users/socrata-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/socrata-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socrata-platform/subscriptions","organizations_url":"https://api.github.com/users/socrata-platform/orgs","repos_url":"https://api.github.com/users/socrata-platform/repos","events_url":"https://api.github.com/users/socrata-platform/events{/privacy}","received_events_url":"https://api.github.com/users/socrata-platform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/socrata-platform/spandex","description":"autocomplete with elasticsearch ","fork":false,"url":"https://api.github.com/repos/socrata-platform/spandex","forks_url":"https://api.github.com/repos/socrata-platform/spandex/forks","keys_url":"https://api.github.com/repos/socrata-platform/spandex/keys{/key_id}","collaborators_url":"https://api.github.com/repos/socrata-platform/spandex/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/socrata-platform/spandex/teams","hooks_url":"https://api.github.com/repos/socrata-platform/spandex/hooks","issue_events_url":"https://api.github.com/repos/socrata-platform/spandex/issues/events{/number}","events_url":"https://api.github.com/repos/socrata-platform/spandex/events","assignees_url":"https://api.github.com/repos/socrata-platform/spandex/assignees{/user}","branches_url":"https://api.github.com/repos/socrata-platform/spandex/branches{/branch}","tags_url":"https://api.github.com/repos/socrata-platform/spandex/tags","blobs_url":"https://api.github.com/repos/socrata-platform/spandex/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/socrata-platform/spandex/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/socrata-platform/spandex/git/refs{/sha}","trees_url":"https://api.github.com/repos/socrata-platform/spandex/git/trees{/sha}","statuses_url":"https://api.github.com/repos/socrata-platform/spandex/statuses/{sha}","languages_url":"https://api.github.com/repos/socrata-platform/spandex/languages","stargazers_url":"https://api.github.com/repos/socrata-platform/spandex/stargazers","contributors_url":"https://api.github.com/repos/socrata-platform/spandex/contributors","subscribers_url":"https://api.github.com/repos/socrata-platform/spandex/subscribers","subscription_url":"https://api.github.com/repos/socrata-platform/spandex/subscription","commits_url":"https://api.github.com/repos/socrata-platform/spandex/commits{/sha}","git_commits_url":"https://api.github.com/repos/socrata-platform/spandex/git/commits{/sha}","comments_url":"https://api.github.com/repos/socrata-platform/spandex/comments{/number}","issue_comment_url":"https://api.github.com/repos/socrata-platform/spandex/issues/comments{/number}","contents_url":"https://api.github.com/repos/socrata-platform/spandex/contents/{+path}","compare_url":"https://api.github.com/repos/socrata-platform/spandex/compare/{base}...{head}","merges_url":"https://api.github.com/repos/socrata-platform/spandex/merges","archive_url":"https://api.github.com/repos/socrata-platform/spandex/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/socrata-platform/spandex/downloads","issues_url":"https://api.github.com/repos/socrata-platform/spandex/issues{/number}","pulls_url":"https://api.github.com/repos/socrata-platform/spandex/pulls{/number}","milestones_url":"https://api.github.com/repos/socrata-platform/spandex/milestones{/number}","notifications_url":"https://api.github.com/repos/socrata-platform/spandex/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/socrata-platform/spandex/labels{/name}","releases_url":"https://api.github.com/repos/socrata-platform/spandex/releases{/id}","deployments_url":"https://api.github.com/repos/socrata-platform/spandex/deployments","created_at":"2014-11-19T18:32:11Z","updated_at":"2017-03-06T18:56:14Z","pushed_at":"2018-04-24T16:20:23Z","git_url":"git://github.com/socrata-platform/spandex.git","ssh_url":"git@github.com:socrata-platform/spandex.git","clone_url":"https://github.com/socrata-platform/spandex.git","svn_url":"https://github.com/socrata-platform/spandex","homepage":null,"size":110090,"stargazers_count":3,"watchers_count":3,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":8,"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":8,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/socrata-platform/spandex/pulls/122"},"html":{"href":"https://github.com/socrata-platform/spandex/pull/122"},"issue":{"href":"https://api.github.com/repos/socrata-platform/spandex/issues/122"},"comments":{"href":"https://api.github.com/repos/socrata-platform/spandex/issues/122/comments"},"review_comments":{"href":"https://api.github.com/repos/socrata-platform/spandex/pulls/122/comments"},"review_comment":{"href":"https://api.github.com/repos/socrata-platform/spandex/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/socrata-platform/spandex/pulls/122/commits"},"statuses":{"href":"https://api.github.com/repos/socrata-platform/spandex/statuses/71f4ba033f0258b6a25aea9294936f800cfe8577"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"rlvoyer"}}