{"action":"created","issue":{"url":"https://api.github.com/repos/quasar-analytics/quasar/issues/1769","repository_url":"https://api.github.com/repos/quasar-analytics/quasar","labels_url":"https://api.github.com/repos/quasar-analytics/quasar/issues/1769/labels{/name}","comments_url":"https://api.github.com/repos/quasar-analytics/quasar/issues/1769/comments","events_url":"https://api.github.com/repos/quasar-analytics/quasar/issues/1769/events","html_url":"https://github.com/quasar-analytics/quasar/issues/1769","id":194444173,"number":1769,"title":"ReduceIndex should be able to reference the bucket","user":{"login":"alissapajer","id":1088100,"avatar_url":"https://avatars.githubusercontent.com/u/1088100?v=3","gravatar_id":"","url":"https://api.github.com/users/alissapajer","html_url":"https://github.com/alissapajer","followers_url":"https://api.github.com/users/alissapajer/followers","following_url":"https://api.github.com/users/alissapajer/following{/other_user}","gists_url":"https://api.github.com/users/alissapajer/gists{/gist_id}","starred_url":"https://api.github.com/users/alissapajer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alissapajer/subscriptions","organizations_url":"https://api.github.com/users/alissapajer/orgs","repos_url":"https://api.github.com/users/alissapajer/repos","events_url":"https://api.github.com/users/alissapajer/events{/privacy}","received_events_url":"https://api.github.com/users/alissapajer/received_events","type":"User","site_admin":false},"labels":[{"id":430930425,"url":"https://api.github.com/repos/quasar-analytics/quasar/labels/QScript","name":"QScript","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/quasar-analytics/quasar/milestones/14","html_url":"https://github.com/quasar-analytics/quasar/milestone/14","labels_url":"https://api.github.com/repos/quasar-analytics/quasar/milestones/14/labels","id":2162208,"number":14,"title":"4.2","description":"","creator":{"login":"jdegoes","id":156745,"avatar_url":"https://avatars.githubusercontent.com/u/156745?v=3","gravatar_id":"","url":"https://api.github.com/users/jdegoes","html_url":"https://github.com/jdegoes","followers_url":"https://api.github.com/users/jdegoes/followers","following_url":"https://api.github.com/users/jdegoes/following{/other_user}","gists_url":"https://api.github.com/users/jdegoes/gists{/gist_id}","starred_url":"https://api.github.com/users/jdegoes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdegoes/subscriptions","organizations_url":"https://api.github.com/users/jdegoes/orgs","repos_url":"https://api.github.com/users/jdegoes/repos","events_url":"https://api.github.com/users/jdegoes/events{/privacy}","received_events_url":"https://api.github.com/users/jdegoes/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":0,"state":"open","created_at":"2016-11-28T21:41:46Z","updated_at":"2016-12-08T21:05:04Z","due_on":"2017-04-03T00:00:00Z","closed_at":null},"comments":6,"created_at":"2016-12-08T21:05:04Z","updated_at":"2016-12-08T21:49:31Z","closed_at":null,"body":"```\r\nselect city, state, sum(pop) as population from zips group by city, state order by population desc limit 5\r\n```\r\n\r\nIn the following qscript, the bucket of the `Reduce` is duplicated four times within the reducers. We can remove this duplication by allowing the references into the list of reducers (currently `ReduceIndex`) to also reference the bucket. For example, we could use `Option[ReduceIndex]` or have `ReduceIndex` take `Option[Int]`.\r\n\r\n```\r\nSubset(Take)\r\n├─ Unreferenced\r\n├─ From\r\n│  ╰─ Map\r\n│     ├─ Sort\r\n│     │  ├─ Reduce\r\n│     │  │  ├─ LeftShift\r\n│     │  │  │  ├─ Read(/slamengine-test-01/zips)\r\n│     │  │  │  ├─ Struct\r\n│     │  │  │  │  ╰─ ○\r\n│     │  │  │  ├─ IdStatus\r\n│     │  │  │  │  ╰─ IdStatus(ExcludeId)\r\n│     │  │  │  ╰─ Repair\r\n│     │  │  │     ╰─ RightSide\r\n│     │  │  ├─ Bucket\r\n│     │  │  │  ╰─ MakeArray\r\n│     │  │  │     ╰─ ConcatArrays\r\n│     │  │  │        ├─ MakeArray\r\n│     │  │  │        │  ╰─ ProjectField\r\n│     │  │  │        │     ├─ Guard\r\n│     │  │  │        │     │  ├─ ○\r\n│     │  │  │        │     │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │        │     │  ├─ ○\r\n│     │  │  │        │     │  ╰─ Undefined\r\n│     │  │  │        │     ╰─ Constant(Str(city))\r\n│     │  │  │        ╰─ MakeArray\r\n│     │  │  │           ╰─ ProjectField\r\n│     │  │  │              ├─ Guard\r\n│     │  │  │              │  ├─ ○\r\n│     │  │  │              │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │              │  ├─ ○\r\n│     │  │  │              │  ╰─ Undefined\r\n│     │  │  │              ╰─ Constant(Str(state))\r\n│     │  │  ├─ Reducers\r\n│     │  │  │  ├─ Arbitrary\r\n│     │  │  │  │  ╰─ MakeArray\r\n│     │  │  │  │     ╰─ ConcatArrays\r\n│     │  │  │  │        ├─ MakeArray\r\n│     │  │  │  │        │  ╰─ ProjectField\r\n│     │  │  │  │        │     ├─ Guard\r\n│     │  │  │  │        │     │  ├─ ○\r\n│     │  │  │  │        │     │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │  │        │     │  ├─ ○\r\n│     │  │  │  │        │     │  ╰─ Undefined\r\n│     │  │  │  │        │     ╰─ Constant(Str(city))\r\n│     │  │  │  │        ╰─ MakeArray\r\n│     │  │  │  │           ╰─ ProjectField\r\n│     │  │  │  │              ├─ Guard\r\n│     │  │  │  │              │  ├─ ○\r\n│     │  │  │  │              │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │  │              │  ├─ ○\r\n│     │  │  │  │              │  ╰─ Undefined\r\n│     │  │  │  │              ╰─ Constant(Str(state))\r\n│     │  │  │  ├─ Arbitrary\r\n│     │  │  │  │  ╰─ ProjectField\r\n│     │  │  │  │     ├─ Guard\r\n│     │  │  │  │     │  ├─ ○\r\n│     │  │  │  │     │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │  │     │  ├─ ○\r\n│     │  │  │  │     │  ╰─ Undefined\r\n│     │  │  │  │     ╰─ Constant(Str(city))\r\n│     │  │  │  ├─ Arbitrary\r\n│     │  │  │  │  ╰─ ProjectField\r\n│     │  │  │  │     ├─ Guard\r\n│     │  │  │  │     │  ├─ ○\r\n│     │  │  │  │     │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │  │     │  ├─ ○\r\n│     │  │  │  │     │  ╰─ Undefined\r\n│     │  │  │  │     ╰─ Constant(Str(state))\r\n│     │  │  │  ├─ Arbitrary\r\n│     │  │  │  │  ╰─ MakeArray\r\n│     │  │  │  │     ╰─ ConcatArrays\r\n│     │  │  │  │        ├─ MakeArray\r\n│     │  │  │  │        │  ╰─ ProjectField\r\n│     │  │  │  │        │     ├─ Guard\r\n│     │  │  │  │        │     │  ├─ ○\r\n│     │  │  │  │        │     │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │  │        │     │  ├─ ○\r\n│     │  │  │  │        │     │  ╰─ Undefined\r\n│     │  │  │  │        │     ╰─ Constant(Str(city))\r\n│     │  │  │  │        ╰─ MakeArray\r\n│     │  │  │  │           ╰─ ProjectField\r\n│     │  │  │  │              ├─ Guard\r\n│     │  │  │  │              │  ├─ ○\r\n│     │  │  │  │              │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │  │              │  ├─ ○\r\n│     │  │  │  │              │  ╰─ Undefined\r\n│     │  │  │  │              ╰─ Constant(Str(state))\r\n│     │  │  │  ├─ Sum\r\n│     │  │  │  │  ╰─ Guard\r\n│     │  │  │  │     ├─ ProjectField\r\n│     │  │  │  │     │  ├─ Guard\r\n│     │  │  │  │     │  │  ├─ ○\r\n│     │  │  │  │     │  │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │  │     │  │  ├─ ○\r\n│     │  │  │  │     │  │  ╰─ Undefined\r\n│     │  │  │  │     │  ╰─ Constant(Str(pop))\r\n│     │  │  │  │     ├─ Type(Int, Dec, or Interval)\r\n│     │  │  │  │     ├─ ProjectField\r\n│     │  │  │  │     │  ├─ Guard\r\n│     │  │  │  │     │  │  ├─ ○\r\n│     │  │  │  │     │  │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │  │     │  │  ├─ ○\r\n│     │  │  │  │     │  │  ╰─ Undefined\r\n│     │  │  │  │     │  ╰─ Constant(Str(pop))\r\n│     │  │  │  │     ╰─ Undefined\r\n│     │  │  │  ├─ Arbitrary\r\n│     │  │  │  │  ╰─ MakeArray\r\n│     │  │  │  │     ╰─ ConcatArrays\r\n│     │  │  │  │        ├─ MakeArray\r\n│     │  │  │  │        │  ╰─ ProjectField\r\n│     │  │  │  │        │     ├─ Guard\r\n│     │  │  │  │        │     │  ├─ ○\r\n│     │  │  │  │        │     │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │  │        │     │  ├─ ○\r\n│     │  │  │  │        │     │  ╰─ Undefined\r\n│     │  │  │  │        │     ╰─ Constant(Str(city))\r\n│     │  │  │  │        ╰─ MakeArray\r\n│     │  │  │  │           ╰─ ProjectField\r\n│     │  │  │  │              ├─ Guard\r\n│     │  │  │  │              │  ├─ ○\r\n│     │  │  │  │              │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │  │              │  ├─ ○\r\n│     │  │  │  │              │  ╰─ Undefined\r\n│     │  │  │  │              ╰─ Constant(Str(state))\r\n│     │  │  │  ├─ Arbitrary\r\n│     │  │  │  │  ╰─ MakeArray\r\n│     │  │  │  │     ╰─ ConcatArrays\r\n│     │  │  │  │        ├─ MakeArray\r\n│     │  │  │  │        │  ╰─ ProjectField\r\n│     │  │  │  │        │     ├─ Guard\r\n│     │  │  │  │        │     │  ├─ ○\r\n│     │  │  │  │        │     │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │  │        │     │  ├─ ○\r\n│     │  │  │  │        │     │  ╰─ Undefined\r\n│     │  │  │  │        │     ╰─ Constant(Str(city))\r\n│     │  │  │  │        ╰─ MakeArray\r\n│     │  │  │  │           ╰─ ProjectField\r\n│     │  │  │  │              ├─ Guard\r\n│     │  │  │  │              │  ├─ ○\r\n│     │  │  │  │              │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │  │              │  ├─ ○\r\n│     │  │  │  │              │  ╰─ Undefined\r\n│     │  │  │  │              ╰─ Constant(Str(state))\r\n│     │  │  │  ╰─ Sum\r\n│     │  │  │     ╰─ Guard\r\n│     │  │  │        ├─ ProjectField\r\n│     │  │  │        │  ├─ Guard\r\n│     │  │  │        │  │  ├─ ○\r\n│     │  │  │        │  │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │        │  │  ├─ ○\r\n│     │  │  │        │  │  ╰─ Undefined\r\n│     │  │  │        │  ╰─ Constant(Str(pop))\r\n│     │  │  │        ├─ Type(Int, Dec, or Interval)\r\n│     │  │  │        ├─ ProjectField\r\n│     │  │  │        │  ├─ Guard\r\n│     │  │  │        │  │  ├─ ○\r\n│     │  │  │        │  │  ├─ Type(Obj(Map[], Some(Top)))\r\n│     │  │  │        │  │  ├─ ○\r\n│     │  │  │        │  │  ╰─ Undefined\r\n│     │  │  │        │  ╰─ Constant(Str(pop))\r\n│     │  │  │        ╰─ Undefined\r\n│     │  │  ╰─ Repair\r\n│     │  │     ╰─ ConcatArrays\r\n│     │  │        ├─ ConcatArrays\r\n│     │  │        │  ├─ ConcatArrays\r\n│     │  │        │  │  ├─ MakeArray\r\n│     │  │        │  │  │  ╰─ ConcatArrays\r\n│     │  │        │  │  │     ├─ MakeArray\r\n│     │  │        │  │  │     │  ╰─ ProjectIndex\r\n│     │  │        │  │  │     │     ├─ ReduceIndex(0)\r\n│     │  │        │  │  │     │     ╰─ Constant(Int(0))\r\n│     │  │        │  │  │     ╰─ MakeArray\r\n│     │  │        │  │  │        ╰─ ProjectIndex\r\n│     │  │        │  │  │           ├─ ReduceIndex(3)\r\n│     │  │        │  │  │           ╰─ Constant(Int(0))\r\n│     │  │        │  │  ╰─ MakeArray\r\n│     │  │        │  │     ╰─ ConcatArrays\r\n│     │  │        │  │        ├─ MakeArray\r\n│     │  │        │  │        │  ╰─ ProjectIndex\r\n│     │  │        │  │        │     ├─ ReduceIndex(5)\r\n│     │  │        │  │        │     ╰─ Constant(Int(0))\r\n│     │  │        │  │        ╰─ MakeArray\r\n│     │  │        │  │           ╰─ ProjectIndex\r\n│     │  │        │  │              ├─ ReduceIndex(6)\r\n│     │  │        │  │              ╰─ Constant(Int(0))\r\n│     │  │        │  ╰─ MakeArray\r\n│     │  │        │     ╰─ ConcatMaps\r\n│     │  │        │        ├─ ConcatMaps\r\n│     │  │        │        │  ├─ MakeMap\r\n│     │  │        │        │  │  ├─ Constant(Str(city))\r\n│     │  │        │        │  │  ╰─ ReduceIndex(1)\r\n│     │  │        │        │  ╰─ MakeMap\r\n│     │  │        │        │     ├─ Constant(Str(state))\r\n│     │  │        │        │     ╰─ ReduceIndex(2)\r\n│     │  │        │        ╰─ MakeMap\r\n│     │  │        │           ├─ Constant(Str(population))\r\n│     │  │        │           ╰─ ReduceIndex(4)\r\n│     │  │        ╰─ MakeArray\r\n│     │  │           ╰─ ReduceIndex(7)\r\n│     │  ├─ Bucket\r\n│     │  │  ╰─ Constant(Null())\r\n│     │  ╰─ Order\r\n│     │     ╰─ Descending\r\n│     │        ╰─ By\r\n│     │           ╰─ ProjectIndex\r\n│     │              ├─ ○\r\n│     │              ╰─ Constant(Int(3))\r\n│     ╰─ ProjectIndex\r\n│        ├─ ○\r\n│        ╰─ Constant(Int(2))\r\n╰─ Count\r\n   ╰─ Map\r\n      ├─ Unreferenced\r\n╰─ Constant(Int(5))\r\n```"},"comment":{"url":"https://api.github.com/repos/quasar-analytics/quasar/issues/comments/265865868","html_url":"https://github.com/quasar-analytics/quasar/issues/1769#issuecomment-265865868","issue_url":"https://api.github.com/repos/quasar-analytics/quasar/issues/1769","id":265865868,"user":{"login":"alissapajer","id":1088100,"avatar_url":"https://avatars.githubusercontent.com/u/1088100?v=3","gravatar_id":"","url":"https://api.github.com/users/alissapajer","html_url":"https://github.com/alissapajer","followers_url":"https://api.github.com/users/alissapajer/followers","following_url":"https://api.github.com/users/alissapajer/following{/other_user}","gists_url":"https://api.github.com/users/alissapajer/gists{/gist_id}","starred_url":"https://api.github.com/users/alissapajer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alissapajer/subscriptions","organizations_url":"https://api.github.com/users/alissapajer/orgs","repos_url":"https://api.github.com/users/alissapajer/repos","events_url":"https://api.github.com/users/alissapajer/events{/privacy}","received_events_url":"https://api.github.com/users/alissapajer/received_events","type":"User","site_admin":false},"created_at":"2016-12-08T21:49:31Z","updated_at":"2016-12-08T21:49:31Z","body":"Yeah my only point was what we could do if we didn't need that access. And to point out the case when we might need to access the entire bucket."}}
{"actor":{"display_login":"alissapajer"}}