{"action":"created","issue":{"url":"https://api.github.com/repos/slamdata/quasar/issues/936","labels_url":"https://api.github.com/repos/slamdata/quasar/issues/936/labels{/name}","comments_url":"https://api.github.com/repos/slamdata/quasar/issues/936/comments","events_url":"https://api.github.com/repos/slamdata/quasar/issues/936/events","html_url":"https://github.com/slamdata/quasar/pull/936","id":107824828,"number":936,"title":"[SD-837] Fix handling of constants in library aggregation functions","user":{"login":"jedesah","id":1780116,"avatar_url":"https://avatars.githubusercontent.com/u/1780116?v=3","gravatar_id":"","url":"https://api.github.com/users/jedesah","html_url":"https://github.com/jedesah","followers_url":"https://api.github.com/users/jedesah/followers","following_url":"https://api.github.com/users/jedesah/following{/other_user}","gists_url":"https://api.github.com/users/jedesah/gists{/gist_id}","starred_url":"https://api.github.com/users/jedesah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jedesah/subscriptions","organizations_url":"https://api.github.com/users/jedesah/orgs","repos_url":"https://api.github.com/users/jedesah/repos","events_url":"https://api.github.com/users/jedesah/events{/privacy}","received_events_url":"https://api.github.com/users/jedesah/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"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},"milestone":null,"comments":6,"created_at":"2015-09-22T23:41:27Z","updated_at":"2015-09-24T10:00:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/slamdata/quasar/pulls/936","html_url":"https://github.com/slamdata/quasar/pull/936","diff_url":"https://github.com/slamdata/quasar/pull/936.diff","patch_url":"https://github.com/slamdata/quasar/pull/936.patch"},"body":"Authored with @wemrysi"},"comment":{"url":"https://api.github.com/repos/slamdata/quasar/issues/comments/142879544","html_url":"https://github.com/slamdata/quasar/pull/936#issuecomment-142879544","issue_url":"https://api.github.com/repos/slamdata/quasar/issues/936","id":142879544,"user":{"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},"created_at":"2015-09-24T10:00:56Z","updated_at":"2015-09-24T10:00:56Z","body":"> I thought that was mentioned in the ticket, which @jdegoes did say deviates from SQL.\r\n\r\nUnder MRA, which has local / compositional semantics, yes, `SUM(1) = 1`. That's sort of independent from SQL<sup>2</sup>, however, since we can \"fix up\" these sorts of things quite easily (in MRA, emulation can be done by a map of the `*` set to a constant, namely `1`, which is then aggregated). \r\n\r\nIn any case, the fix for ANSI SQL compatibility would be in the _logical plan_, after compilation. The planner should definitely be compiling `SUM(1)` to something that evaluates to `1`.\r\n\r\nThe question of whether or not we want to \"fix up\" (re-break?) SQL for backward compatibility is a good one. Since we are introducing syntactic extensions to satisfy all characteristics of NoSQL analytics systems (rather than emulating flat tables or some such), the SQL people will be using in practice is not ANSI SQL; they can't just wholesale re-use existing queries. So I think we have flexibility to break with ANSI SQL in a few key places for consistency, or possibly introduce compilation flags (non-local mode versus local mode) in which various transformations are used to \"fix up\" a compiled logical plan before sending it off to the planner."}}