{"action":"created","comment":{"url":"https://api.github.com/repos/slamdata/slamengine/pulls/comments/24446101","id":24446101,"diff_hunk":"@@ -46,50 +53,59 @@ object Data {\n   }\n   case class Dec(value: BigDecimal) extends Number {\n     def dataType = Type.Dec\n-    \n-    override def toString = s\"Data.Dec($value)\"\n+    def toJs = JsCore.Literal(Js.Num(value.doubleValue, true)).fix\n   }\n   case class Int(value: BigInt) extends Number {\n     def dataType = Type.Int\n-    \n-    override def toString = s\"Data.Int($value)\"\n+    def toJs = JsCore.Literal(Js.Num(value.doubleValue, false)).fix\n   }\n \n   case class Obj(value: Map[String, Data]) extends Data {\n     def dataType = (value.map {\n       case (name, data) => Type.NamedField(name, data.dataType)\n     }).foldLeft[Type](Type.Top)(_ & _)\n+    def toJs =\n+      JsCore.Obj(value.toList.map { case (k, v) => k -> v.toJs }.toListMap).fix\n   }\n \n   case class Arr(value: List[Data]) extends Data {\n     def dataType = (value.zipWithIndex.map {\n       case (data, index) => Type.IndexedElem(index, data.dataType)\n     }).foldLeft[Type](Type.Top)(_ & _)\n+    def toJs = JsCore.Arr(value.map(_.toJs)).fix\n   }\n \n   case class Set(value: List[Data]) extends Data {\n     def dataType = (value.headOption.map { head => \n       value.drop(1).map(_.dataType).foldLeft(head.dataType)(Type.lub _)\n     }).getOrElse(Type.Bottom) // TODO: ???\n+    def toJs = JsCore.Arr(value.map(_.toJs)).fix\n   }\n \n   case class Timestamp(value: Instant) extends Data {\n     def dataType = Type.Timestamp\n+    def toJs = JsCore.New(\"Date\", List(JsCore.Literal(Js.Str(value.toString)).fix)).fix\n   }\n \n   case class Date(value: LocalDate) extends Data {\n     def dataType = Type.Date\n+    def toJs = JsCore.New(\"Date\", List(JsCore.Literal(Js.Str(value.toString)).fix)).fix\n   }\n \n   case class Time(value: LocalTime) extends Data {\n     def dataType = Type.Time\n+    def toJs = JsCore.Literal(Js.Str(value.toString)).fix\n   }\n \n   case class Interval(value: Duration) extends Data {\n     def dataType = Type.Interval\n+    def toJs = JsCore.Literal(Js.Num(value.getSeconds, true)).fix","path":"core/src/main/scala/slamdata/engine/data.scala","position":100,"original_position":100,"commit_id":"4d7df37dbf2d6a927bd4bca2e49fafa906812065","original_commit_id":"4d7df37dbf2d6a927bd4bca2e49fafa906812065","user":{"login":"mossprescott","id":6147371,"avatar_url":"https://avatars.githubusercontent.com/u/6147371?v=3","gravatar_id":"","url":"https://api.github.com/users/mossprescott","html_url":"https://github.com/mossprescott","followers_url":"https://api.github.com/users/mossprescott/followers","following_url":"https://api.github.com/users/mossprescott/following{/other_user}","gists_url":"https://api.github.com/users/mossprescott/gists{/gist_id}","starred_url":"https://api.github.com/users/mossprescott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mossprescott/subscriptions","organizations_url":"https://api.github.com/users/mossprescott/orgs","repos_url":"https://api.github.com/users/mossprescott/repos","events_url":"https://api.github.com/users/mossprescott/events{/privacy}","received_events_url":"https://api.github.com/users/mossprescott/received_events","type":"User","site_admin":false},"body":"Should be milliseconds (See `Bson.fromData`).\r\n\r\nWe really need tests for this sort of thing; see #483.","created_at":"2015-02-10T20:12:03Z","updated_at":"2015-02-10T20:12:03Z","html_url":"https://github.com/slamdata/slamengine/pull/611#discussion_r24446101","pull_request_url":"https://api.github.com/repos/slamdata/slamengine/pulls/611","_links":{"self":{"href":"https://api.github.com/repos/slamdata/slamengine/pulls/comments/24446101"},"html":{"href":"https://github.com/slamdata/slamengine/pull/611#discussion_r24446101"},"pull_request":{"href":"https://api.github.com/repos/slamdata/slamengine/pulls/611"}}},"pull_request":{"url":"https://api.github.com/repos/slamdata/slamengine/pulls/611","id":28982191,"html_url":"https://github.com/slamdata/slamengine/pull/611","diff_url":"https://github.com/slamdata/slamengine/pull/611.diff","patch_url":"https://github.com/slamdata/slamengine/pull/611.patch","issue_url":"https://api.github.com/repos/slamdata/slamengine/issues/611","number":611,"state":"open","locked":false,"title":"A number of small unrelated changes.","user":{"login":"sellout","id":33031,"avatar_url":"https://avatars.githubusercontent.com/u/33031?v=3","gravatar_id":"","url":"https://api.github.com/users/sellout","html_url":"https://github.com/sellout","followers_url":"https://api.github.com/users/sellout/followers","following_url":"https://api.github.com/users/sellout/following{/other_user}","gists_url":"https://api.github.com/users/sellout/gists{/gist_id}","starred_url":"https://api.github.com/users/sellout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sellout/subscriptions","organizations_url":"https://api.github.com/users/sellout/orgs","repos_url":"https://api.github.com/users/sellout/repos","events_url":"https://api.github.com/users/sellout/events{/privacy}","received_events_url":"https://api.github.com/users/sellout/received_events","type":"User","site_admin":false},"body":"The intent here was to improve coverage a bit, but I found various\nthings along the way that maybe didn’t help with that goal. I’ll list\nthe changes in the order of the GitHub diff to make it easier to review\nthem.\n\n* Move `Planner.convertConstant` to `Data.toJs` and implement all\n  cases (no more errors);\n* remove State from `projectIndex` result;\n* eliminate some unused error types;\n* remove now-dead `chainBuilder`;\n* fix array expr rewriting when converting to `CollectionBuilder`;\n* don’t error when concatted objects have conflicting keys;\n* fix reversed concatting of arrays;\n* add statically-known case (and tests for it) to `projectIndex`;\n* eliminate `HavingRoot` and generalizes the `$sort; $project` case in\n  `distinctBy`’s `findSortKeys`;\n* rename the parameters to typecheck;\n* modify some join tests to exercise different join types; and\n* add a pending test for issue #610.","created_at":"2015-02-10T05:32:18Z","updated_at":"2015-02-10T20:12:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aa94c8780f4fd718d06f0cc740acb43af6336ed7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/slamdata/slamengine/pulls/611/commits","review_comments_url":"https://api.github.com/repos/slamdata/slamengine/pulls/611/comments","review_comment_url":"https://api.github.com/repos/slamdata/slamengine/pulls/comments/{number}","comments_url":"https://api.github.com/repos/slamdata/slamengine/issues/611/comments","statuses_url":"https://api.github.com/repos/slamdata/slamengine/statuses/4d7df37dbf2d6a927bd4bca2e49fafa906812065","head":{"label":"sellout:ready/improving-coverage","ref":"ready/improving-coverage","sha":"4d7df37dbf2d6a927bd4bca2e49fafa906812065","user":{"login":"sellout","id":33031,"avatar_url":"https://avatars.githubusercontent.com/u/33031?v=3","gravatar_id":"","url":"https://api.github.com/users/sellout","html_url":"https://github.com/sellout","followers_url":"https://api.github.com/users/sellout/followers","following_url":"https://api.github.com/users/sellout/following{/other_user}","gists_url":"https://api.github.com/users/sellout/gists{/gist_id}","starred_url":"https://api.github.com/users/sellout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sellout/subscriptions","organizations_url":"https://api.github.com/users/sellout/orgs","repos_url":"https://api.github.com/users/sellout/repos","events_url":"https://api.github.com/users/sellout/events{/privacy}","received_events_url":"https://api.github.com/users/sellout/received_events","type":"User","site_admin":false},"repo":{"id":21178230,"name":"slamengine","full_name":"sellout/slamengine","owner":{"login":"sellout","id":33031,"avatar_url":"https://avatars.githubusercontent.com/u/33031?v=3","gravatar_id":"","url":"https://api.github.com/users/sellout","html_url":"https://github.com/sellout","followers_url":"https://api.github.com/users/sellout/followers","following_url":"https://api.github.com/users/sellout/following{/other_user}","gists_url":"https://api.github.com/users/sellout/gists{/gist_id}","starred_url":"https://api.github.com/users/sellout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sellout/subscriptions","organizations_url":"https://api.github.com/users/sellout/orgs","repos_url":"https://api.github.com/users/sellout/repos","events_url":"https://api.github.com/users/sellout/events{/privacy}","received_events_url":"https://api.github.com/users/sellout/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sellout/slamengine","description":"The engine for SlamData","fork":true,"url":"https://api.github.com/repos/sellout/slamengine","forks_url":"https://api.github.com/repos/sellout/slamengine/forks","keys_url":"https://api.github.com/repos/sellout/slamengine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sellout/slamengine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sellout/slamengine/teams","hooks_url":"https://api.github.com/repos/sellout/slamengine/hooks","issue_events_url":"https://api.github.com/repos/sellout/slamengine/issues/events{/number}","events_url":"https://api.github.com/repos/sellout/slamengine/events","assignees_url":"https://api.github.com/repos/sellout/slamengine/assignees{/user}","branches_url":"https://api.github.com/repos/sellout/slamengine/branches{/branch}","tags_url":"https://api.github.com/repos/sellout/slamengine/tags","blobs_url":"https://api.github.com/repos/sellout/slamengine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sellout/slamengine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sellout/slamengine/git/refs{/sha}","trees_url":"https://api.github.com/repos/sellout/slamengine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sellout/slamengine/statuses/{sha}","languages_url":"https://api.github.com/repos/sellout/slamengine/languages","stargazers_url":"https://api.github.com/repos/sellout/slamengine/stargazers","contributors_url":"https://api.github.com/repos/sellout/slamengine/contributors","subscribers_url":"https://api.github.com/repos/sellout/slamengine/subscribers","subscription_url":"https://api.github.com/repos/sellout/slamengine/subscription","commits_url":"https://api.github.com/repos/sellout/slamengine/commits{/sha}","git_commits_url":"https://api.github.com/repos/sellout/slamengine/git/commits{/sha}","comments_url":"https://api.github.com/repos/sellout/slamengine/comments{/number}","issue_comment_url":"https://api.github.com/repos/sellout/slamengine/issues/comments/{number}","contents_url":"https://api.github.com/repos/sellout/slamengine/contents/{+path}","compare_url":"https://api.github.com/repos/sellout/slamengine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sellout/slamengine/merges","archive_url":"https://api.github.com/repos/sellout/slamengine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sellout/slamengine/downloads","issues_url":"https://api.github.com/repos/sellout/slamengine/issues{/number}","pulls_url":"https://api.github.com/repos/sellout/slamengine/pulls{/number}","milestones_url":"https://api.github.com/repos/sellout/slamengine/milestones{/number}","notifications_url":"https://api.github.com/repos/sellout/slamengine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sellout/slamengine/labels{/name}","releases_url":"https://api.github.com/repos/sellout/slamengine/releases{/id}","created_at":"2014-06-24T19:38:07Z","updated_at":"2014-09-08T15:39:05Z","pushed_at":"2015-02-10T19:30:26Z","git_url":"git://github.com/sellout/slamengine.git","ssh_url":"git@github.com:sellout/slamengine.git","clone_url":"https://github.com/sellout/slamengine.git","svn_url":"https://github.com/sellout/slamengine","homepage":null,"size":5253,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"CHECK-UPSTREAM-REPO"}},"base":{"label":"slamdata:master","ref":"master","sha":"8a875640d21f99df7dcb1dfb65a236b4cbf7779b","user":{"login":"slamdata","id":5385602,"avatar_url":"https://avatars.githubusercontent.com/u/5385602?v=3","gravatar_id":"","url":"https://api.github.com/users/slamdata","html_url":"https://github.com/slamdata","followers_url":"https://api.github.com/users/slamdata/followers","following_url":"https://api.github.com/users/slamdata/following{/other_user}","gists_url":"https://api.github.com/users/slamdata/gists{/gist_id}","starred_url":"https://api.github.com/users/slamdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slamdata/subscriptions","organizations_url":"https://api.github.com/users/slamdata/orgs","repos_url":"https://api.github.com/users/slamdata/repos","events_url":"https://api.github.com/users/slamdata/events{/privacy}","received_events_url":"https://api.github.com/users/slamdata/received_events","type":"Organization","site_admin":false},"repo":{"id":16515058,"name":"slamengine","full_name":"slamdata/slamengine","owner":{"login":"slamdata","id":5385602,"avatar_url":"https://avatars.githubusercontent.com/u/5385602?v=3","gravatar_id":"","url":"https://api.github.com/users/slamdata","html_url":"https://github.com/slamdata","followers_url":"https://api.github.com/users/slamdata/followers","following_url":"https://api.github.com/users/slamdata/following{/other_user}","gists_url":"https://api.github.com/users/slamdata/gists{/gist_id}","starred_url":"https://api.github.com/users/slamdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slamdata/subscriptions","organizations_url":"https://api.github.com/users/slamdata/orgs","repos_url":"https://api.github.com/users/slamdata/repos","events_url":"https://api.github.com/users/slamdata/events{/privacy}","received_events_url":"https://api.github.com/users/slamdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/slamdata/slamengine","description":"The engine for SlamData","fork":false,"url":"https://api.github.com/repos/slamdata/slamengine","forks_url":"https://api.github.com/repos/slamdata/slamengine/forks","keys_url":"https://api.github.com/repos/slamdata/slamengine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/slamdata/slamengine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/slamdata/slamengine/teams","hooks_url":"https://api.github.com/repos/slamdata/slamengine/hooks","issue_events_url":"https://api.github.com/repos/slamdata/slamengine/issues/events{/number}","events_url":"https://api.github.com/repos/slamdata/slamengine/events","assignees_url":"https://api.github.com/repos/slamdata/slamengine/assignees{/user}","branches_url":"https://api.github.com/repos/slamdata/slamengine/branches{/branch}","tags_url":"https://api.github.com/repos/slamdata/slamengine/tags","blobs_url":"https://api.github.com/repos/slamdata/slamengine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/slamdata/slamengine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/slamdata/slamengine/git/refs{/sha}","trees_url":"https://api.github.com/repos/slamdata/slamengine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/slamdata/slamengine/statuses/{sha}","languages_url":"https://api.github.com/repos/slamdata/slamengine/languages","stargazers_url":"https://api.github.com/repos/slamdata/slamengine/stargazers","contributors_url":"https://api.github.com/repos/slamdata/slamengine/contributors","subscribers_url":"https://api.github.com/repos/slamdata/slamengine/subscribers","subscription_url":"https://api.github.com/repos/slamdata/slamengine/subscription","commits_url":"https://api.github.com/repos/slamdata/slamengine/commits{/sha}","git_commits_url":"https://api.github.com/repos/slamdata/slamengine/git/commits{/sha}","comments_url":"https://api.github.com/repos/slamdata/slamengine/comments{/number}","issue_comment_url":"https://api.github.com/repos/slamdata/slamengine/issues/comments/{number}","contents_url":"https://api.github.com/repos/slamdata/slamengine/contents/{+path}","compare_url":"https://api.github.com/repos/slamdata/slamengine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/slamdata/slamengine/merges","archive_url":"https://api.github.com/repos/slamdata/slamengine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/slamdata/slamengine/downloads","issues_url":"https://api.github.com/repos/slamdata/slamengine/issues{/number}","pulls_url":"https://api.github.com/repos/slamdata/slamengine/pulls{/number}","milestones_url":"https://api.github.com/repos/slamdata/slamengine/milestones{/number}","notifications_url":"https://api.github.com/repos/slamdata/slamengine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/slamdata/slamengine/labels{/name}","releases_url":"https://api.github.com/repos/slamdata/slamengine/releases{/id}","created_at":"2014-02-04T15:01:27Z","updated_at":"2015-02-10T19:52:01Z","pushed_at":"2015-02-10T20:10:01Z","git_url":"git://github.com/slamdata/slamengine.git","ssh_url":"git@github.com:slamdata/slamengine.git","clone_url":"https://github.com/slamdata/slamengine.git","svn_url":"https://github.com/slamdata/slamengine","homepage":null,"size":7457,"stargazers_count":91,"watchers_count":91,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":122,"forks":21,"open_issues":122,"watchers":91,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/slamdata/slamengine/pulls/611"},"html":{"href":"https://github.com/slamdata/slamengine/pull/611"},"issue":{"href":"https://api.github.com/repos/slamdata/slamengine/issues/611"},"comments":{"href":"https://api.github.com/repos/slamdata/slamengine/issues/611/comments"},"review_comments":{"href":"https://api.github.com/repos/slamdata/slamengine/pulls/611/comments"},"review_comment":{"href":"https://api.github.com/repos/slamdata/slamengine/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/slamdata/slamengine/pulls/611/commits"},"statuses":{"href":"https://api.github.com/repos/slamdata/slamengine/statuses/4d7df37dbf2d6a927bd4bca2e49fafa906812065"}}}}