{"action":"created","issue":{"url":"https://api.github.com/repos/tresata/spark-sorted/issues/6","labels_url":"https://api.github.com/repos/tresata/spark-sorted/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/tresata/spark-sorted/issues/6/comments","events_url":"https://api.github.com/repos/tresata/spark-sorted/issues/6/events","html_url":"https://github.com/tresata/spark-sorted/pull/6","id":100874351,"number":6,"title":"Add reduceLeftByKey method","user":{"login":"alno","id":30774,"avatar_url":"https://avatars.githubusercontent.com/u/30774?v=3","gravatar_id":"","url":"https://api.github.com/users/alno","html_url":"https://github.com/alno","followers_url":"https://api.github.com/users/alno/followers","following_url":"https://api.github.com/users/alno/following{/other_user}","gists_url":"https://api.github.com/users/alno/gists{/gist_id}","starred_url":"https://api.github.com/users/alno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alno/subscriptions","organizations_url":"https://api.github.com/users/alno/orgs","repos_url":"https://api.github.com/users/alno/repos","events_url":"https://api.github.com/users/alno/events{/privacy}","received_events_url":"https://api.github.com/users/alno/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-13T21:36:18Z","updated_at":"2015-08-14T07:13:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/tresata/spark-sorted/pulls/6","html_url":"https://github.com/tresata/spark-sorted/pull/6","diff_url":"https://github.com/tresata/spark-sorted/pull/6.diff","patch_url":"https://github.com/tresata/spark-sorted/pull/6.patch"},"body":"Hi!\r\n\r\nThis PR implements `reduceLeftByKey` method which is similar to `foldLeftByKey` but doesn't use have value.\r\n\r\nThough it's very simple in implementation it's usage a lot more straightforward than  `mapStreamByKey(iter => Iterator(iter.reduceLeft(f)))`."},"comment":{"url":"https://api.github.com/repos/tresata/spark-sorted/issues/comments/131001768","html_url":"https://github.com/tresata/spark-sorted/pull/6#issuecomment-131001768","issue_url":"https://api.github.com/repos/tresata/spark-sorted/issues/6","id":131001768,"user":{"login":"alno","id":30774,"avatar_url":"https://avatars.githubusercontent.com/u/30774?v=3","gravatar_id":"","url":"https://api.github.com/users/alno","html_url":"https://github.com/alno","followers_url":"https://api.github.com/users/alno/followers","following_url":"https://api.github.com/users/alno/following{/other_user}","gists_url":"https://api.github.com/users/alno/gists{/gist_id}","starred_url":"https://api.github.com/users/alno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alno/subscriptions","organizations_url":"https://api.github.com/users/alno/orgs","repos_url":"https://api.github.com/users/alno/repos","events_url":"https://api.github.com/users/alno/events{/privacy}","received_events_url":"https://api.github.com/users/alno/received_events","type":"User","site_admin":false},"created_at":"2015-08-14T07:13:42Z","updated_at":"2015-08-14T07:13:42Z","body":"Sometimes operation is non-commutative and so order matters. For example, suppose we have something like:\r\n\r\n`case class Update(recordId: Long, lastUpdateTime: Date, someFieldUpdate: Option[Int], otherFieldUpdate: Option[String], ... etc ...)`\r\n\r\nWe want to merge consecutive updates of each record so:\r\n`Update(11, yesteday, Some(11), Some(\"old\")) + Update(11, today, Some(12), None)` become `Update(11, today, Some(12), Some(\"old\"))`\r\n\r\nWhen merging we should sort each group values by time, otherwise old updates may come after new and their values may override new ones.\r\n"}}